posts: fix favorite icon.

Fix the favorite button using the outlined heart icon instead of the
solid heart icon.
This commit is contained in:
evazion
2021-01-23 14:33:45 -06:00
parent 7629a99030
commit 5fd33ad545
5 changed files with 10 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ class PostPreviewComponent < ApplicationComponent
with_collection_parameter :post
attr_reader :post, :tags, :show_deleted, :show_cropped, :link_target, :pool, :pool_id, :favgroup_id, :similarity, :recommended, :compact, :size, :current_user, :options
delegate :external_link_to, :time_ago_in_words_tagged, :favorite_icon, to: :helpers
delegate :external_link_to, :time_ago_in_words_tagged, :empty_heart_icon, to: :helpers
def initialize(post:, tags: "", show_deleted: false, show_cropped: true, link_target: post, pool: nil, pool_id: nil, favgroup_id: nil, similarity: nil, recommended: nil, compact: nil, size: nil, current_user: CurrentUser.user, **options)
@post = post

View File

@@ -38,7 +38,7 @@
<%= link_to recommended_posts_path(search: { post_id: post.id }), class: "more-recommended-posts", "data-post-id": post.id do %>
<%= post.fav_count %>
<%= favorite_icon(class: "fa-xs") %>
<%= empty_heart_icon(class: "fa-xs") %>
<br>more »
<% end %>

View File

@@ -57,10 +57,14 @@ module IconHelper
icon_tag("fas fa-bookmark", **options)
end
def favorite_icon(**options)
def empty_heart_icon(**options)
icon_tag("far fa-heart", **options)
end
def solid_heart_icon(**options)
icon_tag("fas fa-heart", **options)
end
def comments_icon(**options)
icon_tag("far fa-comments", **options)
end

View File

@@ -3,7 +3,7 @@
<span class="post-tooltip-favorites post-tooltip-info">
<span><%= @post.fav_count %></span>
<%= favorite_icon(class: "fa-xs") %>
<%= empty_heart_icon(class: "fa-xs") %>
</span>
<span class="post-tooltip-score post-tooltip-info">

View File

@@ -52,11 +52,11 @@
<% if policy(Favorite).create? %>
<%= content_tag(:div, class: "fav-buttons fav-buttons-#{@post.favorited_by?(CurrentUser.user)}") do %>
<%= form_tag(favorites_path(post_id: @post.id), method: "post", id: "add-fav-button", "data-remote": true) do %>
<%= button_tag favorite_icon, class: "ui-button ui-widget ui-corner-all", "data-disable-with": spinner_icon %>
<%= button_tag empty_heart_icon, class: "ui-button ui-widget ui-corner-all", "data-disable-with": spinner_icon %>
<% end %>
<%= form_tag(favorite_path(@post.id), method: "delete", id: "remove-fav-button", "data-remote": true) do %>
<%= button_tag favorite_icon, class: "ui-button ui-widget ui-corner-all", "data-disable-with": spinner_icon %>
<%= button_tag solid_heart_icon, class: "ui-button ui-widget ui-corner-all", "data-disable-with": spinner_icon %>
<% end %>
<% end %>
<% end %>