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
@@ -58,7 +58,8 @@ class TasksController < MyProfileController | @@ -58,7 +58,8 @@ class TasksController < MyProfileController | ||
58 | end | 58 | end |
59 | end | 59 | end |
60 | 60 | ||
61 | - url = { :action => 'index' } | 61 | + url = task_action(:index) |
62 | + | ||
62 | if failed.blank? | 63 | if failed.blank? |
63 | session[:notice] = _("All decisions were applied successfully.") | 64 | session[:notice] = _("All decisions were applied successfully.") |
64 | else | 65 | else |
@@ -0,0 +1,24 @@ | @@ -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,7 +45,7 @@ | ||
45 | <em><%= _('No pending tasks for %s') % profile.name %></em> | 45 | <em><%= _('No pending tasks for %s') % profile.name %></em> |
46 | </p> | 46 | </p> |
47 | <% else %> | 47 | <% else %> |
48 | - <%= form_tag :action => 'close' do%> | 48 | + <%= form_tag task_action('close') do%> |
49 | <% button_bar(:class => 'task-actions') do %> | 49 | <% button_bar(:class => 'task-actions') do %> |
50 | <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> | 50 | <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> |
51 | <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | 51 | <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> |