Commit f4fc8db9e12b4f5cabf68d504c42568bc195732b
1 parent
fd453c35
Exists in
master
and in
9 other branches
added option to confirm proposals evaluation
Showing
4 changed files
with
85 additions
and
18 deletions
Show diff stats
controllers/myprofile/proposals_discussion_plugin_evaluate_tasks_controller.rb
| @@ -20,7 +20,7 @@ class ProposalsDiscussionPluginEvaluateTasksController < MyProfileController | @@ -20,7 +20,7 @@ class ProposalsDiscussionPluginEvaluateTasksController < MyProfileController | ||
| 20 | render json: result | 20 | render json: result |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | - def flag_reject_proposal | 23 | + def flag_reprove_proposal |
| 24 | if request.post? && params[:task_id] | 24 | if request.post? && params[:task_id] |
| 25 | result = { | 25 | result = { |
| 26 | success: false, | 26 | success: false, |
public/style.css
| @@ -320,26 +320,31 @@ form .proposals-discussion-plugin .body textarea { | @@ -320,26 +320,31 @@ form .proposals-discussion-plugin .body textarea { | ||
| 320 | color: gray; | 320 | color: gray; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | -.evaluation_bar { | ||
| 324 | - width: 400px; | ||
| 325 | -} | ||
| 326 | 323 | ||
| 327 | .evaluation_button { | 324 | .evaluation_button { |
| 328 | cursor: pointer; | 325 | cursor: pointer; |
| 326 | + width: auto; | ||
| 327 | + float: left; | ||
| 328 | + padding: 5px; | ||
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | .evaluation_button img { | 331 | .evaluation_button img { |
| 332 | float:left; | 332 | float:left; |
| 333 | width: 32px; | 333 | width: 32px; |
| 334 | height:32px; | 334 | height:32px; |
| 335 | - margin-left: 30px; | 335 | + margin-left: 10px; |
| 336 | + margin-right: 10px; | ||
| 336 | } | 337 | } |
| 337 | 338 | ||
| 338 | .evaluation_button span { | 339 | .evaluation_button span { |
| 339 | - margin-left: 8px; | 340 | + margin-right: 10px; |
| 340 | font-size: 24px; | 341 | font-size: 24px; |
| 341 | - width: auto; | ||
| 342 | float:left; | 342 | float:left; |
| 343 | + | ||
| 344 | +} | ||
| 345 | + | ||
| 346 | +div.evaluation_button.checked { | ||
| 347 | + border: 1px dotted black; | ||
| 343 | } | 348 | } |
| 344 | 349 | ||
| 345 | .evaluation_button.approval span { | 350 | .evaluation_button.approval span { |
| @@ -349,3 +354,30 @@ form .proposals-discussion-plugin .body textarea { | @@ -349,3 +354,30 @@ form .proposals-discussion-plugin .body textarea { | ||
| 349 | .evaluation_button.reproval span { | 354 | .evaluation_button.reproval span { |
| 350 | color: red; | 355 | color: red; |
| 351 | } | 356 | } |
| 357 | + | ||
| 358 | +.evaluation_toolbar { | ||
| 359 | + float: right; | ||
| 360 | +} | ||
| 361 | + | ||
| 362 | +.confirm_evaluation_toolbar { | ||
| 363 | + clear: both; | ||
| 364 | + width: 100%; | ||
| 365 | + text-align:center; | ||
| 366 | + font-size: 24px; | ||
| 367 | +} | ||
| 368 | + | ||
| 369 | +div.confirm_evaluation_button a { | ||
| 370 | + text-decoration: none; | ||
| 371 | + color: #003366; | ||
| 372 | +} | ||
| 373 | + | ||
| 374 | +div.confirm_evaluation_button a:hover { | ||
| 375 | + text-decoration: underline; | ||
| 376 | +} | ||
| 377 | + | ||
| 378 | + | ||
| 379 | +div.confirm_evaluation_button a.disabled { | ||
| 380 | + text-decoration: none; | ||
| 381 | + color: gray; | ||
| 382 | + display: hidden; | ||
| 383 | +} |
views/tasks/_task.html.erb
| 1 | <div class="task_box" id="task-<%= task.id %>"> | 1 | <div class="task_box" id="task-<%= task.id %>"> |
| 2 | - | 2 | + <%= tag :a, name: "task-#{task.id}" %> |
| 3 | <%= render :partial => 'task_icon', :locals => {:task => task} %> | 3 | <%= render :partial => 'task_icon', :locals => {:task => task} %> |
| 4 | 4 | ||
| 5 | <% if !@view_only && profile.organization? && @responsible_candidates.present? %> | 5 | <% if !@view_only && profile.organization? && @responsible_candidates.present? %> |
| @@ -64,17 +64,17 @@ | @@ -64,17 +64,17 @@ | ||
| 64 | <% end %> | 64 | <% end %> |
| 65 | 65 | ||
| 66 | <% if @view_only %> | 66 | <% if @view_only %> |
| 67 | - <div class="evaluation_bar" style="float:right"> | 67 | + <div class="evaluation_toolbar"> |
| 68 | <div class="evaluation_button approval" | 68 | <div class="evaluation_button approval" |
| 69 | data-url='<%="/myprofile/#{profile.identifier}/plugin/proposals_discussion/evaluate_tasks/flag_approve_proposal"%>' | 69 | data-url='<%="/myprofile/#{profile.identifier}/plugin/proposals_discussion/evaluate_tasks/flag_approve_proposal"%>' |
| 70 | data-task-id="<%= task.id %>" | 70 | data-task-id="<%= task.id %>" |
| 71 | - data-status-id="<%= ProposalsDiscussionPlugin::ProposalTask::Status::FLAGGED_FOR_APPROVAL %>"> | 71 | + data-flag-action="flag_approve_proposal"> |
| 72 | <img class="" src="/plugins/proposals_discussion/images/approval.png"> | 72 | <img class="" src="/plugins/proposals_discussion/images/approval.png"> |
| 73 | <span>Aprovar</span> | 73 | <span>Aprovar</span> |
| 74 | </div> | 74 | </div> |
| 75 | - <div class="evaluation_button reproval" | 75 | + <div id="evaluation_button_#{task.id}" class="evaluation_button reproval" |
| 76 | data-url='<%="/myprofile/#{profile.identifier}/plugin/proposals_discussion/evaluate_tasks/flag_reject_proposal"%>' | 76 | data-url='<%="/myprofile/#{profile.identifier}/plugin/proposals_discussion/evaluate_tasks/flag_reject_proposal"%>' |
| 77 | - data-task-id="<%= task.id %>" data-status-id="<%= ProposalsDiscussionPlugin::ProposalTask::Status::FLAGGED_FOR_REPROVAL %>"> | 77 | + data-task-id="<%= task.id %>" data-flag-action="flag_reprove_proposal"> |
| 78 | <img class="" src="/plugins/proposals_discussion/images/reproval.png"> | 78 | <img class="" src="/plugins/proposals_discussion/images/reproval.png"> |
| 79 | <span>Reprovar</span> | 79 | <span>Reprovar</span> |
| 80 | </div> | 80 | </div> |
| @@ -98,7 +98,12 @@ | @@ -98,7 +98,12 @@ | ||
| 98 | </div> | 98 | </div> |
| 99 | </div> | 99 | </div> |
| 100 | 100 | ||
| 101 | - | 101 | + <div class="confirm_evaluation_toolbar"> |
| 102 | + <div class="confirm_evaluation_button"> | ||
| 103 | + <a data-task-id="<%= task.id %>" class="disabled" href="#task-<%= task.id %>" | ||
| 104 | + data-href='<%="/myprofile/#{profile.identifier}/plugin/proposals_discussion/evaluate_tasks/"%>'>Confirmar</span> | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 102 | 107 | ||
| 103 | <% end %> | 108 | <% end %> |
| 104 | 109 |
views/tasks/index.html.erb
| @@ -107,18 +107,48 @@ | @@ -107,18 +107,48 @@ | ||
| 107 | }) | 107 | }) |
| 108 | 108 | ||
| 109 | $('div.evaluation_button').on('click', null, function(){ | 109 | $('div.evaluation_button').on('click', null, function(){ |
| 110 | + toggleEvaluation(this); | ||
| 111 | + }); | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + $('div.confirm_evaluation_button a').on('click', null, function(){ | ||
| 110 | evaluate_task(this); | 115 | evaluate_task(this); |
| 111 | }); | 116 | }); |
| 112 | 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 | + | ||
| 113 | function evaluate_task(el) { | 131 | function evaluate_task(el) { |
| 114 | - var url = $(el).data('url'); | 132 | + |
| 133 | + if($(el).hasClass('disabled')) { | ||
| 134 | + return false; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + var url = $(el).data('href'); | ||
| 138 | + | ||
| 115 | var task_id = $(el).data('task-id'); | 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 | + | ||
| 116 | var params = { | 147 | var params = { |
| 117 | - task_id: task_id, | ||
| 118 | - flagged_status: $(el).data('status-id') | 148 | + task_id: task_id |
| 119 | }; | 149 | }; |
| 120 | - var taskElement = $('#task-' + task_id); | ||
| 121 | - jQuery.post(url , params , | 150 | + |
| 151 | + jQuery.post(url + "/" + flag_action, params , | ||
| 122 | function(data) { | 152 | function(data) { |
| 123 | if (data.success) { | 153 | if (data.success) { |
| 124 | $(el).effect("highlight"); | 154 | $(el).effect("highlight"); |