Commit 3a2c3b8486d3a3ef49123a4460f2ff9ef2857626

Authored by Rodrigo Souto
Committed by Antonio Terceiro
1 parent 013f1576

Redirecting to cms after creating or editing a folder

(ActionItem1375)
app/controllers/my_profile/cms_controller.rb
... ... @@ -281,6 +281,8 @@ class CmsController < MyProfileController
281 281 redirect_to :action => 'media_listing'
282 282 elsif @article.parent
283 283 redirect_to :action => 'view', :id => @article.parent
  284 + elsif @article.folder? && !@article.blog? && @article.parent
  285 + redirect_to :action => 'index'
284 286 else
285 287 redirect_back_or_default :action => 'index'
286 288 end
... ...
features/create_article.feature 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +Feature: create article
  2 + As a noosfero user
  3 + I want to create new articles
  4 +
  5 + Background:
  6 + Given I am on the homepage
  7 + And the following users
  8 + | login | name |
  9 + | joaosilva | Joao Silva |
  10 + And I am logged in as "joaosilva"
  11 +
  12 + Scenario: create a folder
  13 + Given I am on Joao Silva's control panel
  14 + And I follow "Manage Content"
  15 + When I follow "New Folder"
  16 + And I fill in "Title" with "My Folder"
  17 + And I press "Save"
  18 + And I go to Joao Silva's control panel
  19 + Then I should see "My Folder"
  20 +
  21 + Scenario: redirect to the created folder
  22 + Given I am on Joao Silva's control panel
  23 + And I follow "Manage Content"
  24 + When I follow "New Folder"
  25 + And I fill in "Title" with "My Folder"
  26 + And I press "Save"
  27 + Then I should see "Content management"
  28 + And I should be on Joao Silva's cms
  29 +
  30 + Scenario: cancel button back to cms
  31 + Given I follow "Control panel"
  32 + And I follow "Manage Content"
  33 + And I follow "New Folder"
  34 + When I follow "Cancel"
  35 + Then I should be on Joao Silva's cms
... ...
features/support/paths.rb
... ... @@ -35,6 +35,8 @@ module NavigationHelpers
35 35 when /^(.*)'s control panel$/
36 36 '/myprofile/%s' % Profile.find_by_name($1).identifier
37 37  
  38 + when /^(.+)'s cms/
  39 + '/myprofile/%s/cms' % Profile.find_by_name($1).identifier
38 40 # Add more mappings here.
39 41 # Here is a more fancy example:
40 42 #
... ...