app/controllers/alchemy/admin/pages_controller.rb in alchemy_cms-2.5.0.rc3 vs app/controllers/alchemy/admin/pages_controller.rb in alchemy_cms-2.5.0

- old
+ new

@@ -13,11 +13,11 @@ cache_sweeper Alchemy::PagesSweeper, :only => [:publish], :if => proc { Alchemy::Config.get(:cache_pages) } cache_sweeper Alchemy::ContentSweeper, :only => [:create, :update, :destroy] def index @page_root = Page.language_root_for(session[:language_id]) - @locked_pages = Page.all_locked_by(current_user) + @locked_pages = Page.from_current_site.all_locked_by(current_user) @languages = Language.all if !@page_root if @languages.length == 1 @language = @languages.first store_language_in_session(@language) @@ -54,11 +54,13 @@ params[:page][:language_code] ||= parent.language ? parent.language.code : Language.get_default.code if !params[:paste_from_clipboard].blank? source_page = Page.find(params[:paste_from_clipboard]) @page = Page.copy(source_page, { :parent_id => params[:page][:parent_id], - :language => parent.language + :language => parent.language, + :name => params[:page][:name], + :title => params[:page][:name] }) if source_page.children.any? source_page.copy_children_to(@page) end else @@ -79,11 +81,11 @@ if @page.locked? && @page.locker && @page.locker.logged_in? && @page.locker != current_user flash[:notice] = _t("This page is locked by %{name}", :name => (@page.locker.name rescue _t('unknown'))) redirect_to admin_pages_path else @page.lock(current_user) - @locked_pages = Page.all_locked_by(current_user) + @locked_pages = Page.from_current_site.from_current_site.all_locked_by(current_user) end @layoutpage = @page.layoutpage? end # Set page configuration like page names, meta tags and states. @@ -133,14 +135,12 @@ else @page_root = Page.language_root_for(session[:language_id]) end @area_name = params[:area_name] @content_id = params[:content_id] - @attachments = Attachment.all.collect { |f| [f.name, download_attachment_path(:id => f.id, :name => f.name)] } + @attachments = Attachment.all.collect { |f| [f.name, download_attachment_path(:id => f.id, :name => f.urlname)] } if params[:link_urls_for] == "newsletter" - # TODO: links in newsletters has to go through statistic controller. therfore we have to put a string inside the content_rtfs and replace this string with recipient.id before sending the newsletter. - #@url_prefix = "#{current_server}/recipients/reacts" @url_prefix = current_server end if multi_language? @url_prefix = "#{session[:language_code]}/" end @@ -159,10 +159,10 @@ # Leaves the page editing mode and unlocks the page for other users def unlock # fetching page via before filter @page.unlock flash[:notice] = _t("unlocked_page", :name => @page.name) - @pages_locked_by_user = Page.all_locked_by(current_user) + @pages_locked_by_user = Page.from_current_site.all_locked_by(current_user) respond_to do |format| format.js format.html { redirect_to params[:redirect_to].blank? ? admin_pages_path : params[:redirect_to] }