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
Implement store switcher
Matthew Kennedyabc07d183b32
diff --git a/backend/app/assets/images/backend-circle-fill.svg b/backend/app/assets/images/backend-circle-fill.svgnew file mode 100644index 0000000000..e0d1b51579--- /dev/null+++ b/backend/app/assets/images/backend-circle-fill.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-circle-fill" viewBox="0 0 16 16">+ <circle cx="8" cy="8" r="8"/>+</svg>\ No newline at end of filediff --git a/backend/app/assets/images/backend-circle.svg b/backend/app/assets/images/backend-circle.svgnew file mode 100644index 0000000000..dc57919b37--- /dev/null+++ b/backend/app/assets/images/backend-circle.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-circle" viewBox="0 0 16 16">+ <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>+</svg>\ No newline at end of filediff --git a/backend/app/assets/images/backend-spree-icon.svg b/backend/app/assets/images/backend-spree-icon.svgnew file mode 100644index 0000000000..118bccc457--- /dev/null+++ b/backend/app/assets/images/backend-spree-icon.svg@@ -0,0 +1 @@+<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M219.139 381.189c0 13.505-10.945 24.451-24.45 24.451-13.502 0-24.448-10.946-24.448-24.451s10.946-24.451 24.448-24.451c13.505 0 24.45 10.946 24.45 24.451M321.928 381.189c0 13.505-10.948 24.451-24.45 24.451-13.503 0-24.448-10.946-24.448-24.451s10.945-24.451 24.448-24.451c13.502 0 24.45 10.946 24.45 24.451M306.461 332.291H185.71a23.944 23.944 0 01-22.136-14.808l-31.807-77.004h-24.896c-13.227 0-23.951-10.724-23.951-23.951s10.724-23.951 23.951-23.951h40.916a23.95 23.95 0 0122.137 14.808l31.806 77.004h88.869l32.729-77.208c5.164-12.182 19.22-17.858 31.402-12.705 12.176 5.164 17.864 19.22 12.703 31.399l-38.92 91.812a23.953 23.953 0 01-22.052 14.604" fill-rule="nonzero"/><path d="M333.217 113.118c-9.165-9.545-24.325-9.85-33.867-.686l-29.815 28.627V26.919c0-13.23-10.721-23.95-23.951-23.95-13.227 0-23.951 10.72-23.951 23.95v113.58l-28.693-27.95c-9.475-9.227-24.639-9.032-33.869.446-9.23 9.475-9.032 24.639.443 33.869l69.358 67.556c.318.309.659.581.988.868.174.153.342.312.521.461a24.027 24.027 0 002.539 1.83c.123.074.255.143.38.221a24.01 24.01 0 002.656 1.371c.084.036.156.087.239.123.057.024.114.042.168.063.545.228 1.096.422 1.653.605.203.069.404.149.607.212.545.162 1.099.294 1.65.419.222.051.44.117.662.159.553.111 1.11.183 1.667.252.222.027.437.074.659.092.748.075 1.497.111 2.245.111.024 0 .048.006.075.006h.003c.063 0 .129-.009.192-.009.7-.006 1.401-.036 2.095-.102.413-.039.824-.116 1.231-.176.344-.051.688-.087 1.03-.153.488-.093.97-.224 1.452-.347.254-.069.515-.117.766-.192.497-.147.979-.326 1.467-.506.234-.084.473-.155.707-.251.464-.186.916-.404 1.371-.623.248-.117.5-.225.742-.35.413-.216.815-.458 1.219-.701.275-.164.557-.32.826-.497.353-.23.695-.488 1.039-.739.305-.225.614-.446.91-.686.299-.242.587-.506.877-.763.222-.198.452-.375.668-.581l70.355-67.553c9.541-9.164 9.847-24.325.686-33.866M249.284 497.033c-23.996 0-49.024-9.035-75.93-27.103-10.981-7.374-13.906-22.253-6.532-33.234 7.373-10.979 22.253-13.904 33.237-6.533 41.938 28.163 65.634 21.379 90.282 1.311 10.26-8.349 25.346-6.808 33.696 3.452 8.35 10.26 6.805 25.346-3.455 33.696-23.268 18.942-46.74 28.411-71.298 28.411" fill-rule="nonzero"/></svg>diff --git a/backend/app/assets/javascripts/spree/backend/global/_index.js b/backend/app/assets/javascripts/spree/backend/global/_index.jsindex 01de493dbc..a3eb44d8e2 100644--- a/backend/app/assets/javascripts/spree/backend/global/_index.js+++ b/backend/app/assets/javascripts/spree/backend/global/_index.js@@ -8,3 +8,4 @@//= require spree/backend/global/select2_autocomplete//= require spree/backend/global/select2_populate//= require spree/backend/global/sortable+//= require spree/backend/global/side_scroll_indicationdiff --git a/backend/app/assets/javascripts/spree/backend/global/side_scroll_indication.es6 b/backend/app/assets/javascripts/spree/backend/global/side_scroll_indication.es6new file mode 100644index 0000000000..39ad80542c--- /dev/null+++ b/backend/app/assets/javascripts/spree/backend/global/side_scroll_indication.es6@@ -0,0 +1,138 @@+const SETTINGS = {+ navBarTravelling: false,+ navBarTravelDirection: '',+ navBarTravelDistance: 150+}++document.addEventListener('DOMContentLoaded', function () {+ const overScrollWrapper = document.querySelectorAll('[data-overscroll-wrapper]')++ overScrollWrapper.forEach(el => setupOverScrollKit(el))++ function setupOverScrollKit (containerEl) {+ const overScrollLeft = containerEl.querySelector('[data-overscroll-button-left]')+ const overScrollRight = containerEl.querySelector('[data-overscroll-button-right]')+ const overScrollContainer = containerEl.querySelector('[data-overscroll-container]')+ const overScrollContents = overScrollContainer.querySelector('[data-overscroll-content]')+ const activeLink = overScrollContents.querySelector('.active')++ // Trigger on DOMContentLoaded+ setOverscrollIndicators()++ focusActiveItem(overScrollContainer, activeLink)++ window.addEventListener('resize', function () {+ // Trigger on window resize+ setOverscrollIndicators()+ focusActiveItem(overScrollContainer, activeLink)+ })++ overScrollContainer.addEventListener('scroll', function () {+ // Trigger on Side Scrolling+ setOverscrollIndicators()+ })++ // Load and show active link+ function focusActiveItem (containerEl, activeEl) {+ containerEl.scrollLeft = activeEl.offsetLeft - 45;+ }++ function setOverscrollIndicators () {+ overScrollContainer.setAttribute('data-overflowing', determineOverflow(overScrollContents, overScrollContainer))+ }++ overScrollLeft.addEventListener('click', function () {+ // If in the middle of a move return+ if (SETTINGS.navBarTravelling === true) return++ // If we have content overflowing both sides or on the left+ if (determineOverflow(overScrollContents, overScrollContainer) === 'left' || determineOverflow(overScrollContents, overScrollContainer) === 'both') {+ // Find how far this panel has been scrolled+ const availableScrollLeft = overScrollContainer.scrollLeft+ // If the space available is less than two lots of our desired distance, just move the whole amount+ // otherwise, move by the amount in the settings+ if (availableScrollLeft < SETTINGS.navBarTravelDistance * 2) {+ overScrollContents.style.transform = 'translateX(' + availableScrollLeft + 'px)'+ } else {+ overScrollContents.style.transform = 'translateX(' + SETTINGS.navBarTravelDistance + 'px)'+ }+ // We do want a transition (this is set in CSS) when moving so remove the class that would prevent that+ overScrollContents.classList.remove('pn-ProductNav_Contents-no-transition')+ // Update our settings+ SETTINGS.navBarTravelDirection = 'left'+ SETTINGS.navBarTravelling = true+ }+ // Now update the attribute in the DOM+ overScrollContainer.setAttribute('data-overflowing', determineOverflow(overScrollContents, overScrollContainer))+ })++ overScrollRight.addEventListener('click', function () {+ // If in the middle of a move return+ if (SETTINGS.navBarTravelling === true) return++ // If we have content overflowing both sides or on the right+ if (determineOverflow(overScrollContents, overScrollContainer) === 'right' || determineOverflow(overScrollContents, overScrollContainer) === 'both') {+ // Get the right edge of the container and content+ const navBarRightEdge = overScrollContents.getBoundingClientRect().right+ const navBarScrollerRightEdge = overScrollContainer.getBoundingClientRect().right+ // Now we know how much space we have available to scroll+ const availableScrollRight = Math.floor(navBarRightEdge - navBarScrollerRightEdge)+ // If the space available is less than two lots of our desired distance, just move the whole amount+ // otherwise, move by the amount in the settings+ if (availableScrollRight < SETTINGS.navBarTravelDistance * 2) {+ overScrollContents.style.transform = 'translateX(-' + availableScrollRight + 'px)'+ } else {+ overScrollContents.style.transform = 'translateX(-' + SETTINGS.navBarTravelDistance + 'px)'+ }+ // We do want a transition (this is set in CSS) when moving so remove the class that would prevent that+ overScrollContents.classList.remove('pn-ProductNav_Contents-no-transition')+ // Update our settings+ SETTINGS.navBarTravelDirection = 'right'+ SETTINGS.navBarTravelling = true+ }+ // Now update the attribute in the DOM+ overScrollContainer.setAttribute('data-overflowing', determineOverflow(overScrollContents, overScrollContainer))+ })++ overScrollContents.addEventListener(+ 'transitionend',+ function () {+ // get the value of the transform, apply that to the current scroll position (so get the scroll pos first) and then remove the transform+ const styleOfTransform = window.getComputedStyle(overScrollContents, null)+ const tr = styleOfTransform.getPropertyValue('transform') || styleOfTransform.getPropertyValue('transform')+ // If there is no transition we want to default to 0 and not null+ const amount = Math.abs(parseInt(tr.split(',')[4]) || 0)++ overScrollContents.style.transform = 'none'+ overScrollContents.classList.add('pn-ProductNav_Contents-no-transition')+ // Now lets set the scroll position+ if (SETTINGS.navBarTravelDirection === 'left') {+ overScrollContainer.scrollLeft = overScrollContainer.scrollLeft - amount+ } else {+ overScrollContainer.scrollLeft = overScrollContainer.scrollLeft + amount+ }+ SETTINGS.navBarTravelling = false+ },+ false+ )+ }+})++function determineOverflow (content, container) {+ const containerMetrics = container.getBoundingClientRect()+ const containerMetricsRight = Math.floor(containerMetrics.right)+ const containerMetricsLeft = Math.floor(containerMetrics.left)+ const contentMetrics = content.getBoundingClientRect()+ const contentMetricsRight = Math.floor(contentMetrics.right)+ const contentMetricsLeft = Math.floor(contentMetrics.left)++ if (containerMetricsLeft > contentMetricsLeft && containerMetricsRight < contentMetricsRight) {+ return 'both'+ } else if (contentMetricsLeft < containerMetricsLeft) {+ return 'left'+ } else if (contentMetricsRight > containerMetricsRight) {+ return 'right'+ } else {+ return 'none'+ }+}diff --git a/backend/app/assets/stylesheets/spree/backend/components/_navbar.scss b/backend/app/assets/stylesheets/spree/backend/components/_navbar.scssindex ff845c902f..596ba98620 100644--- a/backend/app/assets/stylesheets/spree/backend/components/_navbar.scss+++ b/backend/app/assets/stylesheets/spree/backend/components/_navbar.scss@@ -25,5 +25,32 @@}}+ #storeSwitcherDropdown {+ .dropdown-menu.show {+ min-width:250px;+ top:110%;+ left: 50%;+ right: 50%;+ translate: -50% 0%;+ width: fit-content;+ box-shadow: 0 1rem 2.5rem rgba(18,38,63,.1),0 .5rem 1rem -.75rem rgba(18,38,63,.1);++ @include media-breakpoint-up(lg) {+ left: 0%;+ right: 0%;+ translate: 0% 0%;+ }++ a svg {+ margin-right: 1em;+ }+ a.disabled svg {+ color: $success;+ }+ }+++ }+}}diff --git a/backend/app/assets/stylesheets/spree/backend/components/_sidebar.scss b/backend/app/assets/stylesheets/spree/backend/components/_sidebar.scssindex 0e9ab67ae1..a9572692af 100644--- a/backend/app/assets/stylesheets/spree/backend/components/_sidebar.scss+++ b/backend/app/assets/stylesheets/spree/backend/components/_sidebar.scss@@ -1,4 +1,3 @@-aside#main-sidebar {overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */background-color: $gray-100;@@ -9,13 +8,6 @@ aside#main-sidebar {height: 100%;transition: 0.3s ease;z-index: 1041;-- .store_select {- width: 100%;- border: none;- background: none;- width: 100%;- }}body.sidebar-open {diff --git a/backend/app/assets/stylesheets/spree/backend/plugins/_index.scss b/backend/app/assets/stylesheets/spree/backend/plugins/_index.scssnew file mode 100644index 0000000000..045121bb50--- /dev/null+++ b/backend/app/assets/stylesheets/spree/backend/plugins/_index.scss@@ -0,0 +1,6 @@+@import 'sweetalert2_custom';+@import 'jquery_ui';+@import 'flatpickr';+@import 'select2_bootstrap4';+@import 'select2_custom';+@import 'overscroll_indicator';diff --git a/backend/app/assets/stylesheets/spree/backend/plugins/_flatpickr.scss b/backend/app/assets/stylesheets/spree/backend/plugins/flatpickr.scsssimilarity index 100%rename from backend/app/assets/stylesheets/spree/backend/plugins/_flatpickr.scssrename to backend/app/assets/stylesheets/spree/backend/plugins/flatpickr.scssdiff --git a/backend/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scss b/backend/app/assets/stylesheets/spree/backend/plugins/jquery_ui.scsssimilarity index 100%rename from backend/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scssrename to backend/app/assets/stylesheets/spree/backend/plugins/jquery_ui.scssdiff --git a/backend/app/assets/stylesheets/spree/backend/plugins/overscroll_indicator.scss b/backend/app/assets/stylesheets/spree/backend/plugins/overscroll_indicator.scssnew file mode 100644index 0000000000..2ec670da6f--- /dev/null+++ b/backend/app/assets/stylesheets/spree/backend/plugins/overscroll_indicator.scss@@ -0,0 +1,77 @@+[data-overscroll-wrapper] {+ position: relative;+ padding: 0 11px;+}++[data-overscroll-container] {+ overflow-x: auto;+ overflow-y: hidden;++ white-space: nowrap;+ position: relative;+ -ms-overflow-style: none;+ scrollbar-width: none;++ &::-webkit-scrollbar {+ display: none;+ }++ .pn-ProductNav_Contents {+ float: left;+ transition: transform .2s ease-in-out;+ }++ .pn-ProductNav_Contents-no-transition {+ transition: none;+ }+}++.pn-Advancer {+ appearance: none;+ background: transparent;+ border: 0;++ &:focus {+ outline: 0;+ }++ &:hover {+ cursor: pointer;+ }++ position: absolute;+ padding: 5px;+ height: 100%;+ top: 0;+ bottom: 0;+ opacity: 0;+ transition: opacity .3s;+ z-index: -1;+}++.pn-Advancer_Left {+ border-right: 2px solid rgba(128, 128, 128, 0.56);+ background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 65%, rgba(255,255,255,0.8533788515406162) 100%);+ left: -1px;+ [data-overflowing="both"] ~ &,+ [data-overflowing="left"] ~ & {+ opacity: 1;+ z-index: 5;+ }+}++.pn-Advancer_Right {+ border-left: 2px solid rgba(128, 128, 128, 0.56);+ background: linear-gradient(90deg, rgba(255,255,255,0.850577731092437) 0%, rgba(255,255,255,1) 35%, rgba(255,255,255,1) 100%);+ right: -1px;+ [data-overflowing="both"] ~ &,+ [data-overflowing="right"] ~ & {+ opacity: 1;+ z-index: 5;+ }+}++.pn-Advancer_Icon {+ height: 100%;+ fill: #bbb;+}diff --git a/backend/app/assets/stylesheets/spree/backend/plugins/_select2_custom.scss b/backend/app/assets/stylesheets/spree/backend/plugins/select2_custom.scsssimilarity index 100%rename from backend/app/assets/stylesheets/spree/backend/plugins/_select2_custom.scssrename to backend/app/assets/stylesheets/spree/backend/plugins/select2_custom.scssdiff --git a/backend/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scss b/backend/app/assets/stylesheets/spree/backend/plugins/sweetalert2_custom.scsssimilarity index 100%rename from backend/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scssrename to backend/app/assets/stylesheets/spree/backend/plugins/sweetalert2_custom.scssdiff --git a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss b/backend/app/assets/stylesheets/spree/backend/shared/_base.scssindex aef18e044e..a37783667e 100644--- a/backend/app/assets/stylesheets/spree/backend/shared/_base.scss+++ b/backend/app/assets/stylesheets/spree/backend/shared/_base.scss@@ -1,3 +1,28 @@+.transparent-indicator-bg {+ background: repeating-conic-gradient(#c7c7c7 0% 25%, transparent 0% 50%) 50% / 20px 20px+}++figure.admin-img-holder {+ max-width: 285px;+ border: 2px solid grey;+ border-radius: $border-radius;+ overflow: hidden;+ display: inline-block;++ img {+ max-width: 100%;+ height: auto;+ }+ }++ ul#spreePageTabs {+ li.nav-item {+ a {+ padding: 0.3rem 1rem;+ }+ }+ }+.row {padding: 0 0 15px 0;}@@ -40,6 +65,13 @@color: rgba(0, 0, 0, 0.50);}+a#storeSelectorDropdown {+ svg {+ margin-bottom: 0;+ margin-left: 3px;+ }+}+[data-show-info] {color: $primary;cursor: pointer;diff --git a/backend/app/assets/stylesheets/spree/backend/spree_admin.css.scss b/backend/app/assets/stylesheets/spree/backend/spree_admin.css.scssindex 512b9caf80..432b4fb0db 100644--- a/backend/app/assets/stylesheets/spree/backend/spree_admin.css.scss+++ b/backend/app/assets/stylesheets/spree/backend/spree_admin.css.scss@@ -19,11 +19,7 @@@import 'components/progress';@import 'components/spinner';-@import 'plugins/sweetalert2_custom';-@import 'plugins/jquery_ui';-@import 'plugins/flatpickr';-@import 'plugins/select2_bootstrap4';-@import 'plugins/select2_custom';+@import 'plugins/index';@import 'shared/base';@import 'shared/forms';diff --git a/backend/app/controllers/spree/admin/menus_controller.rb b/backend/app/controllers/spree/admin/menus_controller.rbindex c7223ffebd..a285726240 100644--- a/backend/app/controllers/spree/admin/menus_controller.rb+++ b/backend/app/controllers/spree/admin/menus_controller.rb@@ -5,11 +5,15 @@ module Spreeprivate+ def scope+ current_store.menus+ end+def collectionreturn @collection if @collection.present?params[:q] ||= {}- @collection = super+ @collection = scope@search = @collection.ransack(params[:q])@collection = @search.result.page(params[:page]).per(params[:per_page])diff --git a/backend/app/controllers/spree/admin/orders_controller.rb b/backend/app/controllers/spree/admin/orders_controller.rbindex 76516f0246..e2049316a0 100644--- a/backend/app/controllers/spree/admin/orders_controller.rb+++ b/backend/app/controllers/spree/admin/orders_controller.rb@@ -45,7 +45,7 @@ module Spreeparams[:q][:completed_at_lt] = params[:q].delete(:created_at_lt)end- @search = scope.preload(:user).accessible_by(current_ability, :index).ransack(params[:q])+ @search = Spree::Order.preload(:user).accessible_by(current_ability, :index).ransack(params[:q])# lazy loading other models here (via includes) may result in an invalid query# e.g. SELECT DISTINCT DISTINCT "spree_orders".id, "spree_orders"."created_at" AS alias_0 FROM "spree_orders"@@ -60,7 +60,7 @@ module Spreeenddef new- @order = scope.create(order_params)+ @order = Spree::Order.create(order_params)redirect_to cart_admin_order_url(@order)end@@ -142,7 +142,7 @@ module Spreeflash[:error] = @order.errors.full_messages.join(', ')end- redirect_to admin_orders_url+ redirect_to store_admin_order_url(@order)enddef set_channel@@ -157,17 +157,13 @@ module Spreeprivate- def scope- current_store.orders- end-def order_paramsparams[:created_by_id] = try_spree_current_user.try(:id)params.permit(:created_by_id, :user_id, :store_id, :channel)enddef load_order- @order = scope.includes(:adjustments).find_by!(number: params[:id])+ @order = Spree::Order.includes(:adjustments).find_by!(number: params[:id])authorize! action, @orderenddiff --git a/backend/app/controllers/spree/admin/payment_methods_controller.rb b/backend/app/controllers/spree/admin/payment_methods_controller.rbindex 1268acd22d..d5c92d032a 100644--- a/backend/app/controllers/spree/admin/payment_methods_controller.rb+++ b/backend/app/controllers/spree/admin/payment_methods_controller.rb@@ -50,7 +50,13 @@ module Spreeprivatedef collection+ return @collection if @collection.present?++ params[:q] ||= {}@collection = super.order(position: :asc)++ @search = @collection.ransack(params[:q])+ @collection = @search.result.page(params[:page]).per(params[:per_page])enddef load_datadiff --git a/backend/app/controllers/spree/admin/products_controller.rb b/backend/app/controllers/spree/admin/products_controller.rbindex a0cca5d328..415b61233c 100644--- a/backend/app/controllers/spree/admin/products_controller.rb+++ b/backend/app/controllers/spree/admin/products_controller.rb@@ -31,13 +31,7 @@ module Spreeinvoke_callbacks(:update, :after)flash[:success] = flash_message_for(@object, :successfully_updated)respond_with(@object) do |format|- format.html do- if params[:product][:store_ids].include? current_store.id- redirect_to location_after_save- else- redirect_to admin_products_url- end- end+ format.html { redirect_to location_after_save }format.js { render layout: false }endelse@@ -97,12 +91,8 @@ module Spreeprotected- def scope- current_store.products- end-def find_resource- scope.with_deleted.friendly.find(params[:id])+ Product.with_deleted.friendly.find(params[:id])enddef location_after_save@@ -124,7 +114,7 @@ module Spreeparams[:q][:not_discontinued] ||= '1'params[:q][:s] ||= 'name asc'- @collection = scope+ @collection = super# Don't delete params[:q][:deleted_at_null] here because it is used in view to check the# checkbox for 'q[deleted_at_null]'. This also messed with pagination when deleted_at_null is checked.if params[:q][:deleted_at_null] == '0'diff --git a/backend/app/helpers/spree/admin/stores_helper.rb b/backend/app/helpers/spree/admin/stores_helper.rbindex e2ef73042f..5722a960e8 100644--- a/backend/app/helpers/spree/admin/stores_helper.rb+++ b/backend/app/helpers/spree/admin/stores_helper.rb@@ -1,6 +1,18 @@module Spreemodule Adminmodule StoresHelper+ def admin_current_store_products_path+ spree.admin_products_path(q: {stores_id_in: current_store.id})+ end++ def admin_current_store_orders_path+ spree.admin_orders_path(q: {store_id_in: current_store.id})+ end++ def admin_current_store_payment_methods_path+ spree.admin_payment_methods_path(q: {stores_id_in: current_store.id})+ end+def selected_checkout_zone(store)store&.checkout_zone || Spree::Zone.default_checkout_zoneend@@ -13,8 +25,22 @@ module Spreeformatted_storesend- def stores_select()- collection_select(nil, nil, @stores, :formatted_url, :name, { selected: current_store.formatted_url, prompt: "Select store" }, { onchange: "window.location.href=`${this.value}/admin`", id: "store_select", class: "stores_select" })+ def store_switcher_link(store)+ if current_store.id == store.id+ classes = 'disabled bg-light'+ icon = svg_icon name: 'circle-fill.svg', width: '16', height: '16'+ else+ classes = nil+ icon = svg_icon name: 'circle.svg', width: '16', height: '16'+ end++ link_to icon + store.unique_name, store.formatted_url + request.path,+ class: "#{classes} d-flex align-items-center text-dark p-3 dropdown-item"+ end++ def store_switch_tab(store, query = :store_id_in)+ link_to store.unique_name, params.merge({ q: { query => store.id, } }).permit!,+ class: "nav-link #{'active' if params[:q][query] == store.id.to_s}"endendenddiff --git a/backend/app/views/spree/admin/menus/_form.html.erb b/backend/app/views/spree/admin/menus/_form.html.erbindex ee7fed3b38..9223389396 100644--- a/backend/app/views/spree/admin/menus/_form.html.erb+++ b/backend/app/views/spree/admin/menus/_form.html.erb@@ -1,27 +1,19 @@<div data-hook="admin_menu_form_fields" class="row">- <div class="col-12 col-md-6">- <%= f.field_container :name, class: ['form-group'] do %>- <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %>- <%= f.text_field :name, class: 'form-control', required: true %>- <%= f.error_message_on :name %>- <% end %>+ <%= f.field_container :name, class: ['form-group col-12 col-md-4'] do %>+ <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %>+ <%= f.text_field :name, class: 'form-control', required: true %>+ <%= f.error_message_on :name %>+ <% end %>- <%= f.field_container :location, class: ['form-group'] do %>- <%= f.label :location, Spree.t('location') %>- <%= f.select(:location, menu_locations_dropdown_values, {include_blank: false}, class: 'select2') %>- <%= f.error_message_on :location %>- <% end %>- </div>- <div class="col-12 col-md-6">- <%= f.field_container :menu_stores, class: ['form-group'] do %>- <%= label_tag :menu_stores, Spree.t(:stores) %>- <%= collection_select(:menu, :store_id, @stores, :id, :unique_name, {}, { class: 'select2' }) %>- <%= f.error_message_on :menu_stores %>- <% end %>- <%= f.field_container :locale, class: ['form-group'] do %>- <%= 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 %>- </div>+ <%= f.field_container :location, class: ['form-group col-12 col-md-4'] do %>+ <%= f.label :location, Spree.t('location') %>+ <%= f.select(:location, menu_locations_dropdown_values, {include_blank: false}, class: 'select2') %>+ <%= f.error_message_on :location %>+ <% end %>++ <%= f.field_container :locale, class: ['form-group col-12 col-md-4'] do %>+ <%= 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 %></div>diff --git a/backend/app/views/spree/admin/menus/index.html.erb b/backend/app/views/spree/admin/menus/index.html.erbindex 9a5d9f27be..9588e5daa4 100644--- a/backend/app/views/spree/admin/menus/index.html.erb+++ b/backend/app/views/spree/admin/menus/index.html.erb@@ -11,33 +11,25 @@<%= search_form_for [:admin, @search] do |f| %><%- locals = {f: f} %><div class="row">- <div class="col-12 col-lg-6">+ <div class="col-12 col-lg-4"><div class="form-group"><%= f.label :name_cont, Spree.t('name') %><%= f.text_field :name_cont, size: 15, class: "form-control js-quick-search-target js-filterable" %></div></div>- <div class="col-12 col-lg-6">+ <div class="col-12 col-lg-4"><div class="form-group"><%= label_tag :q_location_eq, Spree.t(:location) %><%= f.select :location_eq, menu_locations_dropdown_values, { include_blank: true }, class: 'select2-clear js-filterable' %></div></div>- </div>- <div class="row">- <div class="col-12 col-lg-6">+ <div class="col-12 col-lg-4"><div class="form-group"><%= label_tag :q_locale_eq, Spree.t(:language) %><%= f.select :locale_eq, all_locales_options, { include_blank: true }, class: 'select2-clear js-filterable' %></div></div>- <div class="col-12 col-lg-6">- <div class="form-group">- <%= label_tag :q_store_id_in, Spree.t(:store) %>- <%= f.select :store_id_in, stores_dropdown_values, { include_blank: true }, class: 'select2-clear js-filterable' %>- </div>- </div></div><div data-hook="admin_menus_index_search_buttons" class="form-actions">diff --git a/backend/app/views/spree/admin/orders/index.html.erb b/backend/app/views/spree/admin/orders/index.html.erbindex 93fb36517e..59ce3b1809 100644--- a/backend/app/views/spree/admin/orders/index.html.erb+++ b/backend/app/views/spree/admin/orders/index.html.erb@@ -10,6 +10,10 @@id: 'admin_new_order' %><% end if can? :create, Spree::Order %>+<% content_for :page_tabs do %>+ <%= render 'spree/admin/shared/fast_store_filter', all_stores_path: spree.admin_orders_path %>+<% end %>+<% content_for :table_filter do %><div data-hook="admin_orders_index_search">@@ -30,7 +34,6 @@value: params[:q][:created_at_gt],placeholder: Spree.t(:starting_from),'data-input':'' %>-<%= render partial: 'spree/admin/shared/cal_close' %></div></div>@@ -45,7 +48,6 @@value: params[:q][:created_at_lt],placeholder: Spree.t(:ending_at),'data-input':'' %>-<%= render partial: 'spree/admin/shared/cal_close' %></div></div>@@ -54,7 +56,7 @@</div><div class="col-12 col-lg-4"><div class="form-group">- <%= label_tag :q_number_cont, Spree.t(:order_number, number: 'Number') %>+ <%= label_tag :q_number_cont, Spree.t(:order_number, number: '') %><%= f.text_field :number_cont, class: 'form-control js-quick-search-target js-filterable' %></div></div>@@ -130,6 +132,13 @@</div></div>+ <div class="col-12 col-lg-4">+ <div class="form-group">+ <%= label_tag :q_store_id_in, Spree.t(:store) %>+ <%= f.select :store_id_in, Spree::Store.order(:name).pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>+ </div>+ </div>+<div class="col-12 col-lg-4"><div class="form-group"><%= label_tag :q_channel_eq, Spree.t(:channel) %>diff --git a/backend/app/views/spree/admin/payment_methods/edit.html.erb b/backend/app/views/spree/admin/payment_methods/edit.html.erbindex bd72bd9bb5..3c7754c453 100644--- a/backend/app/views/spree/admin/payment_methods/edit.html.erb+++ b/backend/app/views/spree/admin/payment_methods/edit.html.erb@@ -1,5 +1,5 @@<% content_for :page_title do %>- <%= link_to Spree.t(:payment_methods), spree.admin_payment_methods_url %> /+ <%= link_to Spree.t(:payment_methods), admin_current_store_payment_methods_path %> /<%= @payment_method.name %><% end %>diff --git a/backend/app/views/spree/admin/payment_methods/index.html.erb b/backend/app/views/spree/admin/payment_methods/index.html.erbindex a24aa585cd..5a8026dddf 100644--- a/backend/app/views/spree/admin/payment_methods/index.html.erb+++ b/backend/app/views/spree/admin/payment_methods/index.html.erb@@ -6,6 +6,10 @@<%= button_link_to Spree.t(:new_payment_method), new_object_url, class: "btn-success", icon: 'add.svg', id: 'admin_new_payment_methods_link' %><% end if can? :create, Spree::PaymentMethod %>+<% content_for :page_tabs do %>+ <%= render 'spree/admin/shared/fast_store_filter', query: :stores_id_in, all_stores_path: spree.admin_payment_methods_path %>+<% end %>+<% if @payment_methods.any? %><div class="table-responsive"><table class="table sortable" id='listing_payment_methods' data-hook data-sortable-link="<%= update_positions_admin_payment_methods_url %>">diff --git a/backend/app/views/spree/admin/payment_methods/new.html.erb b/backend/app/views/spree/admin/payment_methods/new.html.erbindex 59f23982e5..01457ceade 100644--- a/backend/app/views/spree/admin/payment_methods/new.html.erb+++ b/backend/app/views/spree/admin/payment_methods/new.html.erb@@ -1,5 +1,5 @@<% content_for :page_title do %>- <%= link_to Spree.t(:payment_methods), spree.admin_payment_methods_url %> /+ <%= link_to Spree.t(:payment_methods), admin_current_store_payment_methods_path %> /<%= Spree.t(:new_payment_method) %><% end %>diff --git a/backend/app/views/spree/admin/products/index.html.erb b/backend/app/views/spree/admin/products/index.html.erbindex 67f0be4c73..f623893da0 100644--- a/backend/app/views/spree/admin/products/index.html.erb+++ b/backend/app/views/spree/admin/products/index.html.erb@@ -6,24 +6,34 @@<%= button_link_to Spree.t(:new_product), new_object_url, { class: "btn-success", icon: 'add.svg', id: 'admin_new_product' } %><% end if can?(:create, Spree::Product) %>+<% content_for :page_tabs do %>+ <%= render 'spree/admin/shared/fast_store_filter', query: :stores_id_in, all_stores_path: spree.admin_products_path %>+<% end %>+<% content_for :table_filter do %><div data-hook="admin_products_sidebar"><%= search_form_for [:admin, @search] do |f| %><%- locals = {f: f} %><div data-hook="admin_products_index_search" class="row">- <div class="col-12 col-lg-6">+ <div class="col-12 col-lg-4"><div class="form-group"><%= f.label :search_by_name, Spree.t(:product_name) %><%= f.text_field :search_by_name, size: 15, class: "form-control js-quick-search-target js-filterable" %></div></div>- <div class="col-12 col-lg-6">+ <div class="col-12 col-lg-4"><div class="form-group"><%= f.label :variants_including_master_sku_cont, Spree.t(:sku) %><%= f.text_field :variants_including_master_sku_cont, size: 15, class: "form-control js-filterable" %></div></div>+ <div class="col-12 col-lg-4">+ <div class="form-group">+ <%= label_tag :q_stores_id_in, Spree.t(:store) %>+ <%= f.select :stores_id_in, Spree::Store.order(:name).pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>+ </div>+ </div><div class="col-12"><div class="field checkbox mb-2"><label>@@ -59,7 +69,6 @@<th scope="col" class="text-center"><%= sort_link @search, :master_default_price_amount, Spree.t(:master_price), {}, {title: 'admin_products_listing_price_title'} %></th>- <th><%= Spree.t(:stores) %></th><th scope="col" data-hook="admin_products_index_header_actions" class="actions"></th></tr></thead>diff --git a/backend/app/views/spree/admin/shared/_content_header.html.erb b/backend/app/views/spree/admin/shared/_content_header.html.erbindex b7b56daf45..190c2bc110 100644--- a/backend/app/views/spree/admin/shared/_content_header.html.erb+++ b/backend/app/views/spree/admin/shared/_content_header.html.erb@@ -1,7 +1,7 @@-<div id="contentHeader" class="row mb-3">+<div id="contentHeader" class="row mb-0 pb-0"><% if content_for?(:page_title) || content_for?(:page_actions) %><div class="content-header col <%= "with-page-tabs" if content_for?(:page_tabs) %> page-header">- <div class="row align-items-center <%= if content_for?(:page_tabs) then "pb-0" else "border-bottom" end %>">+ <div class="row align-items-center <%= if content_for?(:page_tabs) then "border-bottom pb-2" else "border-bottom pb-2 mb-3" end %>"><% if content_for?(:page_title) %><h1 class="contextual-title px-0 mb-0 col">@@ -33,10 +33,20 @@</div><% if content_for?(:page_tabs) %>- <div class="row">- <ul class="nav nav-tabs w-100 mt-4 px-0">- <%= yield :page_tabs %>- </ul>+ <div class="row my-2 pb-1 pt-1" data-overscroll-wrapper>+ <div data-overscroll-container>+ <ul id="spreePageTabs" class="nav nav-pills flex-nowrap pn-ProductNav_Contents" data-overscroll-content>+ <%= yield :page_tabs%>+ </ul>+ </div>++ <button id="pnAdvancerLeft" class="pn-Advancer pn-Advancer_Left" type="button" data-overscroll-button-left>+ <svg class="pn-Advancer_Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 551 1024"><path d="M445.44 38.183L-2.53 512l447.97 473.817 85.857-81.173-409.6-433.23v81.172l409.6-433.23L445.44 38.18z" /></svg>+ </button>++ <button id="pnAdvancerRight" class="pn-Advancer pn-Advancer_Right" type="button" data-overscroll-button-right>+ <svg class="pn-Advancer_Icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 551 1024"><path d="M105.56 985.817L553.53 512 105.56 38.183l-85.857 81.173 409.6 433.23v-81.172l-409.6 433.23 85.856 81.174z" /></svg>+ </button></div><% end %>diff --git a/backend/app/views/spree/admin/shared/_fast_store_filter.html.erb b/backend/app/views/spree/admin/shared/_fast_store_filter.html.erbnew file mode 100644index 0000000000..7249ffdedb--- /dev/null+++ b/backend/app/views/spree/admin/shared/_fast_store_filter.html.erb@@ -0,0 +1,11 @@+<% query = query || :store_id_in %>++<li class="nav-item">+ <%= link_to Spree.t(:all_stores), all_stores_path, class: "nav-link #{'active' if params[:q][query].blank?}" %>+</li>++<% @stores.each do |store| %>+ <li class="nav-item">+ <%= store_switch_tab(store, query) %>+ </li>+<% end %>diff --git a/backend/app/views/spree/admin/shared/_header.html.erb b/backend/app/views/spree/admin/shared/_header.html.erbindex 66f5a80227..fe2e6e1c1e 100644--- a/backend/app/views/spree/admin/shared/_header.html.erb+++ b/backend/app/views/spree/admin/shared/_header.html.erb@@ -1,6 +1,6 @@<header class="header logged-in">- <nav class="navbar fixed-top navbar-dark align-items-middle">- <div class="col-3 col-sm-4 p-0 d-lg-none">+ <nav class="navbar fixed-top navbar-dark">+ <div class="col p-0 d-lg-none"><buttonid="sidebar-open"class="navbar-toggler h-100 text-light"@@ -10,15 +10,11 @@<%= svg_icon name: "menu.svg", width: '20', height: '20' %></button></div>- <div class="col text-center text-lg-left">- <%= link_to(- image_tag(Spree::Config[:admin_interface_logo], id: 'logo', alt: current_store.name),- spree.admin_path,- class: "logo navbar-brand"- ) %>+ <div class="col-auto text-center text-lg-left px-0 px-lg-2 align-items-center">+ <%= render partial: 'spree/admin/shared/store_switcher' %></div>- <div class="col-3 col-sm-4 text-right p-0">+ <div class="col text-right p-0"><%= render partial: 'spree/admin/shared/account_nav' %></div></nav>diff --git a/backend/app/views/spree/admin/shared/_main_menu.html.erb b/backend/app/views/spree/admin/shared/_main_menu.html.erbindex b8ce902d1f..a762d9c6e5 100644--- a/backend/app/views/spree/admin/shared/_main_menu.html.erb+++ b/backend/app/views/spree/admin/shared/_main_menu.html.erb@@ -12,7 +12,7 @@<% if can? :admin, Spree::Order %><ul class="nav nav-sidebar border-bottom" id="sidebarOrder">- <%= tab *Spree::BackendConfiguration::ORDER_TABS, icon: 'list.svg' %>+ <%= tab *Spree::BackendConfiguration::ORDER_TABS, url: admin_current_store_orders_path, icon: 'list.svg' %></ul><% end %>diff --git a/backend/app/views/spree/admin/shared/_order_tabs.html.erb b/backend/app/views/spree/admin/shared/_order_tabs.html.erbindex 3a4bcb3b79..ba6992354a 100644--- a/backend/app/views/spree/admin/shared/_order_tabs.html.erb+++ b/backend/app/views/spree/admin/shared/_order_tabs.html.erb@@ -1,5 +1,5 @@<% content_for :page_title do %>- <%= link_to Spree.t(:orders), admin_orders_path %> /+ <%= link_to Spree.t(:orders), admin_current_store_orders_path %> /<%= link_to @order.number, spree.edit_admin_order_path(@order) %><% end %>diff --git a/backend/app/views/spree/admin/shared/_product_tabs.html.erb b/backend/app/views/spree/admin/shared/_product_tabs.html.erbindex b465eb3e1d..a62ea3ffc6 100644--- a/backend/app/views/spree/admin/shared/_product_tabs.html.erb+++ b/backend/app/views/spree/admin/shared/_product_tabs.html.erb@@ -1,5 +1,5 @@<% content_for :page_title do %>- <%= link_to Spree.t(:products), admin_products_path %> /+ <%= link_to Spree.t(:products), admin_current_store_products_path %> /<%= @product.name %><% end %>diff --git a/backend/app/views/spree/admin/shared/_store_switcher.html.erb b/backend/app/views/spree/admin/shared/_store_switcher.html.erbindex d77fd0b256..ad7a67e497 100644--- a/backend/app/views/spree/admin/shared/_store_switcher.html.erb+++ b/backend/app/views/spree/admin/shared/_store_switcher.html.erb@@ -1,5 +1,19 @@<% if can?(:admin, current_store) %>- <div class="d-block border-top p-3 mt-3">- <%= stores_select %>+<%#= stores_select %>+ <div id="storeSwitcherDropdown" class="dropdown">++ <span class="d-none d-lg-inline text-light">+ <%= svg_icon name: "spree-icon.svg", width: '35', height: '35' %>+ </span>++ <a class="px-0 py-1 btn text-light" id="storeSelectorDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">+ <%= current_store.unique_name %> <%= svg_icon name: "chevron-down.svg", width: '12', height: '12' %>+ </a>++ <div class="dropdown-menu dropdown-menu-left overflow-hidden mt-2 py-0" aria-labelledby="storeSelectorDropdown">+ <% @stores.each do |store| %>+ <%= store_switcher_link(store) %>+ <% end %>+ </div></div><% end %>diff --git a/backend/app/views/spree/admin/shared/_table_filter.html.erb b/backend/app/views/spree/admin/shared/_table_filter.html.erbindex e0e83c1968..e81e45057b 100644--- a/backend/app/views/spree/admin/shared/_table_filter.html.erb+++ b/backend/app/views/spree/admin/shared/_table_filter.html.erb@@ -1,11 +1,11 @@<% if content_for?(:table_filter) %>- <div class="filter-wrap row mb-4">- <div class="col-12">- <div class="input-group index-filter-button">+ <div class="filter-wrap row">+ <div class="col-12 px-0">+ <div class="input-group index-filter-button flex-nowrap"><span class="input-group-btn"><button class="btn js-show-index-filters m-0" type="button">- <%= svg_icon name: "chevron-right.svg", width: '12', height: '12' %>- <%= Spree.t(:filter) %>+ <%= svg_icon name: "chevron-right.svg", width: '12', height: '12' %>+ <span class="d-none d-sm-inline"><%= Spree.t(:filter) %></span></button></span><%= form_tag request.fullpath, id: "quick-search", class: 'flex-grow-1' do %>diff --git a/backend/app/views/spree/admin/shared/sub_menu/_configuration.html.erb b/backend/app/views/spree/admin/shared/sub_menu/_configuration.html.erbindex 99505c6295..b5d7d38110 100644--- a/backend/app/views/spree/admin/shared/sub_menu/_configuration.html.erb+++ b/backend/app/views/spree/admin/shared/sub_menu/_configuration.html.erb@@ -10,7 +10,7 @@<%= configurations_sidebar_menu_item(Spree.t(:states), spree.admin_country_states_path(country)) if can? :manage, Spree::Country %><% end %>- <%= configurations_sidebar_menu_item(Spree.t(:payment_methods), spree.admin_payment_methods_path) if can? :manage, Spree::PaymentMethod %>+ <%= tab :payment_methods, url: admin_current_store_payment_methods_path, match_path: '/payment_methods' if can? :manage, Spree::PaymentMethod %><%= configurations_sidebar_menu_item(Spree.t(:shipping_methods), spree.admin_shipping_methods_path) if can? :manage, Spree::ShippingMethod %><%= configurations_sidebar_menu_item(Spree.t(:shipping_categories), spree.admin_shipping_categories_path) if can? :manage, Spree::ShippingCategory %><%= configurations_sidebar_menu_item(Spree.t(:stock_transfers), spree.admin_stock_transfers_path) if can? :manage, Spree::StockTransfer %>diff --git a/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb b/backend/app/views/spree/admin/shared/sub_menu/_product.html.erbindex 682f158faf..53555005f6 100644--- a/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb+++ b/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb@@ -1,5 +1,5 @@<ul id="sidebar-product" class="border-top bg-white collapse nav nav-pills nav-stacked" data-hook="admin_product_sub_tabs">- <%= tab :products, match_path: '/products' %>+ <%= tab :products, url: admin_current_store_products_path, match_path: '/products' %><%= tab :option_types, match_path: '/option_types' %><%= tab :properties %><%= tab :prototypes %>diff --git a/backend/app/views/spree/admin/stores/_form.html.erb b/backend/app/views/spree/admin/stores/_form.html.erbindex 724658c577..b2b7f6d5c6 100644--- a/backend/app/views/spree/admin/stores/_form.html.erb+++ b/backend/app/views/spree/admin/stores/_form.html.erb@@ -7,61 +7,70 @@</h1></div><div class="card-body">- <%= f.field_container :logo, class: ['form-group'] do %>- <% if @store.logo.attached? && @store.logo.variable? %>- <%= image_tag main_app.url_for(@store.logo.variant(resize: '244x104>')) %>- <% elsif @store.logo.attached? && @store.logo.image? %>- <%= image_tag main_app.url_for(@store.logo) %>+ <div class="row">+ <%= f.field_container :logo, class: ['form-group col-12 col-md-4'] do %>+ <% if @store.logo.attached? && @store.logo.variable? %>+ <%= image_tag main_app.url_for(@store.logo.variant(resize: '244x104>')) %>+ <% elsif @store.logo.attached? && @store.logo.image? %>+ <%= image_tag main_app.url_for(@store.logo) %>+ <% end %>+ <%= f.field_container :logo, class: ['form-group'] do %>+ <%= f.file_field :logo %>+ <%= f.label :logo, Spree.t(:logo) %><br>+ <%= f.error_message_on :logo %>+ <% end %><% end %>- <%= f.field_container :logo, class: ['form-group'] do %>- <%= f.label :logo, Spree.t(:logo) %><br>- <%= f.file_field :logo %>- <%= f.error_message_on :logo %>- <% end %>- <% end %>- <%= f.field_container :mailer_logo, class: ['form-group'] do %>- <% if @store.mailer_logo.attached? && @store.mailer_logo.variable? %>- <%= image_tag main_app.url_for(@store.mailer_logo.variant(resize: '244x104>')) %>++ <%= f.field_container :mailer_logo, class: ['form-group col-12 col-md-4'] do %>+ <% if @store.mailer_logo.attached? && @store.mailer_logo.variable? %>+ <%= image_tag main_app.url_for(@store.mailer_logo.variant(resize: '244x104>')) %>+ <% end %>+ <%= f.field_container :mailer_logo, class: ['form-group'] do %>+ <%= f.file_field :mailer_logo, accept: Spree::Store::MAILER_LOGO_CONTENT_TYPES.join(',') %>+ <%= f.label :mailer_logo, Spree.t(:mailer_logo) %><br>+ <%= f.error_message_on :mailer_logo %>+ <% end %><% end %>- <%= f.field_container :mailer_logo, class: ['form-group'] do %>- <%= f.label :mailer_logo, Spree.t(:mailer_logo) %><br>- <%= f.file_field :mailer_logo, accept: Spree::Store::MAILER_LOGO_CONTENT_TYPES.join(',') %>- <%= f.error_message_on :mailer_logo %>++ <%= f.field_container :favicon_image, class: ['form-group col-12 col-md-4'] do %>+ <% if @store.favicon_image.attached? && @store.favicon_image.variable? %>+ <figure class="admin-img-holder transparent-indicator-bg">+ <%= image_tag main_app.url_for(@store.favicon_image.variant(resize: '104x104')) %>+ </figure>+ <% end %>+ <%= f.field_container :favicon_image, class: ['form-group'] do %>+ <%= f.file_field :favicon_image, accept: Spree::Store::FAVICON_CONTENT_TYPES.join(',') %>+ <%= f.label :favicon_image, "#{Spree.t(:favicon)} (#{Spree.t(:favicon_upload_info)})" %>+ <%= f.error_message_on :favicon_image %>+ <% end %><% end %>- <% end %>- <%= f.field_container :favicon_image, class: ['form-group'] do %>- <% if @store.favicon_image.attached? && @store.favicon_image.variable? %>- <%= image_tag main_app.url_for(@store.favicon_image.variant(resize: '104x104')) %>+ </div>++ <div class="row">+ <%= f.field_container :name, class: ['form-group col-12 col-md-6'] do %>+ <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %>+ <%= f.text_field :name, class: 'form-control', required: true %>+ <%= f.error_message_on :name %><% end %>- <%= f.field_container :favicon_image, class: ['form-group'] do %>- <%= f.label :favicon_image, "#{Spree.t(:favicon)} (#{Spree.t(:favicon_upload_info)})" %><br>- <%= f.file_field :favicon_image, accept: Spree::Store::FAVICON_CONTENT_TYPES.join(',') %>- <%= f.error_message_on :favicon_image %>+ <%= f.field_container :code, class: ['form-group col-12 col-md-6'] do %>+ <%= f.label :code, raw(Spree.t(:code) + required_span_tag) %>+ <%= f.text_field :code, class: 'form-control', required: true %>+ <small class="form-text text-muted">+ <%= Spree.t('store_form.code_help') %>+ </small>+ <%= f.error_message_on :code %><% end %>- <% end %>- <%= f.field_container :name, class: ['form-group'] do %>- <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %>- <%= f.text_field :name, class: 'form-control', required: true %>- <%= f.error_message_on :name %>- <% end %>- <%= f.field_container :code, class: ['form-group'] do %>- <%= f.label :code, raw(Spree.t(:code) + required_span_tag) %>- <%= f.text_field :code, class: 'form-control', required: true %>- <small class="form-text text-muted">- <%= Spree.t('store_form.code_help') %>- </small>- <%= f.error_message_on :code %>- <% end %>- <%= f.field_container :url, class: ['form-group'] do %>- <%= f.label :url, raw(Spree.t(:url) + required_span_tag) %>- <div class="input-group mb-3">- <div class="input-group-prepend">- <span class="input-group-text" id="basic-addon3">https://</span>+ <%= f.field_container :url, class: ['form-group col-12'] do %>+ <%= f.label :url, raw(Spree.t(:url) + required_span_tag) %>+ <div class="input-group mb-3">+ <div class="input-group-prepend">+ <span class="input-group-text" id="basic-addon3">https://</span>+ </div>+ <%= f.text_field :url, class: 'form-control', required: true %></div>- <%= f.text_field :url, class: 'form-control', required: true %>- </div>- <%= f.error_message_on :url %>- <% end %>+ <%= f.error_message_on :url %>+ <% end %>+ </div></div></div>diff --git a/backend/app/views/spree/layouts/admin.html.erb b/backend/app/views/spree/layouts/admin.html.erbindex 6ae4c55907..b1abbf2854 100644--- a/backend/app/views/spree/layouts/admin.html.erb+++ b/backend/app/views/spree/layouts/admin.html.erb@@ -27,16 +27,13 @@id="main-sidebar"data-hook="admin_tabs"><%= render partial: 'spree/admin/shared/main_menu' %>- <div>- <%= render partial: 'spree/admin/shared/version' %>- <%= render partial: 'spree/admin/shared/store_switcher' %>- </div>+ <%= render partial: 'spree/admin/shared/version' %></aside><%#-------------------------------------------------%><%# Content %><%#-------------------------------------------------%>- <main class="col-12 col-lg-9 col-xl-10 offset-lg-3 offset-xl-2 main" id="main-part">+ <main class="col-12 col-lg-9 col-xl-10 offset-lg-3 offset-xl-2 main pt-2" id="main-part"><div class="container"><%#-------------------------------------------------%>diff --git a/core/app/models/spree/payment_method.rb b/core/app/models/spree/payment_method.rbindex dc97d57e0f..3aa6cc15a7 100644--- a/core/app/models/spree/payment_method.rb+++ b/core/app/models/spree/payment_method.rb@@ -12,6 +12,8 @@ module Spreevalidates :name, presence: true+ self.whitelisted_ransackable_associations = %w[stores]+has_and_belongs_to_many :storeswith_options dependent: :restrict_with_error dodiff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rbindex 46f47a8562..e6319ed648 100644--- a/core/app/models/spree/store.rb+++ b/core/app/models/spree/store.rb@@ -27,6 +27,8 @@ module Spreevalidates :new_order_notifications_email, email: { allow_blank: true }end+ default_scope { order(created_at: :asc) }+has_one_attached :logohas_one_attached :mailer_logohas_one_attached :favicon_imagediff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 17e2c7fcff..d1cd413264 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -648,6 +648,7 @@ en:all_items_have_been_returned: All items have been returnedall_rights_reserved: All rights reservedalready_have_account: Already have an account?+ all_stores: All Storesalt_text: Alternative Textalternative_phone: Alternative Phoneamount: Amount