Skip to content

Instantly share code, notes, and snippets.

@TobyRet
Created February 3, 2020 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TobyRet/d79a69e3bf5f974ed8c9fb2b633f1927 to your computer and use it in GitHub Desktop.
Save TobyRet/d79a69e3bf5f974ed8c9fb2b633f1927 to your computer and use it in GitHub Desktop.
Back link
#courses/show.html.erb
<% if permitted_referrer? %>
<%= content_for(:before_content) do %>
<%= govuk_back_link_to(build_back_link, "Back to search results") %>
<% end %>
<% end %>
#
def govuk_back_link_to(url, link_text = "Back")
govuk_link_to(link_text, url, class: "govuk-back-link", data: {qa: "page-back"})
end
def permitted_referrer?
referrer_host_and_path = [dark magic]
referrer_host_and_path == Settings.search_and_compare_ui.base_url ||
referrer_host_and_path == Settings.find_teach_training.base_url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment