Module: Refinery::Helpers::SiteBarHelper

Defined in:
lib/refinery/helpers/site_bar_helper.rb

Instance Method Summary collapse

Instance Method Details

Generates the link to determine where the site bar switch button returns to.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/refinery/helpers/site_bar_helper.rb', line 6

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 ::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

#site_bar_translate_locale_argsObject



22
23
24
25
26
27
28
# File 'lib/refinery/helpers/site_bar_helper.rb', line 22

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