Commit 10521ddeba565ccde4508e0b51385c43ec4df8a5

Authored by JoenioCosta
1 parent 14a41cb1

ActionItem451: link use as home placed back


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2038 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/cms/view.rhtml
... ... @@ -64,6 +64,7 @@
64 64 <td>
65 65 <%= link_to _('Edit'), :action => 'edit', :id => item.id %>
66 66 <%= link_to _('Public view'), item.url %>
  67 + <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %>
67 68 <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %>
68 69 </td>
69 70 </tr>
... ...
test/functional/cms_controller_test.rb
... ... @@ -82,6 +82,20 @@ class CmsControllerTest &lt; Test::Unit::TestCase
82 82 end
83 83 end
84 84  
  85 + should 'display set as home page link to non folder' do
  86 + a = profile.articles.create!(:name => 'my new home page')
  87 + Article.stubs(:short_description).returns('bli')
  88 + get :index, :profile => profile.identifier
  89 + assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" }
  90 + end
  91 +
  92 + should 'not display set as home page link to folder' do
  93 + a = Folder.new(:name => 'article folder'); profile.articles << a; a.save!
  94 + Article.stubs(:short_description).returns('bli')
  95 + get :index, :profile => profile.identifier
  96 + assert_no_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" }
  97 + end
  98 +
85 99 should 'be able to set home page' do
86 100 a = profile.articles.build(:name => 'my new home page')
87 101 a.save!
... ...