From 6bee872039007a3eb85dba2b8419bccae5208955 Mon Sep 17 00:00:00 2001 From: ilya <ilya@laptop.(none)> Date: Wed, 20 Oct 2010 15:41:42 -0700 Subject: [PATCH] moved the add people into a partial --- app/controllers/aspects_controller.rb | 2 +- app/views/requests/_new_request.haml | 7 +++---- app/views/shared/_add_friend_dropdown.html.haml | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 app/views/shared/_add_friend_dropdown.html.haml diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index fed5f0aaea..016037ee1b 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -46,7 +46,7 @@ class AspectsController < ApplicationController def show @aspect = current_user.aspect_by_id params[:id] - @friends_dropdown_array = current_user.friends.all(:person_id.nin => @aspect.person_ids ) + @friends_not_in_aspect = current_user.friends.all(:person_id.nin => @aspect.person_ids ) unless @aspect render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml index d973284b4a..c67bc61b94 100644 --- a/app/views/requests/_new_request.haml +++ b/app/views/requests/_new_request.haml @@ -8,10 +8,9 @@ =t('.add_a_new_friend_to') %i= aspect.name - = form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do - = select_tag :friend_id, options_from_collection_for_select(@friends_dropdown_array, "id", "real_name"), :include_blank => true - = hidden_field_tag :aspect_id, aspect.id - = submit_tag "add to #{@aspect.name}" + - if @friends_not_in_aspect + = render('shared/add_friend_dropdown', :aspect => @aspect, :friends => @friends_not_in_aspect) + diff --git a/app/views/shared/_add_friend_dropdown.html.haml b/app/views/shared/_add_friend_dropdown.html.haml new file mode 100644 index 0000000000..ee39fc6ad5 --- /dev/null +++ b/app/views/shared/_add_friend_dropdown.html.haml @@ -0,0 +1,5 @@ + += form_tag '/aspects/add_to_aspect', :id => 'add_to_aspect' do + = select_tag :friend_id, options_from_collection_for_select(friends, "id", "real_name"), :include_blank => true + = hidden_field_tag :aspect_id, aspect.id + = submit_tag "add to #{aspect.name}" -- GitLab