From 3a2c3b8486d3a3ef49123a4460f2ff9ef2857626 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 20 Jan 2010 12:59:04 -0300 Subject: [PATCH] Redirecting to cms after creating or editing a folder --- app/controllers/my_profile/cms_controller.rb | 2 ++ features/create_article.feature | 35 +++++++++++++++++++++++++++++++++++ features/support/paths.rb | 2 ++ 3 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 features/create_article.feature diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 6877f47..787e9df 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -281,6 +281,8 @@ class CmsController < MyProfileController redirect_to :action => 'media_listing' elsif @article.parent redirect_to :action => 'view', :id => @article.parent + elsif @article.folder? && !@article.blog? && @article.parent + redirect_to :action => 'index' else redirect_back_or_default :action => 'index' end diff --git a/features/create_article.feature b/features/create_article.feature new file mode 100644 index 0000000..802e856 --- /dev/null +++ b/features/create_article.feature @@ -0,0 +1,35 @@ +Feature: create article + As a noosfero user + I want to create new articles + + Background: + Given I am on the homepage + And the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + + Scenario: create a folder + Given I am on Joao Silva's control panel + And I follow "Manage Content" + When I follow "New Folder" + And I fill in "Title" with "My Folder" + And I press "Save" + And I go to Joao Silva's control panel + Then I should see "My Folder" + + Scenario: redirect to the created folder + Given I am on Joao Silva's control panel + And I follow "Manage Content" + When I follow "New Folder" + And I fill in "Title" with "My Folder" + And I press "Save" + Then I should see "Content management" + And I should be on Joao Silva's cms + + Scenario: cancel button back to cms + Given I follow "Control panel" + And I follow "Manage Content" + And I follow "New Folder" + When I follow "Cancel" + Then I should be on Joao Silva's cms diff --git a/features/support/paths.rb b/features/support/paths.rb index ddc22dd..970f578 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -35,6 +35,8 @@ module NavigationHelpers when /^(.*)'s control panel$/ '/myprofile/%s' % Profile.find_by_name($1).identifier + when /^(.+)'s cms/ + '/myprofile/%s/cms' % Profile.find_by_name($1).identifier # Add more mappings here. # Here is a more fancy example: # -- libgit2 0.21.2