Module: Refinery::SiteBarHelper

Defined in:
core/app/helpers/refinery/site_bar_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_site_bar?Boolean



26
27
28
29
# File 'core/app/helpers/refinery/site_bar_helper.rb', line 26

def display_site_bar?
  authorisation_manager.allow?(:read, :site_bar) &&
    "#{controller_name}##{action_name}" !~ %r{preview#show}
end


14
15
16
17
18
19
20
# File 'core/app/helpers/refinery/site_bar_helper.rb', line 14

def site_bar_edit_link
  return nil if admin? || @page.nil?
  link_to t('refinery.admin.pages.edit', site_bar_translate_locale_args),
          refinery.admin_edit_page_path(@page.nested_url,
          :switch_locale => (@page.translations.first.locale unless @page.translated_to_default_locale?)),
          'data-turbolinks' => false
end

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



5
6
7
8
9
10
11
12
# File 'core/app/helpers/refinery/site_bar_helper.rb', line 5

def site_bar_switch_link
  link_to_if(admin?, t('.switch_to_your_website', site_bar_translate_locale_args),
                     refinery.root_path(site_bar_translate_locale_args),
                     'data-turbolinks' => false) do
    link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args),
            Refinery::Core.backend_path, 'data-turbolinks' => false
  end
end

#site_bar_translate_locale_argsObject



22
23
24
# File 'core/app/helpers/refinery/site_bar_helper.rb', line 22

def site_bar_translate_locale_args
  { :locale => Refinery::I18n.current_locale }
end