posts: fix rare bug with first post.
Fix a rare bug that occurs once per year that causes post 1 to appear insufficiently festive.
This commit is contained in:
@@ -41,4 +41,8 @@ module PostsHelper
|
||||
source
|
||||
end
|
||||
end
|
||||
|
||||
def is_danbirthday?(post)
|
||||
post.id == 1 && post.created_at.strftime("%m-%d") == Time.zone.today.strftime("%m-%d")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -159,6 +159,16 @@ div#c-posts {
|
||||
|
||||
.image-container {
|
||||
margin: 1em 0 0.5em;
|
||||
|
||||
&.danbirthday::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 33%;
|
||||
top: -16%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: top left/20% no-repeat url(../../../../../public/images/danbirthday.png);
|
||||
}
|
||||
}
|
||||
|
||||
#favlist {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<%= render "posts/partials/show/notices", :post => @post %>
|
||||
|
||||
<%= content_tag(:section, class: "image-container note-container", **PostPreviewComponent.new(post: @post).data_attributes) do -%>
|
||||
<%= tag.section class: ["image-container", "note-container", ("danbirthday" if is_danbirthday?(@post))], **PostPreviewComponent.new(post: @post).data_attributes do -%>
|
||||
<%= render "posts/partials/show/embedded", post: @post %>
|
||||
<div id="note-preview"></div>
|
||||
<% end -%>
|
||||
|
||||
BIN
public/images/danbirthday.png
Executable file
BIN
public/images/danbirthday.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Reference in New Issue
Block a user