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:
evazion
2021-05-23 06:33:29 -05:00
parent 6cfdf51795
commit c7fda2772f
4 changed files with 15 additions and 1 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB