diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 206f541..e091766 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -157,14 +157,16 @@ class ProfileController < PublicController def follow if !current_person.follows?(profile) - current_person.follow(profile) + current_person.follow(profile, params['follow']['category']) end + redirect_to profile.url end def unfollow if current_person.follows?(profile) current_person.unfollow(profile) end + redirect_to profile.url end def check_friendship diff --git a/app/models/person.rb b/app/models/person.rb index db2c275..d9f19b2 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -200,7 +200,7 @@ class Person < Profile end end - def follow(profile, group = nil) + def follow(profile, group = "") unless self.following_profiles.include?(profile) profile_follower = ProfileFollower.new profile_follower.profile = profile diff --git a/app/views/blocks/profile_info_actions/_person.html.erb b/app/views/blocks/profile_info_actions/_person.html.erb index 3cf9f23..b523369 100644 --- a/app/views/blocks/profile_info_actions/_person.html.erb +++ b/app/views/blocks/profile_info_actions/_person.html.erb @@ -8,10 +8,15 @@ <% end %>
  • - <% if profile.follows?(user) %> - <%= button(:unfollow, content_tag('span', _('Unfollow')), "#", :class => 'add-friend', :title => _("Unfollow"), :style => 'position: relative;') %> + <% if user.follows?(profile) %> + <%= button(:unfollow, content_tag('span', _('Unfollow')), {:profile => profile.identifier, :controller => 'profile', :action => 'unfollow'}) %> <% else %> - <%= modal_button(:follow, _('Follow'),{ :profile => profile.identifier, :controller => 'followed_people', :action => 'set_category'}, :title => _("Follow"), :style => 'position: relative;') %> +
    + + <%= submit_button('follow', _('Follow')) %> +
    <% end %>
  • diff --git a/public/javascripts/application.js b/public/javascripts/application.js index fff7e9b..25d00c6 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -26,6 +26,7 @@ *= require pagination.js * views speficics *= require add-and-join.js +*= require followers.js *= require report-abuse.js *= require autogrow.js *= require require_login.js diff --git a/public/javascripts/followers.js b/public/javascripts/followers.js new file mode 100644 index 0000000..d7fcece --- /dev/null +++ b/public/javascripts/followers.js @@ -0,0 +1,5 @@ +$("#follower-container").live("mouseenter", function() { + $("#category-form").fadeIn(); +}).live("mouseleave", function() { + $("#category-form").fadeOut(); +}); diff --git a/public/stylesheets/blocks/profile-info.scss b/public/stylesheets/blocks/profile-info.scss index 80fd7f0..cac9d52 100644 --- a/public/stylesheets/blocks/profile-info.scss +++ b/public/stylesheets/blocks/profile-info.scss @@ -99,3 +99,17 @@ margin: 0px 0px 5px 0px; padding: 2px; } +#follower-container { + padding-top: 5px; +} +#follower-container:hover { + background-color: #eee; + -o-transition:.5s; + -ms-transition:.5s; + -moz-transition:.5s; + -webkit-transition:.5s; + transition:.5s; +} +#follower-container #category-form { + margin-bottom: 5px; +} -- libgit2 0.21.2