Commit 484108989d3db7d47b369c4e68d60cd0cf46f919
Committed by
Joenio Costa
1 parent
daee0989
Exists in
master
and in
28 other branches
ActionItem1105: removing button to upload files in blog
Showing
4 changed files
with
26 additions
and
2 deletions
Show diff stats
app/views/cms/view.rhtml
... | ... | @@ -7,9 +7,9 @@ |
7 | 7 | |
8 | 8 | <% if !@article or !@article.blog? %> |
9 | 9 | <%= button :newfolder, _('New folder'), :action => 'new', :type => 'Folder', :parent_id => parent_id %> |
10 | + <%= button('upload-file', _('Upload files'), :action => 'upload_files', :parent_id => parent_id) %> | |
10 | 11 | <% end %> |
11 | 12 | <%= lightbox_button('new', label_for_new_article(@article), :action => 'new', :parent_id => parent_id) %> |
12 | - <%= button('upload-file', _('Upload files'), :action => 'upload_files', :parent_id => parent_id) %> | |
13 | 13 | <%= button(:back, _('Back to control panel'), :controller => 'profile_editor', :action => "index") %> |
14 | 14 | <% end %> |
15 | 15 | ... | ... |
app/views/content_viewer/view_page.rhtml
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | <% if !@page.display_as_gallery? %> |
45 | 45 | <%= lightbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> |
46 | 46 | <% end %> |
47 | - <% if @page.folder? || (@page.parent && @page.parent.folder?) %> | |
47 | + <% if (@page.folder? && !@page.blog?) || (@page.parent && @page.parent.folder? && !@page.parent.blog?) %> | |
48 | 48 | <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> |
49 | 49 | <% end %> |
50 | 50 | <% end %> | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -1111,4 +1111,14 @@ class CmsControllerTest < Test::Unit::TestCase |
1111 | 1111 | get :index, :profile => p.identifier |
1112 | 1112 | assert_no_tag :tag => 'a', :attributes => {:href => "/myprofile/#{p.identifier}/cms/publish/#{a.id}"} |
1113 | 1113 | end |
1114 | + | |
1115 | + should 'not offer to upload files to blog' do | |
1116 | + profile.articles << Blog.new(:name => 'blog test', :profile => profile) | |
1117 | + | |
1118 | + profile.articles.reload | |
1119 | + assert profile.has_blog? | |
1120 | + | |
1121 | + get :view, :profile => profile.identifier, :id => profile.blog.id | |
1122 | + assert_no_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/upload_files?parent_id=#{profile.blog.id}"} | |
1123 | + end | |
1114 | 1124 | end | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -821,4 +821,18 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
821 | 821 | assert_template 'profile/index' |
822 | 822 | end |
823 | 823 | |
824 | + should "not display 'Upload files' when viewing blog" do | |
825 | + login_as(profile.identifier) | |
826 | + b = Blog.create!(:name => 'article folder', :profile => profile) | |
827 | + get :view_page, :profile => profile.identifier, :page => b.explode_path | |
828 | + assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} | |
829 | + end | |
830 | + | |
831 | + should "not display 'Upload files' when viewing post from a blog" do | |
832 | + login_as(profile.identifier) | |
833 | + b = Blog.create!(:name => 'article folder', :profile => profile) | |
834 | + blog_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b) | |
835 | + get :view_page, :profile => profile.identifier, :page => blog_post.explode_path | |
836 | + assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} | |
837 | + end | |
824 | 838 | end | ... | ... |