Commit 3776461b30ab976f4009fe388f2ca6c179ad1d1b
1 parent
bde757c9
Exists in
master
and in
29 other branches
[template-welcome-page] Define welcome_page with published false by default
(ActionItem3075)
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
@@ -83,7 +83,7 @@ class ProfileEditorController < MyProfileController | @@ -83,7 +83,7 @@ class ProfileEditorController < MyProfileController | ||
83 | end | 83 | end |
84 | 84 | ||
85 | def welcome_page | 85 | def welcome_page |
86 | - @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile) | 86 | + @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) |
87 | if request.post? | 87 | if request.post? |
88 | begin | 88 | begin |
89 | @welcome_page.update_attributes!(params[:welcome_page]) | 89 | @welcome_page.update_attributes!(params[:welcome_page]) |
test/functional/profile_editor_controller_test.rb
@@ -910,6 +910,11 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -910,6 +910,11 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
910 | assert_response :forbidden | 910 | assert_response :forbidden |
911 | end | 911 | end |
912 | 912 | ||
913 | + should 'create welcome_page with public false by default' do | ||
914 | + get :welcome_page, :profile => fast_create(Person, :is_template => true).identifier | ||
915 | + assert !assigns(:welcome_page).published | ||
916 | + end | ||
917 | + | ||
913 | should 'update welcome page and redirect to index' do | 918 | should 'update welcome page and redirect to index' do |
914 | welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page') | 919 | welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page') |
915 | person_template = create_user('person_template').person | 920 | person_template = create_user('person_template').person |