Sha256: 49c855f49a44b1a24383d95eedcbb06ce22053ac045ca98f6b69a0e07bb8d1f4

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 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', site_bar_translate_locale_args),
                  (if session.keys.map(&:to_sym).include?(:website_return_to) and session[:website_return_to].present?
                    session[:website_return_to]
                   else
                    root_path(:locale => (::Refinery::I18n.default_frontend_locale if defined?(::Refinery::I18n) && ::Refinery::I18n.enabled?))
                   end)) do
          link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args),
                  (if session.keys.map(&:to_sym).include?(:refinery_return_to) and session[:refinery_return_to].present?
                    session[:refinery_return_to]
                   else
                    admin_root_path
                   end rescue admin_root_path)
        end
      end

      def site_bar_translate_locale_args
        if defined?(::Refinery::I18n)
          {:locale => ::Refinery::I18n.current_locale}
        else
          {}
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
refinerycms-core-0.9.9.22 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.21 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.20 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.19 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.18 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.17 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.16 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.15 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.14 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.13 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.12 lib/refinery/helpers/site_bar_helper.rb
refinerycms-core-0.9.9.11 lib/refinery/helpers/site_bar_helper.rb