diff --git a/controllers/myprofile/proposals_discussion_plugin_evaluate_tasks_controller.rb b/controllers/myprofile/proposals_discussion_plugin_evaluate_tasks_controller.rb index 1c8d394..6bd7fbf 100644 --- a/controllers/myprofile/proposals_discussion_plugin_evaluate_tasks_controller.rb +++ b/controllers/myprofile/proposals_discussion_plugin_evaluate_tasks_controller.rb @@ -20,7 +20,7 @@ class ProposalsDiscussionPluginEvaluateTasksController < MyProfileController render json: result end - def flag_reject_proposal + def flag_reprove_proposal if request.post? && params[:task_id] result = { success: false, diff --git a/public/style.css b/public/style.css index 642def4..184429e 100644 --- a/public/style.css +++ b/public/style.css @@ -320,26 +320,31 @@ form .proposals-discussion-plugin .body textarea { color: gray; } -.evaluation_bar { - width: 400px; -} .evaluation_button { cursor: pointer; + width: auto; + float: left; + padding: 5px; } .evaluation_button img { float:left; width: 32px; height:32px; - margin-left: 30px; + margin-left: 10px; + margin-right: 10px; } .evaluation_button span { - margin-left: 8px; + margin-right: 10px; font-size: 24px; - width: auto; float:left; + +} + +div.evaluation_button.checked { + border: 1px dotted black; } .evaluation_button.approval span { @@ -349,3 +354,30 @@ form .proposals-discussion-plugin .body textarea { .evaluation_button.reproval span { color: red; } + +.evaluation_toolbar { + float: right; +} + +.confirm_evaluation_toolbar { + clear: both; + width: 100%; + text-align:center; + font-size: 24px; +} + +div.confirm_evaluation_button a { + text-decoration: none; + color: #003366; +} + +div.confirm_evaluation_button a:hover { + text-decoration: underline; +} + + +div.confirm_evaluation_button a.disabled { + text-decoration: none; + color: gray; + display: hidden; +} diff --git a/views/tasks/_task.html.erb b/views/tasks/_task.html.erb index 317049f..a1f1651 100644 --- a/views/tasks/_task.html.erb +++ b/views/tasks/_task.html.erb @@ -1,5 +1,5 @@
- + <%= tag :a, name: "task-#{task.id}" %> <%= render :partial => 'task_icon', :locals => {:task => task} %> <% if !@view_only && profile.organization? && @responsible_candidates.present? %> @@ -64,17 +64,17 @@ <% end %> <% if @view_only %> -
+
+ data-flag-action="flag_approve_proposal"> Aprovar
-
+ data-task-id="<%= task.id %>" data-flag-action="flag_reprove_proposal"> Reprovar
@@ -98,7 +98,12 @@
- +
+ +
<% end %> diff --git a/views/tasks/index.html.erb b/views/tasks/index.html.erb index c21fe8e..e46b2f0 100644 --- a/views/tasks/index.html.erb +++ b/views/tasks/index.html.erb @@ -107,18 +107,48 @@ }) $('div.evaluation_button').on('click', null, function(){ + toggleEvaluation(this); + }); + + + $('div.confirm_evaluation_button a').on('click', null, function(){ evaluate_task(this); }); + function toggleEvaluation(el){ + var task_id = $(el).data('task-id'); + var taskElement = $('#task-' + task_id); + //var status_id = $(el).data('status-id') + //taskElement.data('status_evaluated', status_id); + + taskElement.find('div.evaluation_button').removeClass('checked'); + + taskElement.find('div.confirm_evaluation_button a').removeClass('disabled'); + + $(el).addClass("checked"); + } + function evaluate_task(el) { - var url = $(el).data('url'); + + if($(el).hasClass('disabled')) { + return false; + } + + var url = $(el).data('href'); + var task_id = $(el).data('task-id'); + + var taskElement = $('#task-' + task_id); + + var checkedButton = taskElement.find("div.evaluation_button.checked"); + + var flag_action = checkedButton.data('flag-action'); + var params = { - task_id: task_id, - flagged_status: $(el).data('status-id') + task_id: task_id }; - var taskElement = $('#task-' + task_id); - jQuery.post(url , params , + + jQuery.post(url + "/" + flag_action, params , function(data) { if (data.success) { $(el).effect("highlight"); -- libgit2 0.21.2