关注人数变化
This commit is contained in:
parent
da47f5bb00
commit
d500ea0790
|
@ -41,7 +41,7 @@ class WatchersController < ApplicationController
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||||
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add',:list => @list,:action_name=>params[:action_name],:page=>params[:page]} }
|
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add',:list => @list,:action_name=>params[:action_name],:page=>params[:page],:count=>@obj_count} }
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
if e.message == "404"
|
if e.message == "404"
|
||||||
|
@ -73,7 +73,7 @@ class WatchersController < ApplicationController
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||||
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'delete',:list=>@list,:action_name=>params[:action_name],:page=>params[:page]} }
|
format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'delete',:list=>@list,:action_name=>params[:action_name],:page=>params[:page],:count=>@obj_count} }
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
if e.message == "404"
|
if e.message == "404"
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
<div class="courses_top mb10" id="<%= (@action == 'fans' || @action == 'visitor' ) ? 'nh_fans_list' : 'nh_wacth_list' %>">
|
<div class="courses_top mb10" id="<%= (@action == 'fans' || @action == 'visitor' ) ? 'nh_fans_list' : 'nh_wacth_list' %>">
|
||||||
<% if @action == 'fans' %>
|
<% if @action == 'fans' %>
|
||||||
<h2 class="courses_h2 fl">粉丝</h2>
|
<h2 class="courses_h2 fl">粉丝</h2>
|
||||||
<div class="courses_select fr">共有<span class="c_orange" nh_name="fans_count"><%=@obj_count%></span>名粉丝</div>
|
<div class="courses_select fr">共有<span class="c_orange" nh_name="fans_count" id="fans_span"><%=@obj_count%></span>名粉丝</div>
|
||||||
<% elsif @action == 'visitor' %>
|
<% elsif @action == 'visitor' %>
|
||||||
<h2 class="courses_h2 fl">访客</h2>
|
<h2 class="courses_h2 fl">访客</h2>
|
||||||
<div class="courses_select fr">共有<span class="c_orange"><%=@obj_count%></span>访客</div>
|
<div class="courses_select fr">共有<span class="c_orange"><%=@obj_count%></span>访客</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<h2 class="courses_h2 fl">关注</h2>
|
<h2 class="courses_h2 fl">关注</h2>
|
||||||
<div class="courses_select fr">一共关注<span class="c_orange" nh_name="watcher_count"><%=@obj_count%></span>人</div>
|
<div class="courses_select fr">一共关注<span class="c_orange" nh_name="watcher_count" id="watch_span"><%=@obj_count%></span>人</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
$("#users_list").html("<%= escape_javascript (render :partial => 'users/user_fans_item', :locals => {:list => list,:target=>User.current,:action_name=>action_name,:page=>params[:page]}) %>");
|
$("#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") %>');
|
$("#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") %>');
|
$("#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") %>');
|
||||||
|
$("#fans_span").html('<%= count %>');
|
||||||
|
$("#watch_span").html('<%= count %>');
|
||||||
//在其他用户的粉丝、关注页面
|
//在其他用户的粉丝、关注页面
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#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]}) %>");
|
$("#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]}) %>");
|
||||||
|
|
Loading…
Reference in New Issue