Skip to content

Instantly share code, notes, and snippets.

@robyurkowski
Created March 8, 2012 06:08
Show Gist options
  • Save robyurkowski/1999090 to your computer and use it in GitHub Desktop.
Save robyurkowski/1999090 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
if admin? ? admin_switch_link : frontend_switch_link
end
def admin_switch_link
link_url = session[:website_return_to].present? ? session[:website_return_to] :
refinery.root_path(:locale => (Refinery::I18n.default_frontend_locale if Refinery.i18n_enabled?))
link_to t('.switch_to_your_website', site_bar_translate_locale_args), link_url, {:class => 'btn btn-primary'}
end
def frontend_switch_link
link_url = (session[:refinery_return_to].present? ? session[:refinery_return_to] ? refinery.admin_root_path) rescue refinery.admin_root_path
link_to t('.switch_to_your_website_editor', site_bar_translate_locale_args), link_url, {:class => 'btn btn-primary'}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment