Skip to content

Commit

Permalink
Deprecate full_url_for_element helper
Browse files Browse the repository at this point in the history
Please implement your own unique DOM ID for your elements and
pass it as anchor to your URLs.
  • Loading branch information
tvdeyen committed Sep 4, 2022
1 parent dc8bbf6 commit acaf339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/helpers/alchemy/url_helper.rb
Expand Up @@ -35,8 +35,11 @@ def download_alchemy_attachment_url(attachment)
end

# Returns the full url containing host, page and anchor for the given element
# @deprecated
def full_url_for_element(element)
"#{current_server}/#{element.page.urlname}##{element.dom_id}"
end

deprecate :full_url_for_element, deprecator: Alchemy::Deprecation
end
end
6 changes: 6 additions & 0 deletions spec/helpers/alchemy/url_helper_spec.rb
Expand Up @@ -141,6 +141,12 @@ module Alchemy
end

describe "#full_url_for_element" do
around do |example|
Alchemy::Deprecation.silence do
example.run
end
end

subject { full_url_for_element(element) }

let(:element) { create(:alchemy_element, name: "headline") }
Expand Down

0 comments on commit acaf339

Please sign in to comment.