Commit 0a6daa95a62ed03301da0e718be4b7bc8f942b52
1 parent
2238acd5
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
changed to keep the filter applyed to tasks after action close
Showing
3 changed files
with
27 additions
and
2 deletions
Show diff stats
app/controllers/my_profile/tasks_controller.rb
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +module TaskHelper | |
| 2 | + | |
| 3 | + def task_email_template(description, email_templates, task, include_blank=true) | |
| 4 | + return '' unless email_templates.present? | |
| 5 | + | |
| 6 | + content_tag( | |
| 7 | + :div, | |
| 8 | + labelled_form_field(description, select_tag("tasks[#{task.id}][task][email_template_id]", options_from_collection_for_select(email_templates, :id, :name), :include_blank => include_blank, 'data-url' => url_for(:controller => 'email_templates', :action => 'show_parsed', :profile => profile.identifier))), | |
| 9 | + :class => 'template-selection' | |
| 10 | + ) | |
| 11 | + end | |
| 12 | + | |
| 13 | + def task_action action | |
| 14 | + require 'debugger'; debugger | |
| 15 | + base_url = { action: action } | |
| 16 | + url_for(base_url.merge(filter_params)) | |
| 17 | + end | |
| 18 | + | |
| 19 | + def filter_params | |
| 20 | + filter_fields = ['filter_type', 'filter_text', 'filter_responsible', 'filter_tags'] | |
| 21 | + params.select {|filter| filter if filter_fields.include? filter } | |
| 22 | + end | |
| 23 | + | |
| 24 | +end | ... | ... |
app/views/tasks/index.html.erb
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | <em><%= _('No pending tasks for %s') % profile.name %></em> |
| 46 | 46 | </p> |
| 47 | 47 | <% else %> |
| 48 | - <%= form_tag :action => 'close' do%> | |
| 48 | + <%= form_tag task_action('close') do%> | |
| 49 | 49 | <% button_bar(:class => 'task-actions') do %> |
| 50 | 50 | <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> |
| 51 | 51 | <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | ... | ... |