add favorite action underneath image

This commit is contained in:
r888888888
2017-09-05 14:41:33 -07:00
parent 93ce433c0c
commit bb228d5735
6 changed files with 18 additions and 5 deletions

View File

@@ -1,4 +1,3 @@
<% if post.visible? %>
<%= image_tag(post.file_url_for(CurrentUser.user), :width => post.image_width_for(CurrentUser.user), :height => post.image_height_for(CurrentUser.user), :id => "image", "data-original-width" => post.image_width, "data-original-height" => post.image_height, "data-large-width" => post.large_image_width, "data-large-height" => post.large_image_height, "data-tags" => post.tag_string, :alt => post.presenter.humanized_essential_tag_string, "data-uploader" => post.uploader_name, "data-rating" => post.rating, "data-flags" => post.status_flags, "data-parent-id" => post.parent_id, "data-has-children" => post.has_children?, "data-has-active-children" => post.has_active_children?, "data-score" => post.score, "data-fav-count" => post.fav_count, "itemprop" => "contentUrl") %>
<p class="desc" itemprop="description"><%= post.presenter.humanized_essential_tag_string %></p>
<% end %>

View File

@@ -47,6 +47,8 @@
<div id="note-preview"></div>
<%= @post.presenter.image_html(self) %>
</section>
<%= button_to "Favorite", favorites_path(post_id: @post.id), remote: true, method: :post, form: {id: "add-fav-button"} %>
<%= button_to "Unfavorite", favorite_path(@post), remote: true, method: :delete, form: {id: "remove-fav-button"} %>
<section id="mark-as-translated-section" style="display: none;">
<%= form_tag(mark_as_translated_post_path(@post), :class => "simple_form", :method => :put) do |f| %>