Commit 3514a969f1ed4f5b179d86073ab3bc6492eb6e66

Authored by Michel Felipe
1 parent 705d3c4a

Added source of a proposal in tasks partial

lib/proposals_discussion_plugin/proposal_task.rb
... ... @@ -296,6 +296,10 @@ class ProposalsDiscussionPlugin::ProposalTask < Task
296 296 categories.pluck(field).join(',') if categories.count > 0
297 297 end
298 298  
  299 + def proposal_source
  300 + article[:name]
  301 + end
  302 +
299 303 protected
300 304  
301 305 def require_category
... ...
po/proposals_discussion.pot
... ... @@ -408,3 +408,8 @@ msgstr ""
408 408 #: plugins/proposals_discussion/views/proposals_discussion_plugin_tasks/_task.html.erb:17
409 409 msgid "Assigned to:"
410 410 msgstr ""
  411 +
  412 +#: plugins/proposals_discussion/views/tasks/_task.html.erb:3
  413 +#: plugins/proposals_discussion/views/proposals_discussion_plugin_tasks/_task.html.erb:3
  414 +msgid "Source"
  415 +msgstr ""
... ...
po/pt/proposals_discussion.po
... ... @@ -433,3 +433,8 @@ msgstr "Atribuído para:"
433 433  
434 434 #~ msgid "Max size: %s (.jpg, .gif, .png)"
435 435 #~ msgstr "Tamanho máximo: %s (.jpg, .gif, .png)"
  436 +
  437 +#: plugins/proposals_discussion/views/tasks/_task.html.erb:3
  438 +#: plugins/proposals_discussion/views/proposals_discussion_plugin_tasks/_task.html.erb:3
  439 +msgid "Source"
  440 +msgstr "Origem"
... ...
public/style.css
... ... @@ -392,3 +392,8 @@ div.confirm_evaluation_button a.disabled {
392 392 color: rgb(77, 77, 77);
393 393 font-weight: normal;
394 394 }
  395 +
  396 +.task-proposal-source {
  397 + text-align: center;
  398 + color: #000 !important;
  399 +}
... ...
test/unit/proposal_test.rb
... ... @@ -124,4 +124,19 @@ class ProposalTest < ActiveSupport::TestCase
124 124 assert_equal [location], proposal.locations
125 125 end
126 126  
  127 + should 'check the source of a proposal in a task' do
  128 +
  129 + task_data = {
  130 + article: {name: "test proposal", abstract: "teste adadd"},
  131 + requestor: person,
  132 + target: profile,
  133 + spam: false
  134 + }
  135 +
  136 + task = ProposalsDiscussionPlugin::ProposalTask.new task_data
  137 +
  138 + assert_equal task_data[:article][:name], task.proposal_source
  139 +
  140 + end
  141 +
127 142 end
... ...
views/proposals_discussion_plugin_tasks/_task.html.erb
1 1 <div class="task_box" id="task-<%= task.id %>">
  2 +
  3 + <div class="task-proposal-source"><b><%= _('Source') %>:</b> <%= task.proposal_source %></div>
2 4 <%= tag :a, name: "task-#{task.id}" %>
3 5 <%= render :partial => 'task_icon', :locals => {:task => task} %>
4 6  
... ...
views/tasks/_task.html.erb 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +<div class="task_box" id="task-<%= task.id %>">
  2 +
  3 + <div class="task-proposal-source"><b><%= _('Source') %>:</b> <%= task.proposal_source %></div>
  4 + <%= render :partial => 'task_icon', :locals => {:task => task} %>
  5 +
  6 + <% if !@view_only && profile.organization? && @responsible_candidates.present? %>
  7 + <div class="task_responsible">
  8 + <span class="label"><%= _('Assign to:') %></span>
  9 + <span>
  10 + <% change_responsible_url = url_for :action => :change_responsible, :controller => :tasks %>
  11 + <%= select_tag "tasks[#{task.id}][responsible]", options_from_collection_for_select(@responsible_candidates, :id, :name, task.responsible.present? ? task.responsible.id : nil), :include_blank => true, :onchange => "change_task_responsible(this);", 'data-old-responsible' => task.responsible.present? ? task.responsible.id : nil, 'data-task' => task.id, 'data-url' => change_responsible_url %>
  12 + </span>
  13 + </div>
  14 + <% end %>
  15 +
  16 + <% if @view_only && task.responsible.present? %>
  17 + <div class="task_responsible">
  18 + <span class="label"><%= _('Assigned to:') %></span>
  19 + <span class="value"><%= task.responsible.name %></span>
  20 + </div>
  21 + <% end %>
  22 +
  23 + <div class="task_decisions">
  24 + <% unless @view_only %>
  25 + <%=
  26 + labelled_radio_button(_("Accept"), "tasks[#{task.id}][decision]", 'finish', task.default_decision == 'accept',
  27 + :id => "decision-finish-#{task.id}",
  28 + :class => 'task_accept_radio',
  29 + :disabled => task.accept_disabled?,
  30 + :task_id => "#{task.id}") +
  31 + labelled_radio_button(_("Reject"), "tasks[#{task.id}][decision]", 'cancel', task.default_decision == 'reject',
  32 + :id => "decision-cancel-#{task.id}",
  33 + :class => 'task_reject_radio',
  34 + :disabled => task.reject_disabled?,
  35 + :task_id => "#{task.id}") +
  36 + labelled_radio_button(_("Skip"), "tasks[#{task.id}][decision]", 'skip', task.default_decision == 'skip',
  37 + :id => "decision-skip-#{task.id}",
  38 + :class => 'task_skip_radio',
  39 + :disabled => task.skip_disabled?,
  40 + :task_id => "#{task.id}")
  41 + %>
  42 + <% end %>
  43 + </div><!-- class="task_decisions" -->
  44 +
  45 + <div class="task_date"><%= show_time(task.created_at) %></div>
  46 +
  47 + <%= render :partial => 'task_title', :locals => {:task => task} %>
  48 +
  49 + <div class="task_information">
  50 + <%= task_information(task) %>
  51 + </div>
  52 +
  53 + <%= fields_for "tasks[#{task.id}][task]", task do |f| %>
  54 + <% if task.accept_details %>
  55 + <div id="on-accept-information-<%=task.id%>" style="display: none">
  56 + <%= render :partial => partial_for_class(task.class, nil, :accept_details), :locals => {:task => task, :f => f} %>
  57 + </div>
  58 + <% end %>
  59 +
  60 + <% if task.reject_details %>
  61 + <div id="on-reject-information-<%=task.id%>" style="display: none">
  62 + <%= render :partial => partial_for_class(task.class, nil, :reject_details), :locals => {:task => task, :f => f} %>
  63 + </div>
  64 + <% end %>
  65 +
  66 + <% end %>
  67 +
  68 +</div><!-- class="task_box" -->
... ...