From 4ed4853c90bccd7ddbc6534e8b0093825192ae49 Mon Sep 17 00:00:00 2001 From: Sascha Karnatz <68833+kulturbande@users.noreply.github.com> Date: Mon, 23 Jan 2023 11:58:35 +0100 Subject: [PATCH] Add searchable field to page Allow to toggle searchable field on page level. The field is only available if it was enabled in the Alchemy - module. The information can be used by search plugins (e.g. https://github.com/AlchemyCMS/alchemy-pg_search). --- app/models/alchemy/page.rb | 1 + app/views/alchemy/admin/pages/_form.html.erb | 9 +++++++ config/locales/alchemy.en.yml | 2 ++ ...3112425_add_searchable_to_alchemy_pages.rb | 9 +++++++ lib/alchemy.rb | 13 +++++++++ ...add_searchable_to_alchemy_pages.alchemy.rb | 10 +++++++ spec/dummy/db/schema.rb | 3 ++- .../admin/page_editing_feature_spec.rb | 27 +++++++++++++++++++ 8 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20230123112425_add_searchable_to_alchemy_pages.rb create mode 100644 spec/dummy/db/migrate/20230123105660_add_searchable_to_alchemy_pages.alchemy.rb diff --git a/app/models/alchemy/page.rb b/app/models/alchemy/page.rb index d276b3101c..47a4e8cbfb 100644 --- a/app/models/alchemy/page.rb +++ b/app/models/alchemy/page.rb @@ -79,6 +79,7 @@ class Page < BaseRecord :restricted, :robot_index, :robot_follow, + :searchable, :sitemap, :tag_list, :title, diff --git a/app/views/alchemy/admin/pages/_form.html.erb b/app/views/alchemy/admin/pages/_form.html.erb index f7601db285..1e38809448 100644 --- a/app/views/alchemy/admin/pages/_form.html.erb +++ b/app/views/alchemy/admin/pages/_form.html.erb @@ -19,6 +19,15 @@ <%= f.input :title, input_html: {'data-alchemy-char-counter' => 60} %> + <% if Alchemy.enable_searchable %> +