Skip to content

Instantly share code, notes, and snippets.

@robyurkowski
Created March 8, 2012 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robyurkowski/1999257 to your computer and use it in GitHub Desktop.
Save robyurkowski/1999257 to your computer and use it in GitHub Desktop.
# Generates the link to determine where the site bar switch button returns to.
def site_bar_switch_link(html_options = {})
if admin? ? admin_switch_link(html_options) : frontend_switch_link(html_options)
end
def admin_switch_link(html_options = {})
link_to t('.switch_to_your_website', site_bar_translate_locale_args),
session[:website_return_to] || refinery.root_path(:locale => (Refinery::I18n.default_frontend_locale if Refinery.i18n_enabled?)),
html_options
end
def frontend_switch_link(html_options = {}
link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args),
(session[:refinery_return_to].present? ? session[:refinery_return_to] ? refinery.admin_root_path) rescue refinery.admin_root_path,
html_options
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment