Commit 44854faa1178acc339e0896f13f887d7afa9a5ce

Authored by MoisesMachado
1 parent 94481abd

ActionItem234: added a better interface to accept articles

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2454 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/approve_article.rb
1 class ApproveArticle < Task 1 class ApproveArticle < Task
2 serialize :data, Hash 2 serialize :data, Hash
3 3
  4 + def description
  5 + _('%s wants to publish %s') % [requestor.name, article.name]
  6 + end
  7 +
4 def data 8 def data
5 self[:data] ||= {} 9 self[:data] ||= {}
6 end 10 end
@@ -21,6 +25,14 @@ class ApproveArticle &lt; Task @@ -21,6 +25,14 @@ class ApproveArticle &lt; Task
21 data[:name] = value 25 data[:name] = value
22 end 26 end
23 27
  28 + def closing_statment
  29 + data[:closing_statment]
  30 + end
  31 +
  32 + def closing_statment= value
  33 + data[:closing_statment] = value
  34 + end
  35 +
24 def perform 36 def perform
25 PublishedArticle.create(:name => name, :profile => target, :reference_article => article) 37 PublishedArticle.create(:name => name, :profile => target, :reference_article => article)
26 end 38 end
app/views/tasks/_approve_article.rhtml 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +<h2><%= _('New article') %></h2>
  2 +
  3 +<%= _('%s wants to publish content: %s.') %
  4 + [content_tag('strong', link_to( task.requestor.name, task.requestor.public_profile_url ) ),
  5 + content_tag('strong', link_to( task.name, task.article.url ) )] %>
  6 +
  7 +<% form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %>
  8 +
  9 + <div>
  10 + <%= radio_button_tag(:decision, 'finish', true,
  11 + :id => "decision-finish-#{task.id}",
  12 + :onclick => "Element.show('group-for-friend-#{task.id}')") %>
  13 + <label for="<%= "decision-finish-#{task.id}" %>"><b><%= _('Accept') %></b></label>
  14 +
  15 + &nbsp; &nbsp;
  16 +
  17 + <%= radio_button_tag(:decision, 'cancel', false,
  18 + :id => "decision-cancel-#{task.id}",
  19 + :onclick => "Element.hide('group-for-friend-#{task.id}')") %>
  20 + <label for="<%= "decision-cancel-#{task.id}" %>"><b><%= _('Ignore') %></b></label>
  21 +
  22 + <%= labelled_form_field _('Name for publishing'), f.text_field(:name) %>
  23 +
  24 + <%= labelled_form_field(_('Closing statment'), f.text_area(:closing_statment) ) %>
  25 +
  26 + </div>
  27 +
  28 + <% button_bar do %>
  29 + <%= submit_button(:ok, _('Ok!')) %>
  30 + <% end %>
  31 +<% end %>