Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b56392d

Browse files
committedJun 30, 2014
Fix network buttons on protips
Task coderwall#128
1 parent 44bbcc1 commit b56392d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎app/views/protips/_protip.html.haml

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
-slug = Network.slugify(name)
3939
%li{:style => "border-color:##{color_signature(slug)}"}
4040
%a.name{:href => network_path(:id => slug)}= name
41-
=link_to '', leave_network_path(:id => slug), :class => "follow #{slug}", :remote => true, :method => :post, :rel => "nofollow", :'data-follow-type' => 'Networks', :'data-value' => "#{slug}"
41+
-followed = current_user.member_of?(Network.find_by_slug(slug))
42+
=link_to '', followed ? leave_network_path(:id => slug) : join_network_path(:id => slug), :class => followed ? "follow followed #{slug}" : "follow #{slug}", :remote => true, :method => :post, :rel => "nofollow", :'data-follow-type' => 'Networks', :'data-value' => "#{slug}"
4243

4344
-unless mode == 'preview'
4445
-if protip_owner?(protip, current_user) || is_admin?

0 commit comments

Comments
 (0)
Please sign in to comment.