From d62a7c4ce2a601cba6adb9df240a14d608881a44 Mon Sep 17 00:00:00 2001 From: Raphael <raphael@joindiaspora.com> Date: Wed, 10 Nov 2010 20:12:09 -0800 Subject: [PATCH] Fix request views, refactor identical forms into partial. --- Rakefile | 1 - app/views/people/_person.html.haml | 5 +---- app/views/people/show.html.haml | 5 +---- app/views/requests/_new_request_to_person.haml | 10 ++++++++++ 4 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 app/views/requests/_new_request_to_person.haml diff --git a/Rakefile b/Rakefile index c5f2232934..9b81a97048 100644 --- a/Rakefile +++ b/Rakefile @@ -7,6 +7,5 @@ require File.expand_path('../config/application', __FILE__) require 'rake' -ENV['GNUPGHOME'] = File.expand_path("../../gpg/diaspora-#{Rails.env}/", __FILE__) Diaspora::Application.load_tasks diff --git a/app/views/people/_person.html.haml b/app/views/people/_person.html.haml index 62dbf93513..1c737d7dc7 100644 --- a/app/views/people/_person.html.haml +++ b/app/views/people/_person.html.haml @@ -18,10 +18,7 @@ - elsif current_user.pending_requests.find_by_person_id(person.id) = link_to =t('.pending_request'), aspects_manage_path - else - = form_tag(requests_path) do - = select_tag(:aspect_id, @aspects_dropdown_array.join.html_safe) - = hidden_field_tag :destination_handle, :value => person.diaspora_handle - = submit_tag t('.add_friend') + = render :partial => 'requests/new_request_to_person', :locals => {:aspects => @aspects, :person => person} .info = person.diaspora_handle diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 0486b63e41..f88e45c087 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -30,10 +30,7 @@ .description = t('.request_people') - = form_tag(requests_path) do - = select_tag(:aspect_id, @aspects_dropdown_array.join.html_safe) - = hidden_field_tag :destination_handle, :value => @person.diaspora_handle - = submit_tag t('.add_friend') + = render :partial =>'requests/new_request_to_person', :locals => {:aspects => @aspects, :person => @person} - else %h3 diff --git a/app/views/requests/_new_request_to_person.haml b/app/views/requests/_new_request_to_person.haml new file mode 100644 index 0000000000..9a7d1a9cc5 --- /dev/null +++ b/app/views/requests/_new_request_to_person.haml @@ -0,0 +1,10 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + += form_tag(requests_path) do + - pp person + - pp aspects + = select_tag(:aspect_id, options_from_collection_for_select(aspects, "id", "name")) + = hidden_field_tag :destination_handle, :value => person.diaspora_handle + = submit_tag t('people.person.add_friend') -- GitLab