From 44854faa1178acc339e0896f13f887d7afa9a5ce Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Thu, 4 Sep 2008 13:58:42 +0000 Subject: [PATCH] ActionItem234: added a better interface to accept articles --- app/models/approve_article.rb | 12 ++++++++++++ app/views/tasks/_approve_article.rhtml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 0 deletions(-) create mode 100644 app/views/tasks/_approve_article.rhtml diff --git a/app/models/approve_article.rb b/app/models/approve_article.rb index 77153be..8a8321a 100644 --- a/app/models/approve_article.rb +++ b/app/models/approve_article.rb @@ -1,6 +1,10 @@ class ApproveArticle < Task serialize :data, Hash + def description + _('%s wants to publish %s') % [requestor.name, article.name] + end + def data self[:data] ||= {} end @@ -21,6 +25,14 @@ class ApproveArticle < Task data[:name] = value end + def closing_statment + data[:closing_statment] + end + + def closing_statment= value + data[:closing_statment] = value + end + def perform PublishedArticle.create(:name => name, :profile => target, :reference_article => article) end diff --git a/app/views/tasks/_approve_article.rhtml b/app/views/tasks/_approve_article.rhtml new file mode 100644 index 0000000..bb0a2bc --- /dev/null +++ b/app/views/tasks/_approve_article.rhtml @@ -0,0 +1,31 @@ +

<%= _('New article') %>

+ +<%= _('%s wants to publish content: %s.') % + [content_tag('strong', link_to( task.requestor.name, task.requestor.public_profile_url ) ), + content_tag('strong', link_to( task.name, task.article.url ) )] %> + +<% form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %> + +
+ <%= radio_button_tag(:decision, 'finish', true, + :id => "decision-finish-#{task.id}", + :onclick => "Element.show('group-for-friend-#{task.id}')") %> + + +     + + <%= radio_button_tag(:decision, 'cancel', false, + :id => "decision-cancel-#{task.id}", + :onclick => "Element.hide('group-for-friend-#{task.id}')") %> + + + <%= labelled_form_field _('Name for publishing'), f.text_field(:name) %> + + <%= labelled_form_field(_('Closing statment'), f.text_area(:closing_statment) ) %> + +
+ + <% button_bar do %> + <%= submit_button(:ok, _('Ok!')) %> + <% end %> +<% end %> -- libgit2 0.21.2