From 10521ddeba565ccde4508e0b51385c43ec4df8a5 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Tue, 17 Jun 2008 18:11:57 +0000 Subject: [PATCH] ActionItem451: link use as home placed back --- app/views/cms/view.rhtml | 1 + test/functional/cms_controller_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml index 19238ca..d92be01 100644 --- a/app/views/cms/view.rhtml +++ b/app/views/cms/view.rhtml @@ -64,6 +64,7 @@ <%= link_to _('Edit'), :action => 'edit', :id => item.id %> <%= link_to _('Public view'), item.url %> + <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index ae240da..acac88d 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -82,6 +82,20 @@ class CmsControllerTest < Test::Unit::TestCase end end + should 'display set as home page link to non folder' do + a = profile.articles.create!(:name => 'my new home page') + Article.stubs(:short_description).returns('bli') + get :index, :profile => profile.identifier + assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" } + end + + should 'not display set as home page link to folder' do + a = Folder.new(:name => 'article folder'); profile.articles << a; a.save! + Article.stubs(:short_description).returns('bli') + get :index, :profile => profile.identifier + assert_no_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" } + end + should 'be able to set home page' do a = profile.articles.build(:name => 'my new home page') a.save! -- libgit2 0.21.2