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
Dedicated info pop up message.
Matthew Kennedy1e5e461f95a2
diff --git a/backend/app/assets/javascripts/spree/backend/global/_index.js b/backend/app/assets/javascripts/spree/backend/global/_index.jsindex 88f3cdeebb..01de493dbc 100644--- a/backend/app/assets/javascripts/spree/backend/global/_index.js+++ b/backend/app/assets/javascripts/spree/backend/global/_index.js@@ -2,6 +2,7 @@//= require spree/backend/global/bootstrap//= require spree/backend/global/flatpickr//= require spree/backend/global/ransack+//= require spree/backend/global/info_alert//= require spree/backend/global/radio_panel_toggle//= require spree/backend/global/responsive_menus//= require spree/backend/global/select2_autocompletediff --git a/backend/app/assets/javascripts/spree/backend/global/alerts.es6 b/backend/app/assets/javascripts/spree/backend/global/alerts.es6index b3dc547006..5d9a0eac4c 100644--- a/backend/app/assets/javascripts/spree/backend/global/alerts.es6+++ b/backend/app/assets/javascripts/spree/backend/global/alerts.es6@@ -1,17 +1,6 @@/* 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@@ -25,7 +14,7 @@ document.addEventListener('DOMContentLoaded', function() {})// eslint-disable-next-line camelcase-function show_flash(type, message, time = 4500) {+function show_flash(type, message) {let sanitizedType = DOMPurify.sanitize(type)const sanitizedMessage = DOMPurify.sanitize(message)@@ -37,7 +26,7 @@ function show_flash(type, message, time = 4500) {position: 'bottom',showConfirmButton: false,showCloseButton: true,- timer: time,+ timer: 4500,timerProgressBar: false,showClass: {popup: 'animate__animated animate__fadeInUp animate__faster',diff --git a/backend/app/assets/javascripts/spree/backend/global/info_alert.es6 b/backend/app/assets/javascripts/spree/backend/global/info_alert.es6new file mode 100644index 0000000000..17cadda3aa--- /dev/null+++ b/backend/app/assets/javascripts/spree/backend/global/info_alert.es6@@ -0,0 +1,38 @@+/* 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.alertKind+ const alertTitle = infoElem.dataset.alertTitle+ const alertHtml = infoElem.dataset.alertHtml+ const alertMessage = infoElem.dataset.alertMessage++ showInfoAlert(alertType, alertTitle, alertMessage, alertHtml)+ })+ })+})++// eslint-disable-next-line no-unused-vars+function showInfoAlert(type = null, title = null, message = null, html = null) {+ const infoAlert = Swal.mixin({+ showConfirmButton: false,+ showCloseButton: true,+ timer: null,+ timerProgressBar: false,+ showClass: {+ popup: 'animate__animated animate__fadeInUp animate__faster'+ },+ hideClass: {+ popup: 'animate__animated animate__fadeOutDown animate__faster'+ }+ })++ infoAlert.fire({+ icon: type,+ title: title,+ text: message,+ html: html+ })+}diff --git a/backend/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scss b/backend/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scssindex f9c79c0f14..2427dabf20 100644--- a/backend/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scss+++ b/backend/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scss@@ -1,3 +1,42 @@+// Custom SCSS Standard SweetAlerts+body.swal2-shown {+ .swal2-popup {+ border-radius:$border-radius;+ }+ .swal2-html-container {+ text-align: left;+ font-size: 0.9em;++ .alert-link {+ font-weight: 400;+ }+ }+ .swal2-content {+ padding: 0 !important;+ }+ .swal2-header {+ .swal2-icon {+ width: 2.5em;+ height: 2.5em;++ .swal2-icon-content {+ font-size: 2.15em;+ }+ }++ .swal2-close {+ top: 3px;+ right: 3px;+ padding-bottom: 3px;++ &:hover {+ color:grey;+ }+ }+ }+}++// Custom SCSS Toast SweetAlertsbody.swal2-toast-shown .swal2-container.swal2-bottom {right: -50% !important;max-width: 500px;diff --git a/backend/app/views/spree/admin/menus/index.html.erb b/backend/app/views/spree/admin/menus/index.html.erbindex 0d67930f12..9a5d9f27be 100644--- a/backend/app/views/spree/admin/menus/index.html.erb+++ b/backend/app/views/spree/admin/menus/index.html.erb@@ -56,7 +56,10 @@<th scope="col"><%= Spree.t('store') %></th><th scope="col"><%= Spree.t('language') %></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') %>">+ <span data-show-info+ data-alert-kind="info"+ data-alert-title="<%= Spree.t('admin.navigation.default_menus_info.title') %>"+ data-alert-html="<%= Spree.t('admin.navigation.default_menus_info.body') %>"><%= svg_icon name: "info.svg", width: '15', height: '15' %></span></th>diff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 2fc0d88770..879b0ce94b 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -579,10 +579,13 @@ 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 items+ default_menus_info:+ title: Default Menus+ body: "Default menus are menus whose language matches the associated store's default language.<br><br>+ <h5>Example</h5>If you have a store that uses Spanish as the default language but also offers the options of German and French; your default header menu for this store would be set to use <b>Español (es)</b> for the language and <b>Header</b> as the location.<br><br>+ <h5>Why Are Default Menus Important?</h5> Default menus are displayed to your visitor if no menu is available in the current language they are browsing. It is recommended that you create a default menu for each menu location within each store.<br><br>+ <h5>More Information</h5>To learn more about menus, view the official Spree user documentation by <a href='https://guides.spreecommerce.org/user/navigation/building_the_main_menu.html' target='_blank' class='alert-link'>clicking here</a>."+ 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 change the link field.'click_update_to_load_new_link: 'Click the <b>Update</b> button below to change the link field.'