diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 7c8c653..adc794c 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -88,14 +88,16 @@ class CmsController < MyProfileController @article = profile.articles.find(params[:id]) @parent_id = params[:parent_id] @type = params[:type] || @article.class.to_s + continue = params[:continue] refuse_blocks record_coming if request.post? @article.last_changed_by = user if @article.update_attributes(params[:article]) - redirect_to @article.view_url - return + if !continue + redirect_to @article.view_url + end end end end diff --git a/app/views/cms/edit.rhtml b/app/views/cms/edit.rhtml index 3bebf61..e9dbdcc 100644 --- a/app/views/cms/edit.rhtml +++ b/app/views/cms/edit.rhtml @@ -20,6 +20,7 @@ <% button_bar do %> <%= submit_button :save, _('Save') %> + <%= submit_button :save, _('Save and continue'), :name => "continue" %> <% end %>
diff --git a/features/edit_article.feature b/features/edit_article.feature index 53a94b9..07e5ec1 100644 --- a/features/edit_article.feature +++ b/features/edit_article.feature @@ -114,3 +114,11 @@ Feature: edit article When I follow "Cancel" within ".no-boxes" And I should be on /joaosilva/my-folder + Scenario: save and continue + Given I am on /joaosilva/save-the-whales + And I follow "Edit" + When I fill in "Text" with "new text" + And I press "Save and continue" + Then show me the page + Then the "Text" field should contain "new text" + And I should be on "Save the whales" edit page diff --git a/features/support/paths.rb b/features/support/paths.rb index 7401334..db6acce 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -51,6 +51,10 @@ module NavigationHelpers when /^(.+)'s cms/ '/myprofile/%s/cms' % Profile.find_by_name($1).identifier + when /^"(.+)" edit page/ + article = Article.find_by_name($1) + '/myprofile/%s/cms/edit/%s' % [article.profile.identifier, article.id] + when /^(.+)'s members management/ '/myprofile/%s/profile_members' % Profile.find_by_name($1).identifier -- libgit2 0.21.2