Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add helpful hint pop-up for default menus.
Matthew Kennedy3e640b29e0dc
diff --git a/backend/app/assets/javascripts/spree/backend/global/alerts.es6 b/backend/app/assets/javascripts/spree/backend/global/alerts.es6index 5d9a0eac4c..b3dc547006 100644--- a/backend/app/assets/javascripts/spree/backend/global/alerts.es6+++ b/backend/app/assets/javascripts/spree/backend/global/alerts.es6@@ -1,6 +1,17 @@/* global Swal */document.addEventListener('DOMContentLoaded', function() {+ const infoToggle = document.querySelectorAll('[data-show-info]')++ infoToggle.forEach(function (infoElem) {+ infoElem.addEventListener('click', function() {+ const alertType = infoElem.dataset.alertType || 'info'+ const alertMessage = infoElem.dataset.alertMessage || 'Add the attribute -> data-alert-message="Set your informative message here!" to the clickable element'++ show_flash(alertType, alertMessage, null)+ })+ })+const alertEl = document.querySelectorAll('[data-alert-type]')if (!alertEl) return@@ -14,7 +25,7 @@ document.addEventListener('DOMContentLoaded', function() {})// eslint-disable-next-line camelcase-function show_flash(type, message) {+function show_flash(type, message, time = 4500) {let sanitizedType = DOMPurify.sanitize(type)const sanitizedMessage = DOMPurify.sanitize(message)@@ -26,7 +37,7 @@ function show_flash(type, message) {position: 'bottom',showConfirmButton: false,showCloseButton: true,- timer: 4500,+ timer: time,timerProgressBar: false,showClass: {popup: 'animate__animated animate__fadeInUp animate__faster',diff --git a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss b/backend/app/assets/stylesheets/spree/backend/shared/_base.scssindex 767813109d..aef18e044e 100644--- a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss+++ b/backend/app/assets/stylesheets/spree/backend/shared/_base.scss@@ -39,3 +39,12 @@.badge-light-muted-text {color: rgba(0, 0, 0, 0.50);}++[data-show-info] {+ color: $primary;+ cursor: pointer;++ &:hover {+ color: darken($primary, 10) !important;+ }+}diff --git a/backend/app/views/spree/admin/menus/_form.html.erb b/backend/app/views/spree/admin/menus/_form.html.erbindex 2f63bf1853..ee7fed3b38 100644--- a/backend/app/views/spree/admin/menus/_form.html.erb+++ b/backend/app/views/spree/admin/menus/_form.html.erb@@ -19,7 +19,7 @@<%= f.error_message_on :menu_stores %><% end %><%= f.field_container :locale, class: ['form-group'] do %>- <%= f.label :locale %>+ <%= f.label :language %><%= f.select :locale, options_from_collection_for_select(all_locales_options, :last, :first, @menu.locale || I18n.locale), {}, { class: 'select2' } %><%= f.error_message_on :default_locale %><% end %>diff --git a/backend/app/views/spree/admin/menus/index.html.erb b/backend/app/views/spree/admin/menus/index.html.erbindex b3fe0da7b4..7839e48c88 100644--- a/backend/app/views/spree/admin/menus/index.html.erb+++ b/backend/app/views/spree/admin/menus/index.html.erb@@ -55,7 +55,11 @@<th scope="col"><%= Spree.t('location') %></th><th scope="col"><%= Spree.t('store') %></th><th scope="col"><%= Spree.t('language') %></th>- <th class="text-center" scope="col"><%= Spree.t('default') %></th>+ <th class="text-center" scope="col"><%= Spree.t('default') %>+ <span data-show-info data-alert-message="<%= Spree.t('admin.navigation.create_default_menus_info') %>">+ <%= svg_icon name: "info.svg", width: '15', height: '15' %>+ </span>+ </th><th scope="col"></th></thead><tbody>diff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 02df1ad06c..5ab9da9f1f 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -579,6 +579,9 @@ en:add_new_menu: Add New Menuadd_new_item: 'Add New Item'code: Code+ create_default_menus_info: "Default menus are menus whose language matches the associated store's default language.<br><br>+ Default menus are displayed to your visitor if no menu is available in the current language they are using. <br><br>+ It is recommended that you create a default menu for each menu location."allow_this_menu_item_to_contain_nested_menu_items: Allow this Menu Item to contain nested itemsback_to_all_menus: Back To All Menusclick_create_to_load_new_link: 'Click the <b>Create</b> button below to save your new Menu Item, and update the link.'