Sha256: 9caf76ad84956fc7fa32cc78823c53f0ab584ce36615b56bf9d5c35114481acf

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

module Refinery
  module Helpers
    module SiteBarHelper

      # Generates the link to determine where the site bar switch button returns to.
      def site_bar_switch_link
        link_to_if(admin?, t('.switch_to_your_website'),
                  (if session.keys.include?(:website_return_to) and session[:website_return_to].present?
                    session[:website_return_to]
                   else
                    root_url(:only_path => true)
                   end)) do
          link_to t('.switch_to_your_website_editor'),
                  (if session.keys.include?(:refinery_return_to) and session[:refinery_return_to].present?
                    session[:refinery_return_to]
                   elsif defined?(@page) and @page.present? and !@page.home?
                     edit_admin_page_url(@page, :only_path => true)
                   else
                     (request.fullpath.to_s == '/') ? admin_root_url(:only_path => true) : "/admin#{request.fullpath}/edit"
                   end rescue admin_root_url(:only_path => true))
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-0.9.8.9 vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb
refinerycms-0.9.8.8 vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb
refinerycms-0.9.8.7 vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb
refinerycms-0.9.8.6 vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb
refinerycms-0.9.8.5 vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb