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
public/style.css
| ... | ... | @@ -320,26 +320,31 @@ form .proposals-discussion-plugin .body textarea { |
| 320 | 320 | color: gray; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | -.evaluation_bar { | |
| 324 | - width: 400px; | |
| 325 | -} | |
| 326 | 323 | |
| 327 | 324 | .evaluation_button { |
| 328 | 325 | cursor: pointer; |
| 326 | + width: auto; | |
| 327 | + float: left; | |
| 328 | + padding: 5px; | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | .evaluation_button img { |
| 332 | 332 | float:left; |
| 333 | 333 | width: 32px; |
| 334 | 334 | height:32px; |
| 335 | - margin-left: 30px; | |
| 335 | + margin-left: 10px; | |
| 336 | + margin-right: 10px; | |
| 336 | 337 | } |
| 337 | 338 | |
| 338 | 339 | .evaluation_button span { |
| 339 | - margin-left: 8px; | |
| 340 | + margin-right: 10px; | |
| 340 | 341 | font-size: 24px; |
| 341 | - width: auto; | |
| 342 | 342 | float:left; |
| 343 | + | |
| 344 | +} | |
| 345 | + | |
| 346 | +div.evaluation_button.checked { | |
| 347 | + border: 1px dotted black; | |
| 343 | 348 | } |
| 344 | 349 | |
| 345 | 350 | .evaluation_button.approval span { |
| ... | ... | @@ -349,3 +354,30 @@ form .proposals-discussion-plugin .body textarea { |
| 349 | 354 | .evaluation_button.reproval span { |
| 350 | 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 | 1 | <div class="task_box" id="task-<%= task.id %>"> |
| 2 | - | |
| 2 | + <%= tag :a, name: "task-#{task.id}" %> | |
| 3 | 3 | <%= render :partial => 'task_icon', :locals => {:task => task} %> |
| 4 | 4 | |
| 5 | 5 | <% if !@view_only && profile.organization? && @responsible_candidates.present? %> |
| ... | ... | @@ -64,17 +64,17 @@ |
| 64 | 64 | <% end %> |
| 65 | 65 | |
| 66 | 66 | <% if @view_only %> |
| 67 | - <div class="evaluation_bar" style="float:right"> | |
| 67 | + <div class="evaluation_toolbar"> | |
| 68 | 68 | <div class="evaluation_button approval" |
| 69 | 69 | data-url='<%="/myprofile/#{profile.identifier}/plugin/proposals_discussion/evaluate_tasks/flag_approve_proposal"%>' |
| 70 | 70 | data-task-id="<%= task.id %>" |
| 71 | - data-status-id="<%= ProposalsDiscussionPlugin::ProposalTask::Status::FLAGGED_FOR_APPROVAL %>"> | |
| 71 | + data-flag-action="flag_approve_proposal"> | |
| 72 | 72 | <img class="" src="/plugins/proposals_discussion/images/approval.png"> |
| 73 | 73 | <span>Aprovar</span> |
| 74 | 74 | </div> |
| 75 | - <div class="evaluation_button reproval" | |
| 75 | + <div id="evaluation_button_#{task.id}" class="evaluation_button reproval" | |
| 76 | 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 | 78 | <img class="" src="/plugins/proposals_discussion/images/reproval.png"> |
| 79 | 79 | <span>Reprovar</span> |
| 80 | 80 | </div> |
| ... | ... | @@ -98,7 +98,12 @@ |
| 98 | 98 | </div> |
| 99 | 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 | 108 | <% end %> |
| 104 | 109 | ... | ... |
views/tasks/index.html.erb
| ... | ... | @@ -107,18 +107,48 @@ |
| 107 | 107 | }) |
| 108 | 108 | |
| 109 | 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 | 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 | 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 | 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 | 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 | 152 | function(data) { |
| 123 | 153 | if (data.success) { |
| 124 | 154 | $(el).effect("highlight"); | ... | ... |