Commit c30872d615166cb31dcd85352d82f6550bc11dcb
1 parent
51077785
Exists in
federation_followers_backend
Creates follow category form
Signed-off-by: Artur Bersan de Faria <artur_bersan@hotmail.com> Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Showing
6 changed files
with
32 additions
and
5 deletions
Show diff stats
app/controllers/public/profile_controller.rb
@@ -157,14 +157,16 @@ class ProfileController < PublicController | @@ -157,14 +157,16 @@ class ProfileController < PublicController | ||
157 | 157 | ||
158 | def follow | 158 | def follow |
159 | if !current_person.follows?(profile) | 159 | if !current_person.follows?(profile) |
160 | - current_person.follow(profile) | 160 | + current_person.follow(profile, params['follow']['category']) |
161 | end | 161 | end |
162 | + redirect_to profile.url | ||
162 | end | 163 | end |
163 | 164 | ||
164 | def unfollow | 165 | def unfollow |
165 | if current_person.follows?(profile) | 166 | if current_person.follows?(profile) |
166 | current_person.unfollow(profile) | 167 | current_person.unfollow(profile) |
167 | end | 168 | end |
169 | + redirect_to profile.url | ||
168 | end | 170 | end |
169 | 171 | ||
170 | def check_friendship | 172 | def check_friendship |
app/models/person.rb
@@ -200,7 +200,7 @@ class Person < Profile | @@ -200,7 +200,7 @@ class Person < Profile | ||
200 | end | 200 | end |
201 | end | 201 | end |
202 | 202 | ||
203 | - def follow(profile, group = nil) | 203 | + def follow(profile, group = "") |
204 | unless self.following_profiles.include?(profile) | 204 | unless self.following_profiles.include?(profile) |
205 | profile_follower = ProfileFollower.new | 205 | profile_follower = ProfileFollower.new |
206 | profile_follower.profile = profile | 206 | profile_follower.profile = profile |
app/views/blocks/profile_info_actions/_person.html.erb
@@ -8,10 +8,15 @@ | @@ -8,10 +8,15 @@ | ||
8 | <% end %> | 8 | <% end %> |
9 | 9 | ||
10 | <li> | 10 | <li> |
11 | - <% if profile.follows?(user) %> | ||
12 | - <%= button(:unfollow, content_tag('span', _('Unfollow')), "#", :class => 'add-friend', :title => _("Unfollow"), :style => 'position: relative;') %> | 11 | + <% if user.follows?(profile) %> |
12 | + <%= button(:unfollow, content_tag('span', _('Unfollow')), {:profile => profile.identifier, :controller => 'profile', :action => 'unfollow'}) %> | ||
13 | <% else %> | 13 | <% else %> |
14 | - <%= modal_button(:follow, _('Follow'),{ :profile => profile.identifier, :controller => 'followed_people', :action => 'set_category'}, :title => _("Follow"), :style => 'position: relative;') %> | 14 | + <form id="follower-container" action="<%= url_for({:profile => profile.identifier, :controller => 'profile', :action => 'follow'}) %>"> |
15 | + <div id="category-form" style="display: none;"> | ||
16 | + <%= labelled_text_field _("Choose a category: "), "follow[category]" %> | ||
17 | + </div> | ||
18 | + <%= submit_button('follow', _('Follow')) %> | ||
19 | + </form> | ||
15 | <% end %> | 20 | <% end %> |
16 | </li> | 21 | </li> |
17 | 22 |
public/javascripts/application.js
@@ -26,6 +26,7 @@ | @@ -26,6 +26,7 @@ | ||
26 | *= require pagination.js | 26 | *= require pagination.js |
27 | * views speficics | 27 | * views speficics |
28 | *= require add-and-join.js | 28 | *= require add-and-join.js |
29 | +*= require followers.js | ||
29 | *= require report-abuse.js | 30 | *= require report-abuse.js |
30 | *= require autogrow.js | 31 | *= require autogrow.js |
31 | *= require require_login.js | 32 | *= require require_login.js |
public/stylesheets/blocks/profile-info.scss
@@ -99,3 +99,17 @@ | @@ -99,3 +99,17 @@ | ||
99 | margin: 0px 0px 5px 0px; | 99 | margin: 0px 0px 5px 0px; |
100 | padding: 2px; | 100 | padding: 2px; |
101 | } | 101 | } |
102 | +#follower-container { | ||
103 | + padding-top: 5px; | ||
104 | +} | ||
105 | +#follower-container:hover { | ||
106 | + background-color: #eee; | ||
107 | + -o-transition:.5s; | ||
108 | + -ms-transition:.5s; | ||
109 | + -moz-transition:.5s; | ||
110 | + -webkit-transition:.5s; | ||
111 | + transition:.5s; | ||
112 | +} | ||
113 | +#follower-container #category-form { | ||
114 | + margin-bottom: 5px; | ||
115 | +} |