2015-07-09 15:27:49 +08:00
|
|
|
<% if( params[:object_type] == 'user') %>
|
2015-08-21 15:23:03 +08:00
|
|
|
//点击头像下面的添加关注按钮
|
2015-07-09 15:27:49 +08:00
|
|
|
<% if( params[:target_id] == params[:object_id] ) %>
|
2015-08-29 14:46:30 +08:00
|
|
|
$("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>");
|
2015-08-21 15:23:03 +08:00
|
|
|
$("#user_fans_number").html("<%= watched.first.watcher_users.count.to_s%>");
|
|
|
|
//在当前用户的粉丝、关注页面
|
2015-07-09 15:27:49 +08:00
|
|
|
<% elsif( params[:target_id] == User.current.id.to_s )%>
|
2015-08-26 11:41:32 +08:00
|
|
|
$("#users_list").html("<%= escape_javascript (render :partial => 'users/user_fans_item', :locals => {:list => list,:target=>User.current,:action_name=>action_name,:page=>params[:page]}) %>");
|
|
|
|
$("#watch_user_number_div").html('<%= escape_javascript ( link_to User.watched_by(params[:target_id]).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>params[:target_id]},:class=>"homepageImageNumber") %>');
|
|
|
|
$("#fans_user_number_div").html('<%= escape_javascript ( link_to User.find(params[:target_id]).watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>params[:target_id]},:class=>"homepageImageNumber", :id => "user_fans_number") %>');
|
2015-08-26 14:39:33 +08:00
|
|
|
$("#fans_span").html('<%= count %>');
|
|
|
|
$("#watch_span").html('<%= count %>');
|
2015-08-21 15:23:03 +08:00
|
|
|
//在其他用户的粉丝、关注页面
|
2015-07-09 15:27:49 +08:00
|
|
|
<% else %>
|
2015-08-26 11:41:32 +08:00
|
|
|
$("#users_list").html("<%= escape_javascript (render :partial => 'users/user_fans_item', :locals => {:list => list,:target=>User.find(params[:target_id]),:action_name=>action_name,:page=>params[:page]}) %>");
|
|
|
|
//在他人的用户分析下关注,不会改变他人的关注数,所以不必要刷新
|
|
|
|
//$("#watch_user_number").html('<%#= escape_javascript ( link_to User.watched_by(params[:target_id]).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>params[:target_id]},:class=>"homepageImageNumber") %>');
|
2015-08-21 15:23:03 +08:00
|
|
|
<% end %>
|
2015-07-09 15:27:49 +08:00
|
|
|
<% else %>
|
|
|
|
|
2015-04-15 12:30:37 +08:00
|
|
|
<% selector = ".#{watcher_css(watched)}" %>
|
|
|
|
<% id_selector = "#{watcher_css(watched)}" %>
|
|
|
|
if($("<%= selector %>").get(0) == undefined)
|
|
|
|
{
|
2015-07-09 15:27:49 +08:00
|
|
|
$("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")});
|
2015-04-15 12:30:37 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-09 15:27:49 +08:00
|
|
|
$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")});
|
2015-04-15 12:30:37 +08:00
|
|
|
}
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|