removing 'and continue'. nobody liked it :(

Oleg committed May 09, 2011
commit 1273ef59fe384dbf960c0ec5be2936abde45b87e
Showing 14 changed files with 30 additions and 155 deletions
app/controllers/cms_admin/layouts_controller.rb +2 -2
@@ @@ -19,7 +19,7 @@ class CmsAdmin::LayoutsController < CmsAdmin::BaseController
def create
@cms_layout.save!
flash[:notice] = 'Layout created'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_layout})
+ redirect_to :action => :edit, :id => @cms_layout
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to create layout'
render :action => :new
@@ @@ -28,7 +28,7 @@ class CmsAdmin::LayoutsController < CmsAdmin::BaseController
def update
@cms_layout.update_attributes!(params[:cms_layout])
flash[:notice] = 'Layout updated'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_layout})
+ redirect_to :action => :edit, :id => @cms_layout
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to update layout'
render :action => :edit
app/controllers/cms_admin/pages_controller.rb +2 -2
@@ @@ -22,7 +22,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
def create
@cms_page.save!
flash[:notice] = 'Page saved'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_page})
+ redirect_to :action => :edit, :id => @cms_page
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to create page'
render :action => :new
@@ @@ -31,7 +31,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
def update
@cms_page.save!
flash[:notice] = 'Page updated'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_page})
+ redirect_to :action => :edit, :id => @cms_page
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to update page'
render :action => :edit
app/controllers/cms_admin/sites_controller.rb +2 -2
@@ @@ -21,7 +21,7 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController
def create
@cms_site.save!
flash[:notice] = 'Site created'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_site})
+ redirect_to :action => :edit, :id => @cms_site
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to create site'
render :action => :new
@@ @@ -30,7 +30,7 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController
def update
@cms_site.update_attributes!(params[:cms_site])
flash[:notice] = 'Site updated'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_site})
+ redirect_to :action => :edit, :id => @cms_site
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to update site'
render :action => :edit
app/controllers/cms_admin/snippets_controller.rb +2 -2
@@ @@ -19,7 +19,7 @@ class CmsAdmin::SnippetsController < CmsAdmin::BaseController
def create
@cms_snippet.save!
flash[:notice] = 'Snippet created'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_snippet})
+ redirect_to :action => :edit, :id => @cms_snippet
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to create snippet'
render :action => :new
@@ @@ -28,7 +28,7 @@ class CmsAdmin::SnippetsController < CmsAdmin::BaseController
def update
@cms_snippet.update_attributes!(params[:cms_snippet])
flash[:notice] = 'Snippet updated'
- redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_snippet})
+ redirect_to :action => :edit, :id => @cms_snippet
rescue ActiveRecord::RecordInvalid
flash.now[:error] = 'Failed to update snippet'
render :action => :edit
app/views/cms_admin/layouts/_form.html.erb +0 -1
@@ @@ -16,6 +16,5 @@
<%= form.text_area :js, :class => 'code_js' %>
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
- <%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
<%= form.submit @cms_layout.new_record?? 'Create Layout' : 'Update Layout', :disable_builder => true %>
<% end %>
\ No newline at end of file
app/views/cms_admin/pages/_form.html.erb +0 -1
@@ @@ -33,6 +33,5 @@
<%= form.check_box :is_published, :disable_builder => true %>
<%= form.label_for :is_published, :label => 'Published' %>
<%= form.submit 'Preview', :name => 'preview', :id => nil, :disable_builder => true %>
- <%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
<%= form.submit @cms_page.new_record? ? 'Create Page' : 'Update Page', :disable_builder => true %>
<% end %>
\ No newline at end of file
app/views/cms_admin/sites/_form.html.erb +0 -1
@@ @@ -2,6 +2,5 @@
<%= form.text_field :hostname %>
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
- <%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
<%= form.submit @cms_site.new_record?? 'Create Site' : 'Update Site', :disable_builder => true %>
<% end %>
\ No newline at end of file
app/views/cms_admin/snippets/_form.html.erb +0 -1
@@ @@ -7,6 +7,5 @@
<%= form.text_area :content, :class => 'code' %>
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
- <%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
<%= form.submit @cms_snippet.new_record?? 'Create Snippet' : 'Update Snippet', :disable_builder => true %>
<% end %>
\ No newline at end of file
app/views/layouts/cms_admin/_body.html.erb +4 -4
@@ @@ -12,10 +12,10 @@
</div>
<div class='center_column'>
<%= render :partial => 'layouts/cms_admin/center' %>
- </div>
- <div class='sofa'>
- <a href='http://comfortablemexicansofa.twg.ca' target='_blank'>ComfortableMexicanSofa</a>
- <span class='version'><%= ComfortableMexicanSofa::VERSION %></span>
+ <div class='sofa'>
+ <a href='http://comfortablemexicansofa.twg.ca' target='_blank'>ComfortableMexicanSofa</a>
+ <span class='version'><%= ComfortableMexicanSofa::VERSION %></span>
+ </div>
</div>
</div>
</body>
\ No newline at end of file
public/stylesheets/comfortable_mexican_sofa/structure.css +6 -6
@@ @@ -14,7 +14,6 @@ html, body {
position: relative;
margin: 0px 250px 0px 175px;
min-height: 100%;
- overflow: hidden;
background-color: #D8D8D8;
border-left: 1px solid #484848;
border-right: 1px solid #484848;
@@ @@ -126,22 +125,23 @@ input[type='file'] {
a.button.big {
float: right;
}
- .body_wrapper .sofa {
+
+ .center_column .sofa {
position: absolute;
background: #000;
bottom: 0px;
- left: 0px;
+ left: -175px;
width: 155px;
padding: 5px 10px;
font-size: 10px;
}
- .body_wrapper .sofa a {
+ .center_column .sofa a {
color: #484848;
}
- .body_wrapper .sofa a:hover {
+ .center_column .sofa a:hover {
color: #f1f1f1;
}
- .body_wrapper .sofa span.version {
+ .center_column .sofa span.version {
color: #f1f1f1;
font-size: 9px;
margin-left: 2px;
test/functional/cms_admin/layouts_controller_test.rb +2 -31
@@ @@ -41,7 +41,7 @@ class CmsAdmin::LayoutsControllerTest < ActionController::TestCase
assert_equal 'Layout not found', flash[:error]
end
- def test_creation_with_commit
+ def test_creation
assert_difference 'Cms::Layout.count' do
post :create, :cms_layout => {
:label => 'Test Layout',
@@ @@ -51,21 +51,6 @@ class CmsAdmin::LayoutsControllerTest < ActionController::TestCase
assert_response :redirect
layout = Cms::Layout.last
assert_equal cms_sites(:default), layout.site
- assert_redirected_to :action => :index
- assert_equal 'Layout created', flash[:notice]
- end
- end
-
- def test_creation_without_commit
- assert_difference 'Cms::Layout.count' do
- post :create, :cms_layout => {
- :label => 'Test Layout',
- :slug => 'test',
- :content => 'Test {{cms:page:content}}'
- }
- assert_response :redirect
- layout = Cms::Layout.last
- assert_equal cms_sites(:default), layout.site
assert_redirected_to :action => :edit, :id => layout
assert_equal 'Layout created', flash[:notice]
end
@@ @@ -80,21 +65,7 @@ class CmsAdmin::LayoutsControllerTest < ActionController::TestCase
end
end
- def test_update_with_commit
- layout = cms_layouts(:default)
- put :update, :id => layout, :cms_layout => {
- :label => 'New Label',
- :content => 'New {{cms:page:content}}'
- }, :commit => 'Update Layout'
- assert_response :redirect
- assert_redirected_to :action => :index
- assert_equal 'Layout updated', flash[:notice]
- layout.reload
- assert_equal 'New Label', layout.label
- assert_equal 'New {{cms:page:content}}', layout.content
- end
-
- def test_update_without_commit
+ def test_update
layout = cms_layouts(:default)
put :update, :id => layout, :cms_layout => {
:label => 'New Label',
test/functional/cms_admin/pages_controller_test.rb +4 -42
@@ @@ -121,7 +121,7 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
assert assigns(:cms_page).layout
end
- def test_creation_with_commit
+ def test_creation
assert_difference 'Cms::Page.count' do
assert_difference 'Cms::Block.count', 2 do
post :create, :cms_page => {
@@ @@ -139,36 +139,12 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
assert_response :redirect
page = Cms::Page.last
assert_equal cms_sites(:default), page.site
- assert_redirected_to :action => :index
- assert_equal 'Page saved', flash[:notice]
- end
- end
- end
-
- def test_creation_without_commit
- assert_difference 'Cms::Page.count' do
- assert_difference 'Cms::Block.count', 2 do
- post :create, :cms_page => {
- :label => 'Test Page',
- :slug => 'test-page',
- :parent_id => cms_pages(:default).id,
- :layout_id => cms_layouts(:default).id,
- :blocks_attributes => [
- { :label => 'default_page_text',
- :content => 'content content' },
- { :label => 'default_field_text',
- :content => 'title content' }
- ]
- }
- assert_response :redirect
- page = Cms::Page.last
- assert_equal cms_sites(:default), page.site
assert_redirected_to :action => :edit, :id => page
assert_equal 'Page saved', flash[:notice]
end
end
end
-
+
def test_creation_failure
assert_no_difference ['Cms::Page.count', 'Cms::Block.count'] do
post :create, :cms_page => {
@@ @@ -189,21 +165,7 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
end
end
- def test_update_with_commit
- page = cms_pages(:default)
- assert_no_difference 'Cms::Block.count' do
- put :update, :id => page, :cms_page => {
- :label => 'Updated Label'
- }, :commit => 'Update Page'
- page.reload
- assert_response :redirect
- assert_redirected_to :action => :index
- assert_equal 'Page updated', flash[:notice]
- assert_equal 'Updated Label', page.label
- end
- end
-
- def test_update_without_commit
+ def test_update
page = cms_pages(:default)
assert_no_difference 'Cms::Block.count' do
put :update, :id => page, :cms_page => {
@@ @@ -216,7 +178,7 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
assert_equal 'Updated Label', page.label
end
end
-
+
def test_update_with_layout_change
page = cms_pages(:default)
assert_difference 'Cms::Block.count', 2 do
test/functional/cms_admin/sites_controller_test.rb +4 -29
@@ @@ -41,26 +41,15 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
assert_equal 'Site not found', flash[:error]
end
- def test_create_with_commit
- assert_difference 'Cms::Site.count' do
- post :create, :cms_site => {
- :label => 'Test Site',
- :hostname => 'test.site.local'
- }, :commit => 'Create Site'
- assert_response :redirect
- assert_redirected_to :action => :index
- assert_equal 'Site created', flash[:notice]
- end
- end
-
- def test_create_without_commit
+ def test_create
assert_difference 'Cms::Site.count' do
post :create, :cms_site => {
:label => 'Test Site',
:hostname => 'test.site.local'
}
assert_response :redirect
- assert_redirected_to :action => :edit, :id => Cms::Site.last
+ site = Cms::Site.last
+ assert_redirected_to :action => :edit, :id => site
assert_equal 'Site created', flash[:notice]
end
end
@@ @@ -74,21 +63,7 @@ class CmsAdmin::SitesControllerTest < ActionController::TestCase
end
end
- def test_update_with_commit
- site = cms_sites(:default)
- put :update, :id => site, :cms_site => {
- :label => 'New Site',
- :hostname => 'new.site.local'
- }, :commit => 'Update Site'
- assert_response :redirect
- assert_redirected_to :action => :index
- assert_equal 'Site updated', flash[:notice]
- site.reload
- assert_equal 'New Site', site.label
- assert_equal 'new.site.local', site.hostname
- end
-
- def test_update_without_commit
+ def test_update
site = cms_sites(:default)
put :update, :id => site, :cms_site => {
:label => 'New Site',
test/functional/cms_admin/snippets_controller_test.rb +2 -31
@@ @@ -40,22 +40,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
assert_equal 'Snippet not found', flash[:error]
end
- def test_create_with_commit
- assert_difference 'Cms::Snippet.count' do
- post :create, :cms_snippet => {
- :label => 'Test Snippet',
- :slug => 'test-snippet',
- :content => 'Test Content'
- }, :commit => 'Create Snippet'
- assert_response :redirect
- snippet = Cms::Snippet.last
- assert_equal cms_sites(:default), snippet.site
- assert_redirected_to :action => :index
- assert_equal 'Snippet created', flash[:notice]
- end
- end
-
- def test_create_without_commit
+ def test_create
assert_difference 'Cms::Snippet.count' do
post :create, :cms_snippet => {
:label => 'Test Snippet',
@@ @@ -79,21 +64,7 @@ class CmsAdmin::SnippetsControllerTest < ActionController::TestCase
end
end
- def test_update_with_commit
- snippet = cms_snippets(:default)
- put :update, :id => snippet, :cms_snippet => {
- :label => 'New-Snippet',
- :content => 'New Content'
- }, :commit => 'Update Snippet'
- assert_response :redirect
- assert_redirected_to :action => :index
- assert_equal 'Snippet updated', flash[:notice]
- snippet.reload
- assert_equal 'New-Snippet', snippet.label
- assert_equal 'New Content', snippet.content
- end
-
- def test_update_without_commit
+ def test_update
snippet = cms_snippets(:default)
put :update, :id => snippet, :cms_snippet => {
:label => 'New-Snippet',