pages with no layout will still render fields
Oleg
committed Oct 13, 2010
commit eb868331cbc0ed9ecb353d1b15d469c2411f3501
Showing 2
changed files with
10 additions
and 0 deletions
app/controllers/cms_admin/pages_controller.rb
+1
-0
| @@ | @@ -54,6 +54,7 @@ protected |
| def load_cms_page | |
| @cms_page = CmsPage.find(params[:id]) | |
| + | @cms_page.cms_layout ||= (@cms_page.parent && @cms_page.parent.cms_layout || CmsLayout.first) |
| rescue ActiveRecord::RecordNotFound | |
| flash[:error] = 'Page not found' | |
| redirect_to :action => :index | |
test/functional/cms_admin/pages_controller_test.rb
+9
-0
| @@ | @@ -107,6 +107,15 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase |
| assert_equal 'Page not found', flash[:error] | |
| end | |
| + | def test_get_edit_with_blank_layout |
| + | page = cms_pages(:default) |
| + | page.update_attribute(:cms_layout_id, nil) |
| + | get :edit, :id => page |
| + | assert_response :success |
| + | assert assigns(:cms_page) |
| + | assert_equal cms_layouts(:default), assigns(:cms_page).cms_layout |
| + | end |
| + | |
| def test_creation | |
| assert_difference 'CmsPage.count' do | |
| assert_difference 'CmsBlock.count', 3 do | |