add favorite/unfavorite links to mobile page
This commit is contained in:
@@ -51,8 +51,14 @@ img#image {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
div#tags {
|
||||
div#options {
|
||||
margin-top: 10px;
|
||||
font-size: 24pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div#tags {
|
||||
margin-top: 30px;
|
||||
|
||||
li {
|
||||
margin: 10px 0;
|
||||
|
||||
@@ -24,10 +24,22 @@ class FavoritesController < ApplicationController
|
||||
else
|
||||
@error_msg = "You can only keep up to #{CurrentUser.favorite_limit} favorites. Upgrade your account to save more."
|
||||
end
|
||||
|
||||
respond_with(@post) do |format|
|
||||
format.html do
|
||||
redirect_to(mobile_post_path(@post))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@post = Post.find(params[:id])
|
||||
@post.remove_favorite!(CurrentUser.user)
|
||||
|
||||
respond_with(@post) do |format|
|
||||
format.html do
|
||||
redirect_to(mobile_post_path(@post))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
||||
<%= csrf_meta_tag %>
|
||||
<%= stylesheet_link_tag "mobile", :media => "screen" %>
|
||||
<%= javascript_include_tag "jquery-1.10.1.min.js" %>
|
||||
<%= javascript_include_tag "rails.js" %>
|
||||
<%= Danbooru.config.custom_html_header_content %>
|
||||
<%= yield :html_header %>
|
||||
</head>
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
|
||||
<%= @post.presenter.image_html(self) %>
|
||||
|
||||
<div id="options">
|
||||
<% if @post.favorited_by?(CurrentUser.user.id) %>
|
||||
<%= link_to "Unfavorite", favorite_path(@post), :method => :delete %> |
|
||||
<% else %>
|
||||
<%= link_to "Favorite", favorites_path(:post_id => @post.id), :method => :post %> |
|
||||
<% end %>
|
||||
<%= link_to "Non-mobile Version", post_path(@post.id) %>
|
||||
</div>
|
||||
|
||||
<div id="tags">
|
||||
<%= @post.presenter.tag_list_html(self, :name_only => true, :path_prefix => "/m/posts") %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user