Commit ec04a68dbfda9a261d69766c23467aeb1585a67f
Committed by
Antonio Terceiro
1 parent
8acd760e
Exists in
master
and in
29 other branches
Add "Save and continue" button in edit screen.
This code was written at LinguÁgil 2010 <http://www.linguagil.com.br/>, during the "Noosfero Coding Dojo" session on September 17th, 2010. The following people contributed: * Fabrício * Márcio Albuquerque * João Paulo * Luiz Cláudio * Guto Maia * Alexandre Gomes * Ivan * Serge Rehem * Bruno Porkaria * Antonio Terceiro * Rodrigo Souto * Daniela Feitosa (ActionItem1394)
Showing
4 changed files
with
17 additions
and
2 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -88,14 +88,16 @@ class CmsController < MyProfileController |
88 | 88 | @article = profile.articles.find(params[:id]) |
89 | 89 | @parent_id = params[:parent_id] |
90 | 90 | @type = params[:type] || @article.class.to_s |
91 | + continue = params[:continue] | |
91 | 92 | |
92 | 93 | refuse_blocks |
93 | 94 | record_coming |
94 | 95 | if request.post? |
95 | 96 | @article.last_changed_by = user |
96 | 97 | if @article.update_attributes(params[:article]) |
97 | - redirect_to @article.view_url | |
98 | - return | |
98 | + if !continue | |
99 | + redirect_to @article.view_url | |
100 | + end | |
99 | 101 | end |
100 | 102 | end |
101 | 103 | end | ... | ... |
app/views/cms/edit.rhtml
features/edit_article.feature
... | ... | @@ -114,3 +114,11 @@ Feature: edit article |
114 | 114 | When I follow "Cancel" within ".no-boxes" |
115 | 115 | And I should be on /joaosilva/my-folder |
116 | 116 | |
117 | + Scenario: save and continue | |
118 | + Given I am on /joaosilva/save-the-whales | |
119 | + And I follow "Edit" | |
120 | + When I fill in "Text" with "new text" | |
121 | + And I press "Save and continue" | |
122 | + Then show me the page | |
123 | + Then the "Text" field should contain "new text" | |
124 | + And I should be on "Save the whales" edit page | ... | ... |
features/support/paths.rb
... | ... | @@ -51,6 +51,10 @@ module NavigationHelpers |
51 | 51 | when /^(.+)'s cms/ |
52 | 52 | '/myprofile/%s/cms' % Profile.find_by_name($1).identifier |
53 | 53 | |
54 | + when /^"(.+)" edit page/ | |
55 | + article = Article.find_by_name($1) | |
56 | + '/myprofile/%s/cms/edit/%s' % [article.profile.identifier, article.id] | |
57 | + | |
54 | 58 | when /^(.+)'s members management/ |
55 | 59 | '/myprofile/%s/profile_members' % Profile.find_by_name($1).identifier |
56 | 60 | ... | ... |