From 510777853a64ab98d4245e9dca948518fc0057e8 Mon Sep 17 00:00:00 2001 From: Artur Bersan de Faria Date: Mon, 13 Jun 2016 15:25:34 -0300 Subject: [PATCH] Create controller action --- app/controllers/my_profile/followed_people_controller.rb | 10 ---------- app/controllers/my_profile/followers_controller.rb | 10 ++++++++++ app/controllers/public/profile_controller.rb | 12 ++++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) delete mode 100644 app/controllers/my_profile/followed_people_controller.rb create mode 100644 app/controllers/my_profile/followers_controller.rb diff --git a/app/controllers/my_profile/followed_people_controller.rb b/app/controllers/my_profile/followed_people_controller.rb deleted file mode 100644 index ee38813..0000000 --- a/app/controllers/my_profile/followed_people_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -class FollowedPeopleController < MyProfileController - - def index - @followed_people = Person.all.limit(10).paginate(:per_page => 5, :page => params[:npage]) - end - - def set_category - render :partial => "set_category_modal" - end -end diff --git a/app/controllers/my_profile/followers_controller.rb b/app/controllers/my_profile/followers_controller.rb new file mode 100644 index 0000000..ee38813 --- /dev/null +++ b/app/controllers/my_profile/followers_controller.rb @@ -0,0 +1,10 @@ +class FollowedPeopleController < MyProfileController + + def index + @followed_people = Person.all.limit(10).paginate(:per_page => 5, :page => params[:npage]) + end + + def set_category + render :partial => "set_category_modal" + end +end diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 0540690..206f541 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -155,6 +155,18 @@ class ProfileController < PublicController end end + def follow + if !current_person.follows?(profile) + current_person.follow(profile) + end + end + + def unfollow + if current_person.follows?(profile) + current_person.unfollow(profile) + end + end + def check_friendship unless logged_in? render :text => '' -- libgit2 0.21.2