Commit 257732f21867ea9be241ff1817377a8ee8c7508d

Authored by Antonio Terceiro
1 parent ec04a68d

Support "Save and continue" when creating a new article

(ActionItem1394)
app/controllers/my_profile/cms_controller.rb
... ... @@ -139,9 +139,15 @@ class CmsController < MyProfileController
139 139  
140 140 @article.profile = profile
141 141 @article.last_changed_by = user
  142 +
  143 + continue = params[:continue]
142 144 if request.post?
143 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 151 return
146 152 end
147 153 end
... ...
features/edit_article.feature
... ... @@ -122,3 +122,14 @@ Feature: edit article
122 122 Then show me the page
123 123 Then the "Text" field should contain "new text"
124 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"
... ...