From d8964fab94553b158739470bfc7c2702cf566026 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 22 Feb 2008 23:10:51 +0000 Subject: [PATCH] ActionItem36: showing/hiding field for group --- app/controllers/my_profile/tasks_controller.rb | 2 +- app/views/tasks/_add_friend.rhtml | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index 0049f8c..0541cd3 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -13,7 +13,7 @@ class TasksController < MyProfileController def close decision = params[:decision] if request.post? && VALID_DECISIONS.include?(decision) && params[:id] - task = Task.find(params[:id]) + task = profile.tasks.find(params[:id]) task.update_attributes!(params[:task]) task.send(decision) end diff --git a/app/views/tasks/_add_friend.rhtml b/app/views/tasks/_add_friend.rhtml index 8cc9272..4a10784 100644 --- a/app/views/tasks/_add_friend.rhtml +++ b/app/views/tasks/_add_friend.rhtml @@ -4,16 +4,20 @@ <%= _('%s wants to connect to you as a friend.') % task.requestor.name %>

-<% labelled_form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %> +<% form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %>
- <%= radio_button_tag(:decision, 'finish', true) %> - <%= _('Accept') %> + <%= radio_button_tag(:decision, 'finish', true, :id => "decision-finish-#{task.id}", :onclick => "Element.show('group-for-person-#{task.id}')") %> + <%= _('Accept') %> + + <% content_tag('div', :id => "group-for-person-#{task.id}") do %> + <%= labelled_form_field(_('Add %s to the following group:') % task.requestor.name, f.text_field(:group_for_person)) %> + <% end %>
- <%= radio_button_tag(:decision, 'cancel', false) %> - <%= _('Ignore') %> + <%= radio_button_tag(:decision, 'cancel', false, :id => "decision-cancel-#{task.id}", :onclick => "Element.hide('group-for-person-#{task.id}')") %> + <%= _('Ignore') %>
<% button_bar do %> -- libgit2 0.21.2