Add singular move friend route, it must be eliminated later

This commit is contained in:
Raphael 2010-08-27 12:27:16 -07:00
parent 5ff1bdae90
commit 7223d21721
3 changed files with 12 additions and 2 deletions

View file

@ -65,5 +65,14 @@ class GroupsController < ApplicationController
redirect_to Group.first, :action => "edit"
end
def move_friend
unless current_user.move_friend( :friend_id => params[:friend_id], :from => params[:from], :to => params[:to][:to])
flash[:error] = "didn't work #{params.inspect}"
end
if group = Group.first(:id => params[:to][:to])
redirect_to group
else
redirect_to Person.first(:id => params[:friend_id])
end
end
end

View file

@ -17,7 +17,7 @@
%li
%i= "friends since: #{how_long_ago(@person)}"
%li
= form_tag move_friends_path
= form_tag move_friend_path
= select :to, :to, @groups_dropdown_array, :selected_value => @groups_with_person.first.id
= hidden_field_tag :from, :from, :value => @groups_with_person.first.id
= hidden_field_tag :friend_id, :friend_id, :value => @person.id

View file

@ -21,6 +21,7 @@ Diaspora::Application.routes.draw do
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
match 'get_to_the_choppa', :to => 'devise/registrations#new', :as => "new_user_registration"
match 'groups/move_friends', :to => 'groups#move_friends', :as => 'move_friends'
match 'groups/move_friend', :to => 'groups#move_friend', :as => 'move_friend'
#public routes
#
match 'webfinger', :to => 'publics#webfinger'