Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow disabling cms_page wysiwyg editor #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/helpers/spree/admin/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/spree/backend_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/cms_pages/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<div class="row">
<div class="col-12">
<%= 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 %>
</div>
Expand Down