Commit e343595316eb5c6fc9c0471c322f22460ea46f7a
Committed by
Antonio Terceiro
1 parent
004ccd76
Exists in
master
and in
29 other branches
Adding edit button when viewing a blog
(ActionItem1641)
Showing
4 changed files
with
16 additions
and
3 deletions
Show diff stats
app/helpers/blog_helper.rb
@@ -11,7 +11,7 @@ module BlogHelper | @@ -11,7 +11,7 @@ module BlogHelper | ||
11 | end | 11 | end |
12 | 12 | ||
13 | def cms_label_for_edit | 13 | def cms_label_for_edit |
14 | - _('Edit blog') | 14 | + _('Configure blog') |
15 | end | 15 | end |
16 | 16 | ||
17 | def list_posts(user, articles, format = 'full') | 17 | def list_posts(user, articles, format = 'full') |
app/views/content_viewer/view_page.rhtml
@@ -12,11 +12,9 @@ | @@ -12,11 +12,9 @@ | ||
12 | <%= article_title(@page, :no_link => true) %> | 12 | <%= article_title(@page, :no_link => true) %> |
13 | <div id="article-actions"> | 13 | <div id="article-actions"> |
14 | <% if @page.allow_post_content?(user) %> | 14 | <% if @page.allow_post_content?(user) %> |
15 | - <% unless @page.blog? %> | ||
16 | <%= link_to content_tag( 'span', label_for_edit_article(@page) ), | 15 | <%= link_to content_tag( 'span', label_for_edit_article(@page) ), |
17 | profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }), | 16 | profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }), |
18 | :class => 'button with-text icon-edit' %> | 17 | :class => 'button with-text icon-edit' %> |
19 | - <% end %> | ||
20 | <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> | 18 | <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> |
21 | <% if @page != profile.home_page && !@page.blog? %> | 19 | <% if @page != profile.home_page && !@page.blog? %> |
22 | <%= link_to content_tag( 'span', _('Delete') ), | 20 | <%= link_to content_tag( 'span', _('Delete') ), |
features/blog.feature
@@ -78,6 +78,14 @@ Feature: blog | @@ -78,6 +78,14 @@ Feature: blog | ||
78 | When I follow "Configure blog" | 78 | When I follow "Configure blog" |
79 | Then I should be on edit "Blog One" by joaosilva | 79 | Then I should be on edit "Blog One" by joaosilva |
80 | 80 | ||
81 | + Scenario: configure blog when viewing it | ||
82 | + Given the following blogs | ||
83 | + | owner | name | | ||
84 | + | joaosilva | Blog One | | ||
85 | + And I go to /joaosilva/blog-one | ||
86 | + When I follow "Configure blog" | ||
87 | + Then I should be on edit "Blog One" by joaosilva | ||
88 | + | ||
81 | Scenario: change address of blog | 89 | Scenario: change address of blog |
82 | Given the following blogs | 90 | Given the following blogs |
83 | | owner | name | | 91 | | owner | name | |
test/functional/content_viewer_controller_test.rb
@@ -902,4 +902,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -902,4 +902,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
902 | assert_no_tag :tag => 'div', :attributes => { :class => 'short-post'}, :content => /Anything/ | 902 | assert_no_tag :tag => 'div', :attributes => { :class => 'short-post'}, :content => /Anything/ |
903 | end | 903 | end |
904 | 904 | ||
905 | + should 'display link to edit blog for allowed' do | ||
906 | + blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') | ||
907 | + login_as(profile.identifier) | ||
908 | + get :view_page, :profile => profile.identifier, :page => blog.explode_path | ||
909 | + assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/edit/#{blog.id}" }, :content => 'Configure blog' } | ||
910 | + end | ||
911 | + | ||
905 | end | 912 | end |