Commit d8964fab94553b158739470bfc7c2702cf566026
1 parent
1b3c8fbc
Exists in
master
and in
29 other branches
ActionItem36: showing/hiding field for group
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1491 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
10 additions
and
6 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
... | ... | @@ -13,7 +13,7 @@ class TasksController < MyProfileController |
13 | 13 | def close |
14 | 14 | decision = params[:decision] |
15 | 15 | if request.post? && VALID_DECISIONS.include?(decision) && params[:id] |
16 | - task = Task.find(params[:id]) | |
16 | + task = profile.tasks.find(params[:id]) | |
17 | 17 | task.update_attributes!(params[:task]) |
18 | 18 | task.send(decision) |
19 | 19 | end | ... | ... |
app/views/tasks/_add_friend.rhtml
... | ... | @@ -4,16 +4,20 @@ |
4 | 4 | <%= _('%s wants to connect to you as a friend.') % task.requestor.name %> |
5 | 5 | </p> |
6 | 6 | |
7 | -<% labelled_form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %> | |
7 | +<% form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %> | |
8 | 8 | |
9 | 9 | <div> |
10 | - <%= radio_button_tag(:decision, 'finish', true) %> | |
11 | - <%= _('Accept') %> | |
10 | + <%= radio_button_tag(:decision, 'finish', true, :id => "decision-finish-#{task.id}", :onclick => "Element.show('group-for-person-#{task.id}')") %> | |
11 | + <%= _('Accept') %> | |
12 | + | |
13 | + <% content_tag('div', :id => "group-for-person-#{task.id}") do %> | |
14 | + <%= labelled_form_field(_('Add %s to the following group:') % task.requestor.name, f.text_field(:group_for_person)) %> | |
15 | + <% end %> | |
12 | 16 | </div> |
13 | 17 | |
14 | 18 | <div> |
15 | - <%= radio_button_tag(:decision, 'cancel', false) %> | |
16 | - <%= _('Ignore') %> | |
19 | + <%= radio_button_tag(:decision, 'cancel', false, :id => "decision-cancel-#{task.id}", :onclick => "Element.hide('group-for-person-#{task.id}')") %> | |
20 | + <%= _('Ignore') %> | |
17 | 21 | </div> |
18 | 22 | |
19 | 23 | <% button_bar do %> | ... | ... |