Sha256: d18664e0fe34a2990d7eab60445bc8acb8b4220c9ccbae57a18dff724c6faa92

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

module Refinery
  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),
                         refinery.root_path(site_bar_translate_locale_args),
                         'data-no-turbolink' => true) do
        link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args),
                Refinery::Core.backend_path, 'data-no-turbolink' => true
      end
    end

    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-no-turbolink' => true
    end

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

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

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-core-3.0.5 app/helpers/refinery/site_bar_helper.rb
refinerycms-core-3.0.4 app/helpers/refinery/site_bar_helper.rb
refinerycms-core-3.0.3 app/helpers/refinery/site_bar_helper.rb
refinerycms-core-3.0.2 app/helpers/refinery/site_bar_helper.rb
refinerycms-core-3.0.1 app/helpers/refinery/site_bar_helper.rb
refinerycms-core-3.0.0 app/helpers/refinery/site_bar_helper.rb