Commit d36492d689bf504d018a550f6e2eb73bd41602d8

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 59a30bcc

Display message if article is removed before approval

If a person asks to publish an article in a community
and removes it before approval, is displayed a message

(ActionItem1343)
app/views/tasks/_approve_article.rhtml
1 1 <h2><%= _('New article') %></h2>
2 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 3 <% form_for('task', task, :url => { :action => 'close', :id => task.id } ) do |f| %>
8 4  
9   - <div>
10   - <%= radio_button_tag(:decision, 'finish', true,
  5 + <% if task.article.nil? %>
  6 + <%= _('%s wanted to publish content but it was removed. It cannot be approved.') % content_tag('strong', link_to( task.requestor.name, task.requestor.public_profile_url ) ) %>
  7 + <%= hidden_field_tag(:decision, 'cancel') %>
  8 + <% else %>
  9 + <%= _('%s wants to publish content: %s.') %
  10 + [content_tag('strong', link_to( task.requestor.name, task.requestor.public_profile_url ) ),
  11 + content_tag('strong', link_to( task.name, task.article.url ) )] %>
  12 +
  13 + <div>
  14 + <%= radio_button_tag(:decision, 'finish', true,
11 15 :id => "decision-finish-#{task.id}",
12 16 :onclick => "Element.show('group-for-friend-#{task.id}')") %>
13   - <label for="<%= "decision-finish-#{task.id}" %>"><b><%= _('Accept') %></b></label>
  17 + <label for="<%= "decision-finish-#{task.id}" %>"><b><%= _('Accept') %></b></label>
14 18  
15   - &nbsp; &nbsp;
  19 + &nbsp; &nbsp;
16 20  
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 + <%= radio_button_tag(:decision, 'cancel', false,
  22 + :id => "decision-cancel-#{task.id}",
  23 + :onclick => "Element.hide('group-for-friend-#{task.id}')") %>
  24 + <label for="<%= "decision-cancel-#{task.id}" %>"><b><%= _('Ignore') %></b></label>
21 25  
22   - <%= labelled_form_field _('Name for publishing'), f.text_field(:name, :style => 'width:80%;') %>
  26 + <%= labelled_form_field _('Name for publishing'), f.text_field(:name, :style => 'width:80%;') %>
23 27  
24   - <%= select_folder(_('Select the folder where the article must be published'), 'task', 'article_parent_id', task.target.folders) %>
25   - <%= labelled_form_field( _('Highlight this article'), f.check_box(:highlighted)) %>
26   - <%= labelled_form_field _('Comment for author'), f.text_area(:closing_statment, :style => 'height:200px; width:80%;') %>
  28 + <%= select_folder(_('Select the folder where the article must be published'), 'task', 'article_parent_id', task.target.folders) %>
  29 + <%= labelled_form_field( _('Highlight this article'), f.check_box(:highlighted)) %>
  30 + <%= labelled_form_field _('Comment for author'), f.text_area(:closing_statment, :style => 'height:200px; width:80%;') %>
27 31  
28   - </div>
  32 + </div>
  33 + <% end %>
29 34  
30 35 <% button_bar do %>
31 36 <%= submit_button(:ok, _('Ok!')) %>
... ...
features/publish_article.feature
... ... @@ -113,3 +113,23 @@ Feature: publish article
113 113 When I press "Ok!"
114 114 Then I should see "Validation failed: Slug (the code generated from the article name) is already being used by another article."
115 115  
  116 + Scenario: ask to publish an article and remove it before approval
  117 + Given I am logged in as "joaosilva"
  118 + And "Joao Silva" is admin of "Sample Community"
  119 + And I am on Sample Community's control panel
  120 + And I follow "Community Info and settings"
  121 + And I choose "profile_data_moderated_articles_true"
  122 + And I press "Save"
  123 + And I am on Joao Silva's control panel
  124 + And I follow "Manage Content"
  125 + And I follow "Spread"
  126 + And I check "Sample Community"
  127 + And I press "Publish"
  128 + And "joaosilva" has no articles
  129 + And I am on Sample Community's control panel
  130 + When I follow "Tasks"
  131 + Then I should see "Joao Silva wanted to publish an article but it was removed. It cannot be approved."
  132 + And I press "Ok!"
  133 + And I am on Sample Community's control panel
  134 + When I follow "Tasks"
  135 + Then I should not see "Joao Silva wanted to publish an article but it was removed. It cannot be approved."
... ...