From 7b6da0d58fcf913c1451bdecc4fb8858101fb75e Mon Sep 17 00:00:00 2001 From: Arno Fortelny Date: Thu, 11 Nov 2021 13:56:35 -0500 Subject: [PATCH] feat: allow disabling cms_page wysiwyg editor --- app/helpers/spree/admin/base_helper.rb | 4 ++++ app/models/spree/backend_configuration.rb | 1 + app/views/spree/admin/cms_pages/_form.html.erb | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/spree/admin/base_helper.rb b/app/helpers/spree/admin/base_helper.rb index e7bc6d4ee6..fd80430309 100644 --- a/app/helpers/spree/admin/base_helper.rb +++ b/app/helpers/spree/admin/base_helper.rb @@ -286,6 +286,10 @@ def flatpickr_local_fallback end end + def cms_page_wysiwyg_editor_enabled? + Spree::Backend::Config[:cms_page_wysiwyg_editor_enabled] + end + def product_wysiwyg_editor_enabled? Spree::Backend::Config[:product_wysiwyg_editor_enabled] end diff --git a/app/models/spree/backend_configuration.rb b/app/models/spree/backend_configuration.rb index 0d684fdbc7..0661e58f2b 100644 --- a/app/models/spree/backend_configuration.rb +++ b/app/models/spree/backend_configuration.rb @@ -11,6 +11,7 @@ class BackendConfiguration < Preferences::Configuration preference :locale, :string, default: Rails.application.config.i18n.default_locale preference :variants_per_page, :integer, default: Kaminari.config.default_per_page preference :menus_per_page, :integer, default: Kaminari.config.default_per_page + preference :cms_page_wysiwyg_editor_enabled, :boolean, default: true preference :product_wysiwyg_editor_enabled, :boolean, default: true preference :taxon_wysiwyg_editor_enabled, :boolean, default: true preference :show_only_complete_orders_by_default, :boolean, default: true diff --git a/app/views/spree/admin/cms_pages/_form.html.erb b/app/views/spree/admin/cms_pages/_form.html.erb index a56020da6d..415110fb05 100644 --- a/app/views/spree/admin/cms_pages/_form.html.erb +++ b/app/views/spree/admin/cms_pages/_form.html.erb @@ -124,7 +124,7 @@
<%= f.field_container :content, class: ['form-group'] do %> - <%= f.text_area :content, { rows: 22, class: 'spree-rte'} %> + <%= f.text_area :content, { rows: 22, class: "form-control #{"spree-rte" if cms_page_wysiwyg_editor_enabled? }" } %> <%= f.error_message_on :content %> <% end %>