From 4d2228c3587605667e2b83a4e54d42feee75dfdf Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 1 May 2024 22:07:39 +0200 Subject: [PATCH] Deprecate `js_filter_field` Use render Alchemy::Admin::ListFilter.new(items) instead. --- app/helpers/alchemy/admin/base_helper.rb | 3 ++- app/views/alchemy/admin/attachments/_tag_list.html.erb | 2 +- app/views/alchemy/admin/pictures/_tag_list.html.erb | 2 +- app/views/alchemy/admin/resources/_tag_list.html.erb | 2 +- app/views/alchemy/admin/tags/edit.html.erb | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/helpers/alchemy/admin/base_helper.rb b/app/helpers/alchemy/admin/base_helper.rb index c3cc93ee17..6c68e377e6 100644 --- a/app/helpers/alchemy/admin/base_helper.rb +++ b/app/helpers/alchemy/admin/base_helper.rb @@ -106,10 +106,11 @@ def sites_for_select # The css class of the tag # @option options [String or Hash] :data ({'alchemy-list-filter' => items}) # A HTML data attribute that holds the jQuery selector that represents the list to be filtered - # + # @deprecated render Alchemy::Admin::ListFilter.new(items) instead def js_filter_field(items, _options = {}) render Alchemy::Admin::ListFilter.new(items) end + deprecate js_filter_field: "render Alchemy::Admin::ListFilter.new(items) instead", deprecator: Alchemy::Deprecation # Returns a link that opens a modal confirmation to delete window. # diff --git a/app/views/alchemy/admin/attachments/_tag_list.html.erb b/app/views/alchemy/admin/attachments/_tag_list.html.erb index d0e0086277..502bfdb5f0 100644 --- a/app/views/alchemy/admin/attachments/_tag_list.html.erb +++ b/app/views/alchemy/admin/attachments/_tag_list.html.erb @@ -1,6 +1,6 @@ <% if Alchemy::Attachment.tag_counts.any? %>

<%= Alchemy.t("Filter by tag") %>

- <%= js_filter_field '.tag-list li' %> + <%= render Alchemy::Admin::ListFilter.new(".tag-list li") %> diff --git a/app/views/alchemy/admin/pictures/_tag_list.html.erb b/app/views/alchemy/admin/pictures/_tag_list.html.erb index 35a3da7655..73f7cce212 100644 --- a/app/views/alchemy/admin/pictures/_tag_list.html.erb +++ b/app/views/alchemy/admin/pictures/_tag_list.html.erb @@ -1,6 +1,6 @@ <% if Alchemy::Picture.tag_counts.any? %>

<%= Alchemy.t("Filter by tag") %>

- <%= js_filter_field '.tag-list li' %> + <%= render Alchemy::Admin::ListFilter.new(".tag-list li") %> diff --git a/app/views/alchemy/admin/resources/_tag_list.html.erb b/app/views/alchemy/admin/resources/_tag_list.html.erb index 047377cbe4..9a3c45fbe4 100644 --- a/app/views/alchemy/admin/resources/_tag_list.html.erb +++ b/app/views/alchemy/admin/resources/_tag_list.html.erb @@ -1,6 +1,6 @@

<%= Alchemy.t("Filter by tag") %>

- <%= js_filter_field '.tag-list li' %> + <%= render Alchemy::Admin::ListFilter.new(".tag-list li") %> diff --git a/app/views/alchemy/admin/tags/edit.html.erb b/app/views/alchemy/admin/tags/edit.html.erb index fdbb921c6d..6cd35aa2dc 100644 --- a/app/views/alchemy/admin/tags/edit.html.erb +++ b/app/views/alchemy/admin/tags/edit.html.erb @@ -13,7 +13,7 @@
- <%= js_filter_field '.tag-list li' %> + <%= render Alchemy::Admin::ListFilter.new(".tag-list li") %>
    <%= render partial: "radio_tag", collection: @tags, locals: {name: "tag"} %>