添加关注与取消关注

This commit is contained in:
sw 2015-08-29 14:34:59 +08:00
parent 498775b0a8
commit a2ec65a0c9
2 changed files with 10 additions and 12 deletions

View File

@ -1,7 +1,11 @@
<% if User.current.logged?%>
<%if(target.watched_by?(User.current))%>
<%= link_to "",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "homepageFollow", :method => "delete",:remote => "true", :title => "取消关注"%>
<% else %>
<%= link_to "",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "homepageFollowCancel", :method => "post",:remote => "true", :title => "添加关注"%>
<% end %>
<% if User.current == target%>
<%= link_to("编辑资料", my_account_path, :class => "fl UsersEditBtn")%>
<% else%>
<%if(target.watched_by?(User.current))%>
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "UsersApBtn", :method => "delete",:remote => "true", :title => "取消关注"%>
<% else %>
<%= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "UsersAttBtn", :method => "post",:remote => "true", :title => "添加关注"%>
<% end %>
<% end%>
<% end %>

View File

@ -39,10 +39,6 @@
<a href="<%= url_for(:controller => 'my', :action => 'clear_user_avatar_temp') %>" data-remote="true" class="homepageEditProfileIcon"></a>
</div>
</div>
<% else %>
<div id="watch_user_btn" class="none">
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
</div>
<% end %>
<% end%>
</div>
@ -57,9 +53,7 @@
<p class="mb20 c_dark f14">
<%= get_technical_title @user %>
</p>
<%= link_to("编辑资料", my_account_path, :class => "fl UsersEditBtn") if is_current_user%>
<a href="javascript:void(0);" class="UsersAttBtn" style="display:none;">添加关注</a>
<a href="javascript:void(0);" class="UsersApBtn" style="display:none;">取消关注</a>
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
</div>
<div class="cl"></div>
<div>