Commit d240b51128d971ab2c3bf3cff29404824a0d4c52
1 parent
17094e8a
Exists in
master
and in
23 other branches
ActionItem234: final touches to the moderation of articles
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2457 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
24 additions
and
6 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
| @@ -131,7 +131,9 @@ class CmsController < MyProfileController | @@ -131,7 +131,9 @@ class CmsController < MyProfileController | ||
| 131 | end | 131 | end |
| 132 | 132 | ||
| 133 | def publish | 133 | def publish |
| 134 | + | ||
| 134 | @article = profile.articles.find(params[:id]) | 135 | @article = profile.articles.find(params[:id]) |
| 136 | + record_coming_from_public_view | ||
| 135 | @groups = profile.memberships - [profile] | 137 | @groups = profile.memberships - [profile] |
| 136 | @marked_groups = [] | 138 | @marked_groups = [] |
| 137 | groups_ids = profile.memberships.map{|m|m.id.to_s} | 139 | groups_ids = profile.memberships.map{|m|m.id.to_s} |
| @@ -145,6 +147,7 @@ class CmsController < MyProfileController | @@ -145,6 +147,7 @@ class CmsController < MyProfileController | ||
| 145 | task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile) | 147 | task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile) |
| 146 | task.finish unless item[:group].moderated_articles? | 148 | task.finish unless item[:group].moderated_articles? |
| 147 | end | 149 | end |
| 150 | + redirect_back | ||
| 148 | end | 151 | end |
| 149 | end | 152 | end |
| 150 | 153 |
app/views/cms/publish.rhtml
| 1 | <h1><%= _('Select the groups where you want to publish your article') %></h1> | 1 | <h1><%= _('Select the groups where you want to publish your article') %></h1> |
| 2 | 2 | ||
| 3 | <% form_tag do%> | 3 | <% form_tag do%> |
| 4 | - <% @groups.each do |group| %> | 4 | + <%= hidden_field_tag :back_to, @back_to %> |
| 5 | + <% @groups.each do |group| %> | ||
| 5 | <%= labelled_check_box group.name, 'marked_groups[][group_id]', group.id, @marked_groups.include?(group) %><br /> | 6 | <%= labelled_check_box group.name, 'marked_groups[][group_id]', group.id, @marked_groups.include?(group) %><br /> |
| 6 | <%= labelled_text_field _('Title') + ': ', 'marked_groups[][name]', @article.name %> | 7 | <%= labelled_text_field _('Title') + ': ', 'marked_groups[][name]', @article.name %> |
| 7 | <hr /> | 8 | <hr /> |
app/views/cms/view.rhtml
| @@ -65,6 +65,7 @@ | @@ -65,6 +65,7 @@ | ||
| 65 | <td> | 65 | <td> |
| 66 | <%= link_to _('Edit'), :action => 'edit', :id => item.id %> | 66 | <%= link_to _('Edit'), :action => 'edit', :id => item.id %> |
| 67 | <%= link_to _('Public view'), item.url %> | 67 | <%= link_to _('Public view'), item.url %> |
| 68 | + <%= link_to _('Spread this'), :action => 'publish', :id => item.id %> | ||
| 68 | <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> | 69 | <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> |
| 69 | <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> | 70 | <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> |
| 70 | </td> | 71 | </td> |
app/views/content_viewer/view_page.rhtml
| @@ -35,9 +35,11 @@ | @@ -35,9 +35,11 @@ | ||
| 35 | <%= link_to content_tag( 'span', _('Edit') ), | 35 | <%= link_to content_tag( 'span', _('Edit') ), |
| 36 | { :controller => 'cms', :action => 'edit', :id => @page }, | 36 | { :controller => 'cms', :action => 'edit', :id => @page }, |
| 37 | :class => 'button with-text icon-edit' %> | 37 | :class => 'button with-text icon-edit' %> |
| 38 | - <%= link_to content_tag( 'span', _('Publish') ), | ||
| 39 | - { :controller => 'cms', :action => 'publish', :id => @page }, | ||
| 40 | - :class => 'button with-text icon-edit' %> | 38 | + <% if profile.kind_of?(Person) %> |
| 39 | + <%= link_to content_tag( 'span', _('Spread this') ), | ||
| 40 | + { :controller => 'cms', :action => 'publish', :id => @page }, | ||
| 41 | + :class => 'button with-text icon-edit' %> | ||
| 42 | + <% end %> | ||
| 41 | <%= lightbox_button(:new, _('New publication'), :controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : nil)) %> | 43 | <%= lightbox_button(:new, _('New publication'), :controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : nil)) %> |
| 42 | </div> | 44 | </div> |
| 43 | <% end %> | 45 | <% end %> |
app/views/tasks/_approve_article.rhtml
| @@ -19,9 +19,9 @@ | @@ -19,9 +19,9 @@ | ||
| 19 | :onclick => "Element.hide('group-for-friend-#{task.id}')") %> | 19 | :onclick => "Element.hide('group-for-friend-#{task.id}')") %> |
| 20 | <label for="<%= "decision-cancel-#{task.id}" %>"><b><%= _('Ignore') %></b></label> | 20 | <label for="<%= "decision-cancel-#{task.id}" %>"><b><%= _('Ignore') %></b></label> |
| 21 | 21 | ||
| 22 | - <%= labelled_form_field _('Name for publishing'), f.text_field(:name) %> | 22 | + <%= labelled_form_field _('Name for publishing'), f.text_field(:name, :style => 'width:80%;') %> |
| 23 | 23 | ||
| 24 | - <%= labelled_form_field(_('Closing statment'), f.text_area(:closing_statment) ) %> | 24 | + <%= labelled_form_field _('Comment for author'), f.text_area(:closing_statment, :style => 'height:200px; width:80%;') %> |
| 25 | 25 | ||
| 26 | </div> | 26 | </div> |
| 27 | 27 |
test/functional/content_viewer_controller_test.rb
| @@ -412,5 +412,16 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -412,5 +412,16 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
| 412 | 412 | ||
| 413 | assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)} | 413 | assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)} |
| 414 | end | 414 | end |
| 415 | + | ||
| 416 | + should 'not show link to publication on view if not on person profile' do | ||
| 417 | + prof = Community.create!(:name => 'test comm', :identifier => 'test_comm') | ||
| 418 | + page = prof.articles.create!(:name => 'myarticle', :body => 'the body of the text') | ||
| 419 | + prof.affiliate(profile, Profile::Roles.all_roles) | ||
| 420 | + login_as(profile.identifier) | ||
| 421 | + | ||
| 422 | + get :view_page, :profile => prof.identifier, :page => ['myarticle'] | ||
| 423 | + | ||
| 424 | + assert_no_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + prof.identifier + '/cms/publish/' + page.id.to_s)} | ||
| 425 | + end | ||
| 415 | 426 | ||
| 416 | end | 427 | end |