Commit e343595316eb5c6fc9c0471c322f22460ea46f7a
Committed by
Antonio Terceiro
1 parent
004ccd76
Exists in
master
and in
28 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
app/views/content_viewer/view_page.rhtml
... | ... | @@ -12,11 +12,9 @@ |
12 | 12 | <%= article_title(@page, :no_link => true) %> |
13 | 13 | <div id="article-actions"> |
14 | 14 | <% if @page.allow_post_content?(user) %> |
15 | - <% unless @page.blog? %> | |
16 | 15 | <%= link_to content_tag( 'span', label_for_edit_article(@page) ), |
17 | 16 | profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }), |
18 | 17 | :class => 'button with-text icon-edit' %> |
19 | - <% end %> | |
20 | 18 | <% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %> |
21 | 19 | <% if @page != profile.home_page && !@page.blog? %> |
22 | 20 | <%= link_to content_tag( 'span', _('Delete') ), | ... | ... |
features/blog.feature
... | ... | @@ -78,6 +78,14 @@ Feature: blog |
78 | 78 | When I follow "Configure blog" |
79 | 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 | 89 | Scenario: change address of blog |
82 | 90 | Given the following blogs |
83 | 91 | | owner | name | | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -902,4 +902,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
902 | 902 | assert_no_tag :tag => 'div', :attributes => { :class => 'short-post'}, :content => /Anything/ |
903 | 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 | 912 | end | ... | ... |