app/controllers/alchemy/admin/pages_controller.rb in alchemy_cms-2.1.6 vs app/controllers/alchemy/admin/pages_controller.rb in alchemy_cms-2.1.7
- old
+ new
@@ -55,11 +55,11 @@
:parent_id => params[:page][:parent_id],
:language => parent.language
})
source_page.copy_children_to(page) unless source_page.children.blank?
else
- page = Page.create(params[:page])
+ page = Page.create(params[:page], :as => current_user.role.to_sym)
end
render_errors_or_redirect(page, parent.layoutpage? ? admin_layoutpages_path : admin_pages_path, t("Page created", :name => page.name), 'form#new_page_form button.button')
end
# Edit the content of the page and all its elements and contents.
@@ -85,11 +85,11 @@
end
end
def update
# fetching page via before filter
- if @page.update_attributes(params[:page])
+ if @page.update_attributes(params[:page], :as => current_user.role.to_sym)
@notice = t("Page saved", :name => @page.name)
@while_page_edit = request.referer.include?('edit')
else
render_remote_errors(@page, "form#edit_page_#{@page.id} button.button")
end
@@ -258,10 +258,10 @@
alchemy.show_page_url(
:urlname => page.urlname_was,
:lang => multi_language? ? page.language_code : nil
),
false
- ).path)
+ ).path) unless page.redirects_to_external?
end
# Taken from https://github.com/matenia/jQuery-Awesome-Nested-Set-Drag-and-Drop
def sort_children(element,dbitem)
prevchild = nil