socialforge/app/views/users/_collect_course.html.erb

10 lines
657 B
Plaintext

<% member = Member.where("user_id = #{@user.id} and course_id = #{course.id}").first %>
<% if User.current == @user %>
<% if member %>
<%= link_to "", cancel_or_collect_user_path(@user, :course => course.id), :class => "#{member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的班级列表中移除' : '点击将其添加至个人主页的班级列表中'}" %>
<% end %>
<% else %>
<% if member %>
<span class="<%= member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'%>"></span>
<% end %>
<% end %>