Commit 257732f21867ea9be241ff1817377a8ee8c7508d
1 parent
ec04a68d
Exists in
master
and in
28 other branches
Support "Save and continue" when creating a new article
(ActionItem1394)
Showing
2 changed files
with
18 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -139,9 +139,15 @@ class CmsController < MyProfileController | @@ -139,9 +139,15 @@ class CmsController < MyProfileController | ||
139 | 139 | ||
140 | @article.profile = profile | 140 | @article.profile = profile |
141 | @article.last_changed_by = user | 141 | @article.last_changed_by = user |
142 | + | ||
143 | + continue = params[:continue] | ||
142 | if request.post? | 144 | if request.post? |
143 | if @article.save | 145 | if @article.save |
144 | - redirect_to @article.view_url | 146 | + if continue |
147 | + redirect_to :action => 'edit', :id => @article | ||
148 | + else | ||
149 | + redirect_to @article.view_url | ||
150 | + end | ||
145 | return | 151 | return |
146 | end | 152 | end |
147 | end | 153 | end |
features/edit_article.feature
@@ -122,3 +122,14 @@ Feature: edit article | @@ -122,3 +122,14 @@ Feature: edit article | ||
122 | Then show me the page | 122 | Then show me the page |
123 | Then the "Text" field should contain "new text" | 123 | Then the "Text" field should contain "new text" |
124 | And I should be on "Save the whales" edit page | 124 | And I should be on "Save the whales" edit page |
125 | + | ||
126 | + Scenario: save and continue when creating a new article | ||
127 | + Given I am on /joaosilva | ||
128 | + When I follow "New article" | ||
129 | + And I follow "Text article with visual editor" | ||
130 | + And I fill in "Title" with "My new article" | ||
131 | + And I fill in "Text" with "text for the new article" | ||
132 | + And I press "Save and continue" | ||
133 | + Then I should be on "My new article" edit page | ||
134 | + And the "Title" field should contain "My new article" | ||
135 | + And the "Text" field should contain "text for the new article" |