diff --git a/core/app/views/refinery/_message.html.erb b/core/app/views/refinery/_message.html.erb
index 04dc9a7d5d..dca82edb8b 100644
--- a/core/app/views/refinery/_message.html.erb
+++ b/core/app/views/refinery/_message.html.erb
@@ -1,8 +1,3 @@
-<% if local_assigns.has_key? :new_url %>
- <%# Need the new action URL if the title has been changed.
- Will be used by the js to update the form action %>
- <%= hidden_field_tag 'new_action', new_url %>
-<% end -%>
<% flash.each do |key, value| %>
<%= value %>
diff --git a/pages/app/controllers/refinery/admin/pages_controller.rb b/pages/app/controllers/refinery/admin/pages_controller.rb
index b3f9182713..59d0d9165f 100644
--- a/pages/app/controllers/refinery/admin/pages_controller.rb
+++ b/pages/app/controllers/refinery/admin/pages_controller.rb
@@ -41,9 +41,10 @@ def update
unless request.xhr?
redirect_to :back
else
- render :partial => '/refinery/message',
- #pass the new update url in case the title was updated
- :locals => {:new_url => refinery.admin_page_path(@page.uncached_nested_url) }
+ render :partial => 'save_and_continue_callback', :locals => {
+ :new_refinery_page_path => refinery.admin_page_path(@page.uncached_nested_url),
+ :new_page_path => refinery.preview_page_path(@page.uncached_nested_url)
+ }
end
end
else
diff --git a/pages/app/views/refinery/admin/pages/_form.html.erb b/pages/app/views/refinery/admin/pages/_form.html.erb
index 25d8f63671..b314ffa2a3 100644
--- a/pages/app/views/refinery/admin/pages/_form.html.erb
+++ b/pages/app/views/refinery/admin/pages/_form.html.erb
@@ -36,6 +36,7 @@
<% content_for :javascripts do %>
diff --git a/pages/spec/requests/refinery/admin/pages_spec.rb b/pages/spec/requests/refinery/admin/pages_spec.rb
index 0bd3ed3fc9..3e1c508830 100644
--- a/pages/spec/requests/refinery/admin/pages_spec.rb
+++ b/pages/spec/requests/refinery/admin/pages_spec.rb
@@ -8,6 +8,13 @@ def new_window_should_have_content(content)
end
end
+def new_window_should_not_have_content(content)
+ new_window = page.driver.browser.window_handles.last
+ page.within_window new_window do
+ page.should_not have_content(content)
+ end
+end
+
module Refinery
module Admin
describe "Pages" do
@@ -145,7 +152,7 @@ module Admin
describe "edit/update" do
before do
Page.create :title => "Update me"
-
+
visit refinery.admin_pages_path
page.should have_content("Update me")
end
@@ -174,10 +181,10 @@ module Admin
it "updates page", :js do
page.should have_content("'Updated' was successfully updated.")
end
-
+
# Regression test for https://github.com/refinery/refinerycms/issues/1892
context 'when saving to exit (a second time)' do
- it 'updates page', :js do
+ it 'updates page', :js do
click_button "Save"
page.should have_content("'Updated' was successfully updated.")
end
@@ -219,11 +226,13 @@ module Admin
fill_in "Title", :with => "Save this"
click_button "Save & continue editing"
page.should have_content("'Save this' was successfully updated")
-
+
click_button "Preview"
- # this test SHOULD fail but it does not. It does when run manually
new_window_should_have_content("Save this")
+ new_window_should_not_have_content(
+ ::I18n.t('switch_to_website', :scope => 'refinery.site_bar')
+ )
end
end