Module: Hyrax::PermalinkHelper
- Included in:
- HyraxHelperBehavior
- Defined in:
- app/helpers/hyrax/permalink_helper.rb
Overview
Helpers for the "Copy permalink" button on work and collection show pages. See documentation/copy_permalink.md.
Instance Method Summary collapse
-
#canonical_url_for(presenter) ⇒ Object
The URL used in the show page's
<link rel="canonical">tag. - #copy_permalink_enabled? ⇒ Boolean
-
#permalink_for(presenter) ⇒ Object
The UUID-based URL for the record represented by
presenter, so it is stable across alias changes and is safe to share or cite.
Instance Method Details
#canonical_url_for(presenter) ⇒ Object
The URL used in the show page's <link rel="canonical"> tag.
14 15 16 17 18 |
# File 'app/helpers/hyrax/permalink_helper.rb', line 14 def canonical_url_for(presenter) display_path = Hyrax.config.redirects_active? && Hyrax::RedirectsLookup.display_path_for(presenter.id.to_s) return permalink_for(presenter) if display_path.blank? strip_query_string(request.base_url + display_path) end |
#copy_permalink_enabled? ⇒ Boolean
20 21 22 |
# File 'app/helpers/hyrax/permalink_helper.rb', line 20 def copy_permalink_enabled? Flipflop.enabled?(:copy_permalink_button) end |
#permalink_for(presenter) ⇒ Object
The UUID-based URL for the record represented by presenter, so
it is stable across alias changes and is safe to share or cite.
9 10 11 |
# File 'app/helpers/hyrax/permalink_helper.rb', line 9 def permalink_for(presenter) strip_query_string(request.base_url + Hyrax::PermalinkPath.call(presenter)) end |