Commit 22485d1f341d9077bc2f51ddd2d1b8e7b37d752a
1 parent
41c8fe2a
Exists in
master
and in
9 other branches
Move task view
Showing
3 changed files
with
165 additions
and
165 deletions
Show diff stats
controllers/myprofile/proposals_discussion_plugin_tasks_controller.rb
@@ -29,7 +29,7 @@ class ProposalsDiscussionPluginTasksController < TasksController | @@ -29,7 +29,7 @@ class ProposalsDiscussionPluginTasksController < TasksController | ||
29 | 29 | ||
30 | @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) if profile.organization? | 30 | @responsible_candidates = profile.members.by_role(profile.roles.reject {|r| !r.has_permission?('perform_task')}) if profile.organization? |
31 | 31 | ||
32 | - | 32 | + render :action => 'proposals_discussion_plugin_tasks/index' |
33 | end | 33 | end |
34 | 34 | ||
35 | end | 35 | end |
@@ -0,0 +1,164 @@ | @@ -0,0 +1,164 @@ | ||
1 | +<%= stylesheet_link_tag 'tasks' %> | ||
2 | + | ||
3 | +<h1><%= _("%s's pending tasks") % profile.name %></h1> | ||
4 | +<p> | ||
5 | + | ||
6 | +<% | ||
7 | + type_collection = [[nil, _('All')]] + @task_types | ||
8 | +%> | ||
9 | + | ||
10 | +<% if !@failed.blank? %> | ||
11 | + <div id="errorExplanation"> | ||
12 | + <% @failed.each do |error, tasks_descriptions|%> | ||
13 | + <h2> <%= error %></h2> | ||
14 | + <p><%=_("This error happened with the following tasks: ")%></p> | ||
15 | + <ul> | ||
16 | + <% tasks_descriptions.each do |description| %> | ||
17 | + <li> <%= description %> </li> | ||
18 | + <% end %> | ||
19 | + </ul> | ||
20 | + <% end %> | ||
21 | + </div> | ||
22 | +<% end %> | ||
23 | + | ||
24 | +<% unless @view_only %> | ||
25 | + <%= form_tag '#', :method => 'get' do %> | ||
26 | + <%= field_set_tag _('Filter'), :class => 'filter_fields' do %> | ||
27 | + <p> | ||
28 | + <%= labelled_select(_('Type of task')+': ', :filter_type, :first, :last, @filter_type, type_collection, {:id => 'filter-type'}) %> | ||
29 | + </p> | ||
30 | + <p> | ||
31 | + <%= labelled_text_field(_("Text filter")+': ', :filter_text, nil, {:id => 'filter-text',:value => @filter_text}) %> | ||
32 | + </p> | ||
33 | + <% if profile.organization? %> | ||
34 | + <p> | ||
35 | + <%= labelled_select(_('Assigned to')+': ', :filter_responsible, :id, :name, @filter_responsible, [OpenStruct.new(:name => _('All'), :id => nil), OpenStruct.new(:name => _('Unassigned'), :id => -1)] + @responsible_candidates, :class => 'filter_responsible') %> | ||
36 | + </p> | ||
37 | + <% end %> | ||
38 | + <p> | ||
39 | + <%= labelled_select(_('Tags')+': ', :filter_tags, :id, :name, @filter_tags, @task_tags, {:id => 'filter-add-tag'}) %> | ||
40 | + <%= text_field_tag( :filter_tags, @filter_tags, :size => 36, :class => 'filter-tags' ) %> | ||
41 | + </p> | ||
42 | + | ||
43 | + <p> | ||
44 | + <%= submit_button(:search, _('Search')) %> | ||
45 | + </p> | ||
46 | + <% end %> | ||
47 | + <% end %> | ||
48 | +<% end %> | ||
49 | +<% if @tasks.empty? %> | ||
50 | + <p> | ||
51 | + <em><%= _('No pending tasks for %s') % profile.name %></em> | ||
52 | + </p> | ||
53 | +<% else %> | ||
54 | + <%= form_tag :action => 'close' do%> | ||
55 | + <% button_bar(:class => 'task-actions') do %> | ||
56 | + <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> | ||
57 | + <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | ||
58 | + <%= submit_button :save, _("Apply!") %> | ||
59 | + <%= button(:edit, _('View processed tasks'), :action => 'processed') %> | ||
60 | + <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> | ||
61 | + <% end unless @view_only %> | ||
62 | + | ||
63 | + <ul class='task-list'> | ||
64 | + <% unless @view_only %> | ||
65 | + <p> | ||
66 | + <%= labelled_select(_("Set all to: "), 'set-decisions', 'first', 'last', nil, [['',""],['accept',_("Accept")],['reject',_("Reject")],['skip',_("Skip")]], :id => "up-set-all-tasks-to") %> | ||
67 | + </p> | ||
68 | + <% end %> | ||
69 | + | ||
70 | + <div class="task_boxes"> | ||
71 | + <%= render :partial => 'task', :collection => @tasks %> | ||
72 | + </div> | ||
73 | + | ||
74 | + <% unless @view_only %> | ||
75 | + <p> | ||
76 | + <%= labelled_select(_("Set all to: "), 'set-decisions', 'first', 'last', nil, [['',""],['accept',_("Accept")],['reject',_("Reject")],['skip',_("Skip")]], :id => "down-set-all-tasks-to") %> | ||
77 | + </p> | ||
78 | + <% end %> | ||
79 | + </ul> | ||
80 | + | ||
81 | + <script> | ||
82 | + jQuery('.tag-list').inputosaurus({ | ||
83 | + autoCompleteSource: <%= "'/myprofile/#{profile.identifier}/cms/search_tags'," %> | ||
84 | + activateFinalResult : true | ||
85 | + }) | ||
86 | + </script> | ||
87 | + | ||
88 | + <%= pagination_links(@tasks)%> | ||
89 | + | ||
90 | + <% button_bar(:class => 'task-actions') do %> | ||
91 | + <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> | ||
92 | + <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | ||
93 | + <%= submit_button :save, _("Apply!") %> | ||
94 | + <%= button(:edit, _('View processed tasks'), :action => 'processed') %> | ||
95 | + <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> | ||
96 | + <% end unless @view_only %> | ||
97 | + <% end %> | ||
98 | +<% end %> | ||
99 | +</p> | ||
100 | + | ||
101 | + | ||
102 | +<%= javascript_include_tag 'tasks' %> | ||
103 | + | ||
104 | +<script type="text/javascript"> | ||
105 | + Task.showTags({ | ||
106 | + profileIdentifier: <%= "'#{profile.identifier}'" %> | ||
107 | + }) | ||
108 | + | ||
109 | + $('div.evaluation_button').on('click', null, function(){ | ||
110 | + toggleEvaluation(this); | ||
111 | + }); | ||
112 | + | ||
113 | + | ||
114 | + $('div.confirm_evaluation_button a').on('click', null, function(){ | ||
115 | + evaluate_task(this); | ||
116 | + }); | ||
117 | + | ||
118 | + function toggleEvaluation(el){ | ||
119 | + var task_id = $(el).data('task-id'); | ||
120 | + var taskElement = $('#task-' + task_id); | ||
121 | + //var status_id = $(el).data('status-id') | ||
122 | + //taskElement.data('status_evaluated', status_id); | ||
123 | + | ||
124 | + taskElement.find('div.evaluation_button').removeClass('checked'); | ||
125 | + | ||
126 | + taskElement.find('div.confirm_evaluation_button a').removeClass('disabled'); | ||
127 | + | ||
128 | + $(el).addClass("checked"); | ||
129 | + } | ||
130 | + | ||
131 | + function evaluate_task(el) { | ||
132 | + | ||
133 | + if($(el).hasClass('disabled')) { | ||
134 | + return false; | ||
135 | + } | ||
136 | + | ||
137 | + var url = $(el).data('href'); | ||
138 | + | ||
139 | + var task_id = $(el).data('task-id'); | ||
140 | + | ||
141 | + var taskElement = $('#task-' + task_id); | ||
142 | + | ||
143 | + var checkedButton = taskElement.find("div.evaluation_button.checked"); | ||
144 | + | ||
145 | + var flag_action = checkedButton.data('flag-action'); | ||
146 | + | ||
147 | + var params = { | ||
148 | + task_id: task_id | ||
149 | + }; | ||
150 | + | ||
151 | + jQuery.post(url + "/" + flag_action, params , | ||
152 | + function(data) { | ||
153 | + if (data.success) { | ||
154 | + $(el).effect("highlight"); | ||
155 | + taskElement.fadeOut(); | ||
156 | + } else { | ||
157 | + $(el).effect("highlight", {color: 'red'}); | ||
158 | + } | ||
159 | + if (data.notice) { | ||
160 | + display_notice(data.notice); | ||
161 | + } | ||
162 | + }); | ||
163 | + } | ||
164 | +</script> |
views/tasks/index.html.erb
@@ -1,164 +0,0 @@ | @@ -1,164 +0,0 @@ | ||
1 | -<%= stylesheet_link_tag 'tasks' %> | ||
2 | - | ||
3 | -<h1><%= _("%s's pending tasks") % profile.name %></h1> | ||
4 | -<p> | ||
5 | - | ||
6 | -<% | ||
7 | - type_collection = [[nil, _('All')]] + @task_types | ||
8 | -%> | ||
9 | - | ||
10 | -<% if !@failed.blank? %> | ||
11 | - <div id="errorExplanation"> | ||
12 | - <% @failed.each do |error, tasks_descriptions|%> | ||
13 | - <h2> <%= error %></h2> | ||
14 | - <p><%=_("This error happened with the following tasks: ")%></p> | ||
15 | - <ul> | ||
16 | - <% tasks_descriptions.each do |description| %> | ||
17 | - <li> <%= description %> </li> | ||
18 | - <% end %> | ||
19 | - </ul> | ||
20 | - <% end %> | ||
21 | - </div> | ||
22 | -<% end %> | ||
23 | - | ||
24 | -<% unless @view_only %> | ||
25 | - <%= form_tag '#', :method => 'get' do %> | ||
26 | - <%= field_set_tag _('Filter'), :class => 'filter_fields' do %> | ||
27 | - <p> | ||
28 | - <%= labelled_select(_('Type of task')+': ', :filter_type, :first, :last, @filter_type, type_collection, {:id => 'filter-type'}) %> | ||
29 | - </p> | ||
30 | - <p> | ||
31 | - <%= labelled_text_field(_("Text filter")+': ', :filter_text, nil, {:id => 'filter-text',:value => @filter_text}) %> | ||
32 | - </p> | ||
33 | - <% if profile.organization? %> | ||
34 | - <p> | ||
35 | - <%= labelled_select(_('Assigned to')+': ', :filter_responsible, :id, :name, @filter_responsible, [OpenStruct.new(:name => _('All'), :id => nil), OpenStruct.new(:name => _('Unassigned'), :id => -1)] + @responsible_candidates, :class => 'filter_responsible') %> | ||
36 | - </p> | ||
37 | - <% end %> | ||
38 | - <p> | ||
39 | - <%= labelled_select(_('Tags')+': ', :filter_tags, :id, :name, @filter_tags, @task_tags, {:id => 'filter-add-tag'}) %> | ||
40 | - <%= text_field_tag( :filter_tags, @filter_tags, :size => 36, :class => 'filter-tags' ) %> | ||
41 | - </p> | ||
42 | - | ||
43 | - <p> | ||
44 | - <%= submit_button(:search, _('Search')) %> | ||
45 | - </p> | ||
46 | - <% end %> | ||
47 | - <% end %> | ||
48 | -<% end %> | ||
49 | -<% if @tasks.empty? %> | ||
50 | - <p> | ||
51 | - <em><%= _('No pending tasks for %s') % profile.name %></em> | ||
52 | - </p> | ||
53 | -<% else %> | ||
54 | - <%= form_tag :action => 'close' do%> | ||
55 | - <% button_bar(:class => 'task-actions') do %> | ||
56 | - <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> | ||
57 | - <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | ||
58 | - <%= submit_button :save, _("Apply!") %> | ||
59 | - <%= button(:edit, _('View processed tasks'), :action => 'processed') %> | ||
60 | - <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> | ||
61 | - <% end unless @view_only %> | ||
62 | - | ||
63 | - <ul class='task-list'> | ||
64 | - <% unless @view_only %> | ||
65 | - <p> | ||
66 | - <%= labelled_select(_("Set all to: "), 'set-decisions', 'first', 'last', nil, [['',""],['accept',_("Accept")],['reject',_("Reject")],['skip',_("Skip")]], :id => "up-set-all-tasks-to") %> | ||
67 | - </p> | ||
68 | - <% end %> | ||
69 | - | ||
70 | - <div class="task_boxes"> | ||
71 | - <%= render :partial => 'task', :collection => @tasks %> | ||
72 | - </div> | ||
73 | - | ||
74 | - <% unless @view_only %> | ||
75 | - <p> | ||
76 | - <%= labelled_select(_("Set all to: "), 'set-decisions', 'first', 'last', nil, [['',""],['accept',_("Accept")],['reject',_("Reject")],['skip',_("Skip")]], :id => "down-set-all-tasks-to") %> | ||
77 | - </p> | ||
78 | - <% end %> | ||
79 | - </ul> | ||
80 | - | ||
81 | - <script> | ||
82 | - jQuery('.tag-list').inputosaurus({ | ||
83 | - autoCompleteSource: <%= "'/myprofile/#{profile.identifier}/cms/search_tags'," %> | ||
84 | - activateFinalResult : true | ||
85 | - }) | ||
86 | - </script> | ||
87 | - | ||
88 | - <%= pagination_links(@tasks)%> | ||
89 | - | ||
90 | - <% button_bar(:class => 'task-actions') do %> | ||
91 | - <%# FiXME button(:edit, _('View my requests'), :action => 'list_requested') %> | ||
92 | - <%# FIXME button('menu-mail', _('Send request'), :action => 'new') %> | ||
93 | - <%= submit_button :save, _("Apply!") %> | ||
94 | - <%= button(:edit, _('View processed tasks'), :action => 'processed') %> | ||
95 | - <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> | ||
96 | - <% end unless @view_only %> | ||
97 | - <% end %> | ||
98 | -<% end %> | ||
99 | -</p> | ||
100 | - | ||
101 | - | ||
102 | -<%= javascript_include_tag 'tasks' %> | ||
103 | - | ||
104 | -<script type="text/javascript"> | ||
105 | - Task.showTags({ | ||
106 | - profileIdentifier: <%= "'#{profile.identifier}'" %> | ||
107 | - }) | ||
108 | - | ||
109 | - $('div.evaluation_button').on('click', null, function(){ | ||
110 | - toggleEvaluation(this); | ||
111 | - }); | ||
112 | - | ||
113 | - | ||
114 | - $('div.confirm_evaluation_button a').on('click', null, function(){ | ||
115 | - evaluate_task(this); | ||
116 | - }); | ||
117 | - | ||
118 | - function toggleEvaluation(el){ | ||
119 | - var task_id = $(el).data('task-id'); | ||
120 | - var taskElement = $('#task-' + task_id); | ||
121 | - //var status_id = $(el).data('status-id') | ||
122 | - //taskElement.data('status_evaluated', status_id); | ||
123 | - | ||
124 | - taskElement.find('div.evaluation_button').removeClass('checked'); | ||
125 | - | ||
126 | - taskElement.find('div.confirm_evaluation_button a').removeClass('disabled'); | ||
127 | - | ||
128 | - $(el).addClass("checked"); | ||
129 | - } | ||
130 | - | ||
131 | - function evaluate_task(el) { | ||
132 | - | ||
133 | - if($(el).hasClass('disabled')) { | ||
134 | - return false; | ||
135 | - } | ||
136 | - | ||
137 | - var url = $(el).data('href'); | ||
138 | - | ||
139 | - var task_id = $(el).data('task-id'); | ||
140 | - | ||
141 | - var taskElement = $('#task-' + task_id); | ||
142 | - | ||
143 | - var checkedButton = taskElement.find("div.evaluation_button.checked"); | ||
144 | - | ||
145 | - var flag_action = checkedButton.data('flag-action'); | ||
146 | - | ||
147 | - var params = { | ||
148 | - task_id: task_id | ||
149 | - }; | ||
150 | - | ||
151 | - jQuery.post(url + "/" + flag_action, params , | ||
152 | - function(data) { | ||
153 | - if (data.success) { | ||
154 | - $(el).effect("highlight"); | ||
155 | - taskElement.fadeOut(); | ||
156 | - } else { | ||
157 | - $(el).effect("highlight", {color: 'red'}); | ||
158 | - } | ||
159 | - if (data.notice) { | ||
160 | - display_notice(data.notice); | ||
161 | - } | ||
162 | - }); | ||
163 | - } | ||
164 | -</script> |