Module: Alchemy::UrlHelper
- Included in:
- ElementsHelper
- Defined in:
- app/helpers/alchemy/url_helper.rb
Instance Method Summary collapse
-
#download_alchemy_attachment_path(attachment) ⇒ Object
Returns the path for downloading an alchemy attachment.
-
#download_alchemy_attachment_url(attachment) ⇒ Object
Returns the url for downloading an alchemy attachment.
-
#full_url_for_element(element) ⇒ Object
Returns the full url containing host, page and anchor for the given element.
-
#show_alchemy_page_path(page, optional_params = {}) ⇒ Object
Returns the path for rendering an alchemy page.
-
#show_alchemy_page_url(page, optional_params = {}) ⇒ Object
Returns the url for rendering an alchemy page.
-
#show_page_path_params(page, optional_params = {}) ⇒ Object
Returns the correct params-hash for passing to show_page_path.
Instance Method Details
#download_alchemy_attachment_path(attachment) ⇒ Object
Returns the path for downloading an alchemy attachment
27 28 29 |
# File 'app/helpers/alchemy/url_helper.rb', line 27 def () alchemy.(, .urlname) end |
#download_alchemy_attachment_url(attachment) ⇒ Object
Returns the url for downloading an alchemy attachment
32 33 34 |
# File 'app/helpers/alchemy/url_helper.rb', line 32 def () alchemy.(, .urlname) end |
#full_url_for_element(element) ⇒ Object
Returns the full url containing host, page and anchor for the given element
37 38 39 |
# File 'app/helpers/alchemy/url_helper.rb', line 37 def full_url_for_element(element) "#{current_server}/#{element.page.urlname}##{element_dom_id(element)}" end |
#show_alchemy_page_path(page, optional_params = {}) ⇒ Object
Returns the path for rendering an alchemy page
10 11 12 |
# File 'app/helpers/alchemy/url_helper.rb', line 10 def show_alchemy_page_path(page, optional_params = {}) alchemy.show_page_path(show_page_path_params(page, optional_params)) end |
#show_alchemy_page_url(page, optional_params = {}) ⇒ Object
Returns the url for rendering an alchemy page
15 16 17 |
# File 'app/helpers/alchemy/url_helper.rb', line 15 def show_alchemy_page_url(page, optional_params = {}) alchemy.show_page_url(show_page_path_params(page, optional_params)) end |
#show_page_path_params(page, optional_params = {}) ⇒ Object
Returns the correct params-hash for passing to show_page_path
20 21 22 23 24 |
# File 'app/helpers/alchemy/url_helper.rb', line 20 def show_page_path_params(page, optional_params = {}) raise ArgumentError, 'Page is nil' if page.nil? url_params = {urlname: page.urlname}.update(optional_params) prefix_locale? ? url_params.update(locale: page.language_code) : url_params end |