Commit 10521ddeba565ccde4508e0b51385c43ec4df8a5
1 parent
14a41cb1
Exists in
master
and in
29 other branches
ActionItem451: link use as home placed back
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2038 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
15 additions
and
0 deletions
Show diff stats
app/views/cms/view.rhtml
@@ -64,6 +64,7 @@ | @@ -64,6 +64,7 @@ | ||
64 | <td> | 64 | <td> |
65 | <%= link_to _('Edit'), :action => 'edit', :id => item.id %> | 65 | <%= link_to _('Edit'), :action => 'edit', :id => item.id %> |
66 | <%= link_to _('Public view'), item.url %> | 66 | <%= link_to _('Public view'), item.url %> |
67 | + <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> | ||
67 | <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> | 68 | <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> |
68 | </td> | 69 | </td> |
69 | </tr> | 70 | </tr> |
test/functional/cms_controller_test.rb
@@ -82,6 +82,20 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -82,6 +82,20 @@ class CmsControllerTest < Test::Unit::TestCase | ||
82 | end | 82 | end |
83 | end | 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 | should 'be able to set home page' do | 99 | should 'be able to set home page' do |
86 | a = profile.articles.build(:name => 'my new home page') | 100 | a = profile.articles.build(:name => 'my new home page') |
87 | a.save! | 101 | a.save! |