From 4fc10504003b0caa91f53bdd2774360784514ca1 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 15 Dec 2008 23:19:00 -0300 Subject: [PATCH] ActionItem862: don't allow to remove homepage from public view --- app/views/content_viewer/view_page.rhtml | 4 +++- test/functional/content_viewer_controller_test.rb | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index 5f49129..0f70cf1 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -36,9 +36,11 @@ { :controller => 'cms', :action => 'edit', :id => @page }, :class => 'button with-text icon-edit' %> <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> - <%= link_to content_tag( 'span', _('Delete') ), + <% if @page != profile.home_page %> + <%= link_to content_tag( 'span', _('Delete') ), { :controller => 'cms', :action => 'destroy', :id => @page }, :class => 'button with-text icon-delete' %> + <% end %> <% if profile.kind_of?(Person) && !environment.enabled?('disable_cms') %> <%= link_to content_tag( 'span', _('Spread this') ), { :controller => 'cms', :action => 'publish', :id => @page }, diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 5236f51..3292bd7 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -596,6 +596,13 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} end + should 'not display delete button for homepage' do + login_as(profile.identifier) + page = profile.home_page + get :view_page, :profile => profile.identifier, :page => page.explode_path + assert_no_tag :tag => 'a', :content => 'Delete', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/destroy/#{page.id}" } + end + should 'add meta tag to rss feed on view blog' do login_as(profile.identifier) a = Blog.create!(:name => 'article folder', :profile => profile) -- libgit2 0.21.2