Merge branch 'master' of github.com:r888888888/danbooru

t push
This commit is contained in:
r888888888
2013-05-03 17:29:53 -07:00
5 changed files with 6 additions and 13 deletions

View File

@@ -4,8 +4,6 @@ class FavoritesController < ApplicationController
def index
if params[:tags]
redirect_to(posts_path(:tags => params[:tags]))
elsif request.format == Mime::JS
list_favorited_users
elsif params[:user_id]
@favorite_set = PostSets::Favorite.new(User.find(params[:user_id]), params[:page], params)
else
@@ -26,9 +24,4 @@ class FavoritesController < ApplicationController
@post = Post.find(params[:id])
@post.remove_favorite!(CurrentUser.user)
end
def list_favorited_users
@post = Post.find(params[:post_id])
render :action => "list_favorited_users"
end
end

View File

@@ -41,6 +41,10 @@ module PostsHelper
end
end
def post_favlist(post)
post.favorited_users.reverse_each.map{|user| link_to_user(user)}.join(", ").html_safe
end
def has_parent_message(post, parent_post_set)
html = ""

View File

@@ -1 +0,0 @@
<%= post.favorited_users.reverse_each.map{|user| link_to_user(user)}.join(", ").html_safe %>

View File

@@ -1,3 +0,0 @@
$("#favlist").html("<%= j(render(:partial => "favorites/favorited_users_list", :locals => { :post => @post }))%>");
$("#show-favlist-link").attr("href", "#").removeAttr("data-remote");

View File

@@ -16,9 +16,9 @@
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> <% if CurrentUser.is_gold? %>(vote <%= link_to "up", post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %>/<%= link_to "down", post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %>)<% end %></li>
<li>Favorites: <span id="favcount-for-post-<%= post.id %>"><%= post.fav_count %></span>
<% if CurrentUser.is_gold? && post.fav_count > 0 %>
<%= link_to "&raquo;".html_safe, favorites_path(:post_id => post.id), :remote => true, :id => "show-favlist-link" %>
<%= link_to "&raquo;".html_safe, "#", :id => "show-favlist-link" %>
<%= link_to "&laquo;".html_safe, "#", :id => "hide-favlist-link" %>
<div id="favlist"></div>
<div id="favlist"><%= post_favlist(post) %></div>
<% end %></li>
<li>
Status: