Commit 4fc10504003b0caa91f53bdd2774360784514ca1
1 parent
84cf9e58
Exists in
master
and in
23 other branches
ActionItem862: don't allow to remove homepage from public view
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
app/views/content_viewer/view_page.rhtml
| @@ -36,9 +36,11 @@ | @@ -36,9 +36,11 @@ | ||
| 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 | <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> | 38 | <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> |
| 39 | - <%= link_to content_tag( 'span', _('Delete') ), | 39 | + <% if @page != profile.home_page %> |
| 40 | + <%= link_to content_tag( 'span', _('Delete') ), | ||
| 40 | { :controller => 'cms', :action => 'destroy', :id => @page }, | 41 | { :controller => 'cms', :action => 'destroy', :id => @page }, |
| 41 | :class => 'button with-text icon-delete' %> | 42 | :class => 'button with-text icon-delete' %> |
| 43 | + <% end %> | ||
| 42 | <% if profile.kind_of?(Person) && !environment.enabled?('disable_cms') %> | 44 | <% if profile.kind_of?(Person) && !environment.enabled?('disable_cms') %> |
| 43 | <%= link_to content_tag( 'span', _('Spread this') ), | 45 | <%= link_to content_tag( 'span', _('Spread this') ), |
| 44 | { :controller => 'cms', :action => 'publish', :id => @page }, | 46 | { :controller => 'cms', :action => 'publish', :id => @page }, |
test/functional/content_viewer_controller_test.rb
| @@ -596,6 +596,13 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -596,6 +596,13 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
| 596 | assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} | 596 | assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} |
| 597 | end | 597 | end |
| 598 | 598 | ||
| 599 | + should 'not display delete button for homepage' do | ||
| 600 | + login_as(profile.identifier) | ||
| 601 | + page = profile.home_page | ||
| 602 | + get :view_page, :profile => profile.identifier, :page => page.explode_path | ||
| 603 | + assert_no_tag :tag => 'a', :content => 'Delete', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/destroy/#{page.id}" } | ||
| 604 | + end | ||
| 605 | + | ||
| 599 | should 'add meta tag to rss feed on view blog' do | 606 | should 'add meta tag to rss feed on view blog' do |
| 600 | login_as(profile.identifier) | 607 | login_as(profile.identifier) |
| 601 | a = Blog.create!(:name => 'article folder', :profile => profile) | 608 | a = Blog.create!(:name => 'article folder', :profile => profile) |