From acaf339f8ea10d42ff10bd5f6e454ff16858e004 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Sat, 3 Sep 2022 22:12:33 +0200 Subject: [PATCH] Deprecate full_url_for_element helper Please implement your own unique DOM ID for your elements and pass it as anchor to your URLs. --- app/helpers/alchemy/url_helper.rb | 3 +++ spec/helpers/alchemy/url_helper_spec.rb | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/app/helpers/alchemy/url_helper.rb b/app/helpers/alchemy/url_helper.rb index 96e270c36a..9d2a44ebef 100644 --- a/app/helpers/alchemy/url_helper.rb +++ b/app/helpers/alchemy/url_helper.rb @@ -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 diff --git a/spec/helpers/alchemy/url_helper_spec.rb b/spec/helpers/alchemy/url_helper_spec.rb index 9ce29eb6ee..bc488298bf 100644 --- a/spec/helpers/alchemy/url_helper_spec.rb +++ b/spec/helpers/alchemy/url_helper_spec.rb @@ -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") }