tweak styles for fav button

This commit is contained in:
Albert Yi
2018-10-24 10:02:50 -07:00
parent c0ab54b889
commit 21a08d17a4
4 changed files with 11 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
$("#add-to-favorites, #add-fav-button, #remove-from-favorites, #remove-fav-button").toggle();
$("#score-for-post-<%= @post.id %>").text(<%= @post.score %>);
$("#favcount-for-post-<%= @post.id %>").text(<%= @post.fav_count %>);
$(".fav-buttons").toggleClass("fav-buttons-false").toggleClass("fav-buttons-true");
<% if CurrentUser.is_gold? %>
var fav_count = <%= @post.fav_count %>;

View File

@@ -56,11 +56,11 @@
<% if CurrentUser.is_member? %>
<%= content_tag(:div, class: "fav-buttons fav-buttons-#{@post.is_favorited?}") do %>
<%= form_tag(favorites_path(post_id: @post.id), method: "post", id: "add-fav-button", "data-remote": true) do %>
<%= button_tag tag.i(class: "far fa-heart") + " Favorite", class: "ui-button ui-widget ui-corner-all gradient", "data-disable-with": "Favoriting..." %>
<%= button_tag tag.i(class: "far fa-heart"), class: "ui-button ui-widget ui-corner-all gradient", "data-disable-with": "..." %>
<% end %>
<%= form_tag(favorite_path(@post.id), method: "delete", id: "remove-fav-button", "data-remote": true) do %>
<%= button_tag tag.i(class: "fas fa-heart") + " Unfavorite", class: "ui-button ui-widget ui-corner-all gradient", "data-disable-with": "Updating..." %>
<%= button_tag tag.i(class: "fas fa-heart"), class: "ui-button ui-widget ui-corner-all gradient", "data-disable-with": "..." %>
<% end %>
<% end %>
<% end %>