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
Redesigned Admin Dashboard sidebar for quicker access and better UX (#12568)
Damian Legawiec5cfe584217fd
diff --git a/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss b/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scssindex ef0651c130..44c414af51 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss@@ -1,14 +1,30 @@.dropdown .btn .text-muted {color: $gray-500 !important;}++.dropdown {+ .arrow {+ color: $gray-300;+ }++ &:hover {+ .arrow {+ color: $gray-500;+ }+ }+}++.dropdown.show {+ .arrow {+ transform: rotate(3.142rad);+ }+}+.dropdown-menu {overflow: hidden !important;box-shadow: $dropdown-box-shadow;- animation: fadeIn;- animation-duration: 0.5s;-font-weight: 500;.dropdown-item, .dropdown-header {diff --git a/admin/app/assets/stylesheets/spree/admin/components/_main.scss b/admin/app/assets/stylesheets/spree/admin/components/_main.scssindex e8f1b8baa8..2065b24a64 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_main.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_main.scss@@ -11,16 +11,140 @@ turbo-frame[loading] .spinner-border, turbo-frame[busy] .spinner-border {}#page-header {- min-height: 74px;+ height: 74px;+ display: flex;+ align-items: center;}.page-header-title {- font-size: 1.5rem;+ font-size: 1.25rem;font-weight: 700;}#main-sidebar {- .nav-item {- margin-bottom: 3px;+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ width: 250px;+ background-color: $gray-25;+ border-right: 1px solid $gray-100;+ height: 100vh;+ overflow-y: auto;+ position: fixed;+ top: 0;+ color: $gray-700;+ padding-top: 0.5rem;++ @media (max-width: 992px) {+ display: none;+ }++ .nav {+ padding-left: 0.75rem;+ padding-right: 0.75rem;+ }+ .nav {+ gap: 0.25rem;+ display: flex;+ flex-direction: column;+ }++ .nav-link {+ border-radius: $border-radius;+ display: flex;+ align-items: center;+ padding-left: 0.5rem;+ padding-right: 0.5rem;+ padding-top: 0.35rem;+ padding-bottom: 0.35rem;+ font-weight: 500;+ transition: background 0.35s, color 0.1s;+ will-change: background, color;++ .ti {+ font-size: 1.125rem;+ margin-right: 0.5rem;+ color: $gray-500;+ }++ &:hover {+ background-color: $gray-75;+ transition-duration: 75ms;+ animation-duration: 75ms;+ }+ &.active {+ background-color: $gray-100;+ }++ .badge {+ @extend .badge-light;+ }+ }++ .nav-submenu {+ display: flex;+ flex-direction: column;+ list-style: none;++ margin-left: 1.5rem !important;++ .nav-link {+ font-weight: 400;+ padding-top: 0.25rem;+ padding-bottom: 0.25rem;++ &:hover {+ background-color: $gray-50;+ }+ &.active, &:active, &:focus {+ font-weight: 600;+ background-color: transparent !important;+ }+ }+ }++ .dropdown {+ padding-left: 0.5rem;+ padding-right: 0.5rem;++ .btn {+ padding: 0.25rem 0.25rem;+ border-radius: $border-radius;+ display: flex;+ align-items: center;++ &:hover, &:focus, &:active {+ background-color: $gray-50;+ }+ }++ .dropdown-menu {+ width: calc(100% - 1rem) !important;+ }+ }+}++#content {+ @media (min-width: 992px) {+ margin-left: 251px;}-}\ No newline at end of file+}++#enterprise-edition-notice {+ @extend .alert;+ @extend .alert-info;++ background-image: none;+ padding-left: 1rem;+ border-left: 0;+ border-right: 0;+ border-radius: 0;+ font-size: $font-size-sm;+ margin-bottom: 0;++ .btn-close {+ position: absolute;+ right: 0.5rem;+ top: 0.5rem;+ }+}diff --git a/admin/app/assets/stylesheets/spree/admin/components/_navigation.scss b/admin/app/assets/stylesheets/spree/admin/components/_navigation.scssindex 3fdd9bdc56..965dcb3308 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_navigation.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_navigation.scss@@ -7,24 +7,6 @@width: 1rem;}-.dropdown {- .arrow {- color: $gray-300;- }-- &:hover {- .arrow {- color: $gray-500;- }- }-}--.dropdown.show {- .arrow {- transform: rotate(3.142rad);- }-}-.nav-link {cursor: pointer;@extend .position-relative;@@ -82,89 +64,3 @@}}}--.nav-dark {- .nav-link {- @extend .rounded-sm;- padding: 6px 10px;- color: $gray-300;- display: flex;- align-items: center;- font-weight: 400;-- .ti {- color: $gray-600;- }- .ti:first-child {- @extend .mr-3;- }-- &.active, &:focus, &:active {- color: $gray-100;- background-color: rgba($gray-800, 0.5);-- i {- color: $gray-200 !important;- }- font-weight: 600 !important;- }-- &:hover {- color: $gray-100 !important;- background-color: rgba($gray-800, 0.25) !important;-- i {- color: $gray-100 !important;- }- }- }-- .badge:not(.badge-warning):not(.badge-warning) {- background-color: $gray-800;- color: $gray-300;- }-- &.font-size-lg {- .ti {- font-size: 20px;- line-height: 20px;- }- }-}--.nav-submenu {- @extend .nav;-- padding-left: 12px !important;-- .nav-link {- &:hover, &.active, &:active, &:focus {- background-color: transparent !important;- font-weight: 500;- }- }-}--#header-user-account .btn {- i {- color: $gray-600 !important;- }-- &:hover, &:focus {- i {- color: $gray-700 !important;- }- }-}--#header-user-account .dropdown-item {- i {- color: $gray-500 !important;- }-- &:hover, &:focus {- i {- color: $gray-700 !important;- }- }-}diff --git a/admin/app/assets/stylesheets/spree/admin/global/_variables.scss b/admin/app/assets/stylesheets/spree/admin/global/_variables.scssindex 33ab02286c..dba42aca5b 100644--- a/admin/app/assets/stylesheets/spree/admin/global/_variables.scss+++ b/admin/app/assets/stylesheets/spree/admin/global/_variables.scss@@ -2,6 +2,7 @@$gray-25: #F9F9F9;$gray-50: #F3F3F3;+$gray-75: #F0F0F0;$gray-100: #EAEAEA !default;$gray-150: #E0E0E0 !default;$gray-200: #D5D5D5 !default;diff --git a/admin/app/controllers/spree/admin/dashboard_controller.rb b/admin/app/controllers/spree/admin/dashboard_controller.rbindex 8018a5b59c..39a0334e83 100644--- a/admin/app/controllers/spree/admin/dashboard_controller.rb+++ b/admin/app/controllers/spree/admin/dashboard_controller.rb@@ -52,6 +52,12 @@ module Spreeload_analytics_dataend+ # PATCH /admin/dashboard/dismiss_enterprise_edition_notice+ def dismiss_enterprise_edition_notice+ session[:spree_enterprise_edition_notice_dismissed] = true+ redirect_back(fallback_location: spree.admin_dashboard_path)+ end+privatedef load_vendordiff --git a/admin/app/helpers/spree/admin/base_helper.rb b/admin/app/helpers/spree/admin/base_helper.rbindex 1256208f09..3d693f1308 100644--- a/admin/app/helpers/spree/admin/base_helper.rb+++ b/admin/app/helpers/spree/admin/base_helper.rb@@ -7,8 +7,12 @@ module Spreedefined?(Vendo)end+ def spree_updater+ @spree_updater ||= Spree::Admin::Updater+ end+def spree_update_available?- @spree_update_available ||= !Rails.env.test? && Spree::Admin::Updater.update_available?+ @spree_update_available ||= !Rails.env.test? && spree_updater.update_available?enddef available_countries_isodiff --git a/admin/app/helpers/spree/admin/navigation_helper.rb b/admin/app/helpers/spree/admin/navigation_helper.rbindex a1e4fb3881..8c6a7d1658 100644--- a/admin/app/helpers/spree/admin/navigation_helper.rb+++ b/admin/app/helpers/spree/admin/navigation_helper.rb@@ -182,7 +182,7 @@ module Spreeendlink_to url, class: 'd-flex align-items-center text-decoration-none' do- content_tag(:span, icon('chevron-left', class: 'mr-0'), class: 'btn hover-gray px-2 mr-2 d-flex align-items-center') ++ content_tag(:span, icon('chevron-left', class: 'mr-0'), class: 'btn hover-gray px-2 d-flex align-items-center') +content_tag(:span, label, class: 'font-size-base text-black')endenddiff --git a/admin/app/helpers/spree/admin/stores_helper.rb b/admin/app/helpers/spree/admin/stores_helper.rbindex f813ed5260..e891db3af8 100644--- a/admin/app/helpers/spree/admin/stores_helper.rb+++ b/admin/app/helpers/spree/admin/stores_helper.rb@@ -8,7 +8,7 @@ module SpreeDEFAULT_ICON_SIZE = 40def store_admin_icon(store, opts = {})- opts[:class] ||= 'mr-lg-3 rounded-sm bg-white border'+ opts[:class] ||= 'rounded-sm bg-white border'opts[:height] ||= DEFAULT_ICON_SIZEopts[:width] ||= DEFAULT_ICON_SIZE@@ -53,7 +53,7 @@ module Spreeopts[:height] ||= DEFAULT_ICON_SIZEopts[:width] ||= DEFAULT_ICON_SIZEopts[:class] ||= ''- opts[:class] += ' mr-lg-3 rounded text-dark d-flex align-items-center justify-content-center bg-gray-200'+ opts[:class] += ' rounded text-dark d-flex align-items-center justify-content-center bg-gray-200'content_tag(:span, name[0].upcase, class: opts[:class], style: "height: #{opts[:height]}px; width: #{opts[:width]}px;")enddiff --git a/admin/app/models/spree/admin/updater.rb b/admin/app/models/spree/admin/updater.rbindex 8ee433da31..8247a87d25 100644--- a/admin/app/models/spree/admin/updater.rb+++ b/admin/app/models/spree/admin/updater.rb@@ -13,6 +13,10 @@ module Spreefetch_updates.any?end+ def self.latest_version+ @latest_version ||= fetch_updates.first&.dig('version')+ end+def self.fetch_updates@updates ||= Rails.cache.fetch("spree/admin/updater/fetch_updates/#{Spree.version}", expires_in: 1.day) douri = URI(SPREE_CLOUD_UPDATES_URL)diff --git a/admin/app/views/layouts/spree/admin.html.erb b/admin/app/views/layouts/spree/admin.html.erbindex 0fbc8b092e..952b942b95 100644--- a/admin/app/views/layouts/spree/admin.html.erb+++ b/admin/app/views/layouts/spree/admin.html.erb@@ -6,25 +6,15 @@</head><body class="admin min-vh-100 <%= controller_name %> <%= action_name %>">- <div class="container-fluid">- <div class="row justify-content-center">- <div class="col-lg-3 col-xl-2 d-none d-lg-block position-relative px-2">- <%= render "spree/admin/shared/sidebar" %>- </div>- <div class="col-lg-9 col-xl-10 px-0 pt-lg-2">- <%= render "spree/admin/shared/header" %>-- <main id="content" class="container h-100 d-flex flex-column">- <%= render "spree/admin/shared/content_header" %>-- <%= yield %>-- <%= render "spree/admin/shared/footer" %>- </main>- </div>+ <%= render "spree/admin/shared/header" %>+ <%= render "spree/admin/shared/sidebar" %>+ <main id="content">+ <div class="container">+ <%= render "spree/admin/shared/content_header" %>+ <%= yield %></div>- </div>-+ <%= render "spree/admin/shared/footer" %>+ </main><%= render "spree/admin/shared/modal" %><%= render "spree/admin/shared/alerts" %></body>diff --git a/admin/app/views/spree/admin/dashboard/_updater.html.erb b/admin/app/views/spree/admin/dashboard/_updater.html.erbnew file mode 100644index 0000000000..398493c35d--- /dev/null+++ b/admin/app/views/spree/admin/dashboard/_updater.html.erb@@ -0,0 +1,9 @@+<% if can?(:manage, current_store) && spree_update_available? %>+ <div class="alert alert-info">+ <div>+ <p class="mb-1">There's a newer version of Spree available.</p>++ <%= link_to_with_icon 'settings-up', 'Update now', 'https://spreecommerce.org/docs/developer/upgrades', target: '_blank', class: 'btn btn-light btn-sm' %>+ </div>+ </div>+<% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/dashboard/analytics.html.erb b/admin/app/views/spree/admin/dashboard/analytics.html.erbindex 0ce815a6a2..aae959b6ff 100644--- a/admin/app/views/spree/admin/dashboard/analytics.html.erb+++ b/admin/app/views/spree/admin/dashboard/analytics.html.erb@@ -76,16 +76,16 @@</div><div class="card-body p-2"><div class="tab-content">- <div data-tabs-target="panel" data-index="1">+ <div data-tabs-target="panel" data-index="1" class="animate__animated animate__fadeIn"><% if currency_money(current_currency).symbol_first? %>- <%= line_chart @grouped_orders_scope.sum(:total), prefix: currency_money(current_currency).symbol, zeros: true, library: {+ <%= line_chart @grouped_orders_scope.sum(:total), prefix: currency_money(current_currency).symbol, zeros: true, points: false, library: {animation: {duration: 300,easing: "linear"}} %>- <% else %>- <%= line_chart @grouped_orders_scope.sum(:total), suffix: currency_money(current_currency).symbol, zeros: true, library: {+ <% else %>+ <%= line_chart @grouped_orders_scope.sum(:total), suffix: currency_money(current_currency).symbol, zeros: true, points: false, library: {animation: {duration: 300,easing: "linear"@@ -93,20 +93,20 @@} %><% end %></div>- <div data-tabs-target="panel" data-index="2">- <%= line_chart @grouped_orders_scope.average(:total), suffix: currency_money(current_currency).symbol, zeros: true %>+ <div data-tabs-target="panel" data-index="2" class="animate__animated animate__fadeIn">+ <%= line_chart @grouped_orders_scope.average(:total), suffix: currency_money(current_currency).symbol, zeros: true, points: false %></div>- <div data-tabs-target="panel" data-index="3">- <%= line_chart @grouped_orders_scope.count %>+ <div data-tabs-target="panel" data-index="3" class="animate__animated animate__fadeIn">+ <%= line_chart @grouped_orders_scope.count, points: false %></div><% if @visits %>- <div data-tabs-target="panel" data-index="4">- <%= line_chart @visits.count %>+ <div data-tabs-target="panel" data-index="4" class="animate__animated animate__fadeIn">+ <%= line_chart @visits.count, points: false %></div><% end %><% if @audience %>- <div data-tabs-target="panel" data-index="5">- <%= line_chart @audience.count %>+ <div data-tabs-target="panel" data-index="5" class="animate__animated animate__fadeIn">+ <%= line_chart @audience.count, points: false %></div><% end %></div>diff --git a/admin/app/views/spree/admin/dashboard/show.html.erb b/admin/app/views/spree/admin/dashboard/show.html.erbindex f049b613fc..685128f82d 100644--- a/admin/app/views/spree/admin/dashboard/show.html.erb+++ b/admin/app/views/spree/admin/dashboard/show.html.erb@@ -26,6 +26,7 @@<% if defined?(current_vendor) && current_vendor %><%= render 'spree/admin/shared/vendor_faq' %><% else %>+ <%= render 'updater' %><%= render 'store_preview' %><%= render 'vendors' if defined?(Spree::Vendor) %><% end %>diff --git a/admin/app/views/spree/admin/oauth_applications/index.html.erb b/admin/app/views/spree/admin/oauth_applications/index.html.erbindex dcb3fc5157..b16d7b22c2 100644--- a/admin/app/views/spree/admin/oauth_applications/index.html.erb+++ b/admin/app/views/spree/admin/oauth_applications/index.html.erb@@ -69,7 +69,7 @@</div><% else %><div class="text-muted p-5 d-flex align-items-center w-100 justify-content-center">- <%= Spree.t(:no_resource_found, resource: 'API keys') %>,- <%= link_to_with_icon('plus', Spree.t(:add_one), new_object_url, class: 'btn btn-link') if can? :create, Spree::OauthApplication %>+ <%= Spree.t(:no_resource_found, resource: 'API keys') %>+ <%= link_to_with_icon('plus', Spree.t(:add_one), new_object_url, class: 'btn btn-link ml-3') if can? :create, Spree::OauthApplication %></div><% end %>diff --git a/admin/app/views/spree/admin/orders/_header.html.erb b/admin/app/views/spree/admin/orders/_header.html.erbindex 97d6fe600c..41a7183b83 100644--- a/admin/app/views/spree/admin/orders/_header.html.erb+++ b/admin/app/views/spree/admin/orders/_header.html.erb@@ -5,10 +5,10 @@<%= page_header_back_button spree.edit_admin_order_path(@order) %><% end %><%= @order.number %>- <%= order_payment_state(@order, class: "ml-3") %>- <%= order_shipment_state(@order, class: "ml-3") %>+ <%= order_payment_state(@order) %>+ <%= order_shipment_state(@order) %><% if @order.completed? %>- <span class="text-muted font-size-sm font-weight-normal with-tip ml-3">+ <span class="text-muted font-size-sm font-weight-normal with-tip"><%= I18n.t('activerecord.attributes.spree/order.completed_at') %><%= local_time(@order.completed_at) %></span>diff --git a/admin/app/views/spree/admin/products/_edit_page_title.html.erb b/admin/app/views/spree/admin/products/_edit_page_title.html.erbindex 0bfce334a1..231da9145f 100644--- a/admin/app/views/spree/admin/products/_edit_page_title.html.erb+++ b/admin/app/views/spree/admin/products/_edit_page_title.html.erb@@ -1,3 +1,3 @@<%= page_header_back_button spree.admin_products_path, @product %>-<span class="mr-3"><%= @product.name %></span>-<span class="mr-3"><%= product_status(@product) %></span>+<%= @product.name %>+<%= product_status(@product) %>diff --git a/admin/app/views/spree/admin/profile/edit.html.erb b/admin/app/views/spree/admin/profile/edit.html.erbindex 45da6cd912..ff45242628 100644--- a/admin/app/views/spree/admin/profile/edit.html.erb+++ b/admin/app/views/spree/admin/profile/edit.html.erb@@ -12,15 +12,15 @@<div class="card-body"><div class="form-group mb-4"><%= f.label :email, class: 'form-label' %>- <%= f.email_field :email, class: 'form-control', disabled: true %>+ <%= f.email_field :email, class: 'form-control', required: true %></div><div class="form-group mb-4"><%= f.label :first_name, class: 'form-label' %>- <%= f.text_field :first_name, class: 'form-control' %>+ <%= f.text_field :first_name, class: 'form-control', required: true %></div><div class="form-group mb-4"><%= f.label :last_name, class: 'form-label' %>- <%= f.text_field :last_name, class: 'form-control' %>+ <%= f.text_field :last_name, class: 'form-control', required: true %></div><div class="form-group mb-0"><div>diff --git a/admin/app/views/spree/admin/shared/_content_header.html.erb b/admin/app/views/spree/admin/shared/_content_header.html.erbindex d5bc17cfba..02cc5b711d 100644--- a/admin/app/views/spree/admin/shared/_content_header.html.erb+++ b/admin/app/views/spree/admin/shared/_content_header.html.erb@@ -7,8 +7,8 @@<% end if show_record_subtitle && !content_for(:page_subtitle) %><% if content_for?(:page_title) %>- <div class="pt-3 pb-4 d-flex align-items-center" id="page-header">- <h3 class="page-header-title mb-0 d-flex align-items-center">+ <header id="page-header">+ <h3 class="page-header-title mb-0 d-flex align-items-center gap-3"><%= yield :page_title %></h3><div id="page_actions" class="ml-auto page-actions d-flex align-items-center gap-2">@@ -24,7 +24,7 @@<%= yield :page_actions if content_for?(:page_actions) %><% if show_record_subtitle || content_for(:page_actions_dropdown) %><div class="dropdown ml-2 h-100" id="page_actions_dropdown">- <%= link_to '#', class: 'btn btn-light bg-transparent h-100 dropdown-toggle', data: { toggle: 'dropdown' }, id: 'more-actions-link' do %>+ <%= link_to '#', class: 'btn btn-light bg-transparent h-100 dropdown-toggle btn-sm', data: { toggle: 'dropdown' }, id: 'more-actions-link' do %><span class="d-none d-lg-inline mr-2"><%= Spree.t(:more_actions) %></span>@@ -59,8 +59,9 @@</div><% end %></div>- </div>+ </header><% end %>+<% if content_for?(:page_tabs) %><ul class="nav nav-bare flex-nowrap overflow-auto w-100 mb-3"><%= yield :page_tabs %>diff --git a/admin/app/views/spree/admin/shared/_sidebar.html.erb b/admin/app/views/spree/admin/shared/_sidebar.html.erbindex f7ee2ad765..c982fab299 100644--- a/admin/app/views/spree/admin/shared/_sidebar.html.erb+++ b/admin/app/views/spree/admin/shared/_sidebar.html.erb@@ -1,24 +1,13 @@-<div class="bg-gray-900 border-dark w-100 d-flex flex-column sticky-top mx-0 px-0 rounded-lg overflow-hidden mt-2 shadow-xs px-2"- style="height: 98vh; top: 0.5rem"- id="main-sidebar">-- <div class="d-none d-lg-block border-bottom border-dark position-sticky z-index-1000 top-0 mb-2">- <% if defined?(current_vendor) && current_vendor.present? %>- <%= render 'spree/admin/shared/sidebar/vendor_dropdown' %>- <% else %>- <%= render 'spree/admin/shared/sidebar/store_dropdown' %>- <% end %>- </div>+<aside id="main-sidebar">+ <% if defined?(current_vendor) && current_vendor.present? %>+ <%= render 'spree/admin/shared/sidebar/vendor_dropdown' %>+ <%= render 'spree/admin/shared/sidebar/vendor_nav' %>+ <% else %>+ <%= render 'spree/admin/shared/sidebar/store_nav' %>+ <% end %>- <div class="overflow-y-auto d-flex flex-column h-100" style="overflow-y: auto; overflow-x: hidden">- <% if defined?(current_vendor) && current_vendor.present? %>- <%= render 'spree/admin/shared/sidebar/vendor_nav' %>- <% else %>- <%= render 'spree/admin/shared/sidebar/store_nav' %>- <% end %>- </div>-- <div class="position-sticky d-none d-lg-block w-100 z-index-1000 mt-auto py-2 bottom-0">+ <section class="position-sticky d-none d-lg-block w-100 z-index-1000 mt-auto py-2 bottom-0">+ <%= render 'spree/admin/shared/sidebar/enterprise_edition_notice' %><%= render 'spree/admin/shared/user_dropdown' %>- </div>-</div>\ No newline at end of file+ </section>+</aside>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/_user_dropdown.html.erb b/admin/app/views/spree/admin/shared/_user_dropdown.html.erbindex 9dead386e0..22cd93d418 100644--- a/admin/app/views/spree/admin/shared/_user_dropdown.html.erb+++ b/admin/app/views/spree/admin/shared/_user_dropdown.html.erb@@ -1,18 +1,18 @@<% if try_spree_current_user.present? %>- <div class="position-relative dropdown dropdown-dark rounded" id="<%= dom_id(try_spree_current_user, 'account-dropdown') %>" data-turbo-permanent>+ <div class="dropdown bg-gray-25" id="<%= dom_id(try_spree_current_user, 'account-dropdown') %>" data-turbo-permanent><button type="button"- class="btn btn-dark d-flex align-items-center justify-content-between text-left w-100 border-transparent"+ class="btn d-flex align-items-center justify-content-between text-left w-100"data-toggle="dropdown" aria-expanded="false" id="accountNav"><div class="d-flex align-items-center"><%= image_tag(avatar_url_for(try_spree_current_user), width: 34, height: 34, class: 'rounded-circle mr-lg-2') %>- <span class="d-none d-lg-inline text-white">+ <span class="d-none d-lg-inline"><%= try_spree_current_user.name&.full&.truncate(15)&.presence || try_spree_current_user.email.truncate(15) %><br /><span class="text-muted small"><%= try_spree_current_user.email.truncate(22) %></span></span></div><%= icon 'dots-vertical', class: 'mr-0 ml-2 mb-0 d-none d-lg-block' %></button>- <div class="dropdown-menu dropdown-menu-dark dropdown-menu-right w-100 mb-1 mt-1 mt-lg-0">+ <div class="dropdown-menu dropdown-menu-right w-100 mb-1 mt-1 mt-lg-0"><%= link_to_with_icon 'user-scan', Spree.t('admin.edit_profile'), spree.edit_admin_profile_path, class: 'dropdown-item' %><% if enterprise_edition? && try_spree_current_user.respond_to?(:accounts) && try_spree_current_user.accounts.count > 1 %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erb b/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erbnew file mode 100644index 0000000000..b960b55d71--- /dev/null+++ b/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erb@@ -0,0 +1,10 @@+<% if can?(:manage, current_store) && !enterprise_edition? %>+ <% unless session[:spree_enterprise_edition_notice_dismissed] %>+ <div id="enterprise-edition-notice">+ <%= link_to '', spree.admin_dismiss_enterprise_edition_notice_path, method: :patch, class: 'btn-close' %>+ <p class="mb-1">You're using Spree Community Edition. To get access to all features, please upgrade to Enterprise Edition.</p>++ <%= external_link_to 'Upgrade', 'https://spreecommerce.org/pricing', target: '_blank', class: 'btn btn-link btn-sm shadow-xs' %>+ </div>+ <% end %>+<% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erbindex 7ae117ffda..ff4ae5ac0d 100644--- a/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb@@ -1,7 +1,7 @@<% orders_active = %[orders checkouts].include?(controller_name) || @order %><li class="nav-item">- <%= active_link_to spree.admin_orders_path, class: 'nav-link d-flex align-items-center', active: orders_active do %>- <%= icon 'inbox', class: 'mr-1' %>+ <%= active_link_to spree.admin_orders_path, class: 'nav-link', active: orders_active do %>+ <%= icon 'inbox' %><%= Spree.t(:orders) %><% if ready_to_ship_orders_count&.positive? %>@@ -11,10 +11,10 @@<% end %><% end %><% if orders_active && (ready_to_ship_orders_count&.positive? || can?(:manage, :checkouts)) %>- <ul class="ml-4 pl-1 mb-2 nav-submenu flex-column mt-1">+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><% if ready_to_ship_orders_count&.positive? %><li class="nav-item">- <%= active_link_to spree.admin_orders_path(q: {shipment_state_not_in: [:shipped, :canceled]}), class: 'nav-link d-flex align-items-center', active: params.dig(:q, :shipment_state_not_in).present? do %>+ <%= active_link_to spree.admin_orders_path(q: {shipment_state_not_in: [:shipped, :canceled]}), class: 'nav-link', active: params.dig(:q, :shipment_state_not_in).present? do %><span><%= Spree.t('admin.orders.orders_to_fulfill') %></span><span class="badge ml-auto"><%= ready_to_ship_orders_count %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erbindex b4b2561506..6ff09de742 100644--- a/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb@@ -7,31 +7,31 @@<%= Spree.t(:products) %><% end %><% if products_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu flex-column mt-1">+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><% if can?(:manage, Spree::StockItem) || can?(:manage, Spree::StockTransfer) %><li class="nav-item">- <%= active_link_to Spree.t(:stock), spree.admin_stock_items_path, class: 'nav-link py-lg-1', active: %w[stock_items stock_transfers].include?(controller_name) %>+ <%= active_link_to Spree.t(:stock), spree.admin_stock_items_path, class: 'nav-link', active: %w[stock_items stock_transfers].include?(controller_name) %></li><% end %><% if can?(:manage, Spree::Taxonomy) %><li class="nav-item">- <%= active_link_to Spree.t(:taxonomies), spree.admin_taxonomies_path, class: 'nav-link py-lg-1' %>+ <%= active_link_to Spree.t(:taxonomies), spree.admin_taxonomies_path, class: 'nav-link' %></li><% end %><% if can?(:manage, Spree::OptionType) %><li class="nav-item">- <%= active_link_to Spree.t(:options), spree.admin_option_types_path, class: 'nav-link py-lg-1', active: %w[option_types option_values].include?(controller_name) %>+ <%= active_link_to Spree.t(:options), spree.admin_option_types_path, class: 'nav-link', active: %w[option_types option_values].include?(controller_name) %></li><% end %><% if can?(:manage, Spree::Property) %><li class="nav-item">- <%= active_link_to Spree.t(:properties), spree.admin_properties_path, class: 'nav-link py-lg-1' %>+ <%= active_link_to Spree.t(:properties), spree.admin_properties_path, class: 'nav-link' %></li><% end %><% if defined?(Spree::ExternalCategory) && can?(:manage, Spree::ExternalCategory) %><li class="nav-item">- <%= active_link_to 'Category mapper', spree.admin_external_categories_path, class: 'nav-link py-lg-1' %>+ <%= active_link_to 'Category mapper', spree.admin_external_categories_path, class: 'nav-link' %></li><% end %></ul>diff --git a/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erbindex 49a32095f0..3a9e6c17f6 100644--- a/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb@@ -2,13 +2,13 @@<% if can?(:manage, :customer_returns) || can?(:manage, :return_authorizations) %><li class="nav-item">- <%= active_link_to spree.admin_customer_returns_path, class: 'nav-link d-flex align-items-center', active: returns_active do %>- <%= icon 'receipt-refund', class: 'mr-1' %>+ <%= active_link_to spree.admin_customer_returns_path, class: 'nav-link', active: returns_active do %>+ <%= icon 'receipt-refund' %><%= Spree.t(:returns) %><% end %><% if returns_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu flex-column mt-1">+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><% if can?(:manage, :return_authorizations) %><li class="nav-item"><%= active_link_to Spree.t(:return_authorizations), spree.admin_return_authorizations_path, class: 'nav-link' %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb b/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erbindex ee1813d7d6..3b4f4da54c 100644--- a/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_store_dropdown.html.erb@@ -1,44 +1,58 @@-<div class="position-relative dropdown dropdown-dark my-lg-2 rounded" id="store-menu" data-turbo-permanent>- <button type="button"- class="btn border-dark rounded border-0 text-white d-flex align-items-center justify-content-between text-left w-100 shadow-none p-2 font-size-plus"- data-toggle="dropdown" aria-expanded="false">- <span class="d-flex align-items-center font-weight-bold">- <%= store_admin_icon(current_store) %>+<div class="border-bottom border-bottom-dashed pb-2 d-flex align-items-center justify-content-between pr-1" id="store-menu" data-turbo-permanent>+ <div class="dropdown">+ <button type="button" class="btn d-flex align-items-center justify-content-between text-left dropdown-toggle d-flex align-items-center gap-2"+ data-toggle="dropdown" aria-expanded="false">+ <%= store_admin_icon(current_store, height: 32, width: 32) %><span class="d-none d-lg-block">- <span>- <%= truncate(current_store.name, length: 15) %>- </span>- <br />+ <%= truncate(current_store.name, length: 15) %></span>- </span>- <%= icon 'selector', class: 'mr-0 ml-2 mb-0 text-muted' %>- </button>- <div class="dropdown-menu w-100 font-size-plus" style="min-width: 200px">- <%= link_to current_store.formatted_url_or_custom_domain, class: 'dropdown-item', target: '_blank' do %>- <%= icon 'eye' %>- <%= Spree.t(:view_store) %>- <% end %>- <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'dropdown-item' do %>- <%= icon 'tools' %>- <%= Spree.t('admin.edit_theme') %>- <% end if current_store.default_theme %>+ </button>+ <div class="dropdown-menu">+ <%= link_to current_store.formatted_url_or_custom_domain, class: 'dropdown-item', target: '_blank' do %>+ <%= icon 'eye' %>+ <%= Spree.t(:view_store) %>+ <% end %>+ <%= link_to spree.edit_admin_theme_path(current_store.default_theme), class: 'dropdown-item' do %>+ <%= icon 'tools' %>+ <%= Spree.t('admin.edit_theme') %>+ <% end if current_store.default_theme %>++ <% if available_stores.count > 1 %>+ <div class="dropdown-header">+ <%= Spree.t(:switch_store) %>+ </div>+ <% available_stores.each do |store| %>+ <% next if store.id == current_store.id %>+ <%= link_to store.name, spree.admin_dashboard_url(host: store.url), class: 'dropdown-item' %>+ <% end %>++ <div class="dropdown-divider"></div>+ <% end %>+ </div>+ </div>- <div class="dropdown-divider"></div>+ <div class="dropdown">+ <button type="button" class="btn btn-sm btn-light shadow-xs" data-toggle="dropdown" aria-expanded="false">+ <%= icon 'plus', class: 'mr-0' %>+ </button>+ <div class="dropdown-menu">+ <%= link_to_with_icon 'shopping-cart', Spree.t(:new_order), spree.admin_orders_path, class: "dropdown-item", data: { turbo_method: :post } if can?(:create, Spree::Order) %>- <% if available_stores.count > 1 %>- <div class="dropdown-header">- <%= Spree.t(:switch_store) %>- </div>- <% available_stores.each do |store| %>- <% next if store.id == current_store.id %>- <%= link_to store.name, spree.admin_dashboard_url(host: store.url), class: 'dropdown-item' %>+ <%= link_to spree.new_admin_product_path, class: 'dropdown-item' do %>+ <%= icon 'box' %>+ <%= Spree.t(:new_product) %>+ <% end %>+ <%= link_to spree.new_admin_user_path, class: 'dropdown-item' do %>+ <%= icon 'user' %>+ <%= Spree.t(:new_user) %><% end %><div class="dropdown-divider"></div>- <% end %>- <span data-toggle="modal" data-target="#modal-lg">- <%= link_to_with_icon 'plus', Spree.t(:new_store), spree.new_admin_store_path, class: 'dropdown-item', data: { turbo_frame: 'dialog_modal_lg' } %>- </so>+ <span data-toggle="modal" data-target="#modal-lg">+ <%= link_to_with_icon 'building-store', Spree.t(:new_store), spree.new_admin_store_path, class: 'dropdown-item', data: { turbo_frame: 'dialog_modal_lg' } %>+ </span>+ </div></div></div>+diff --git a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erbindex 6fb44e32e7..c1c9e8928c 100644--- a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb@@ -5,9 +5,9 @@custom_domains audits exports imports return_authorization_reasonsdocuments stripe_tax_registrations members subscriptions stock_locations webhooks_subscribers].include?(controller_name) %><% if settings_active %>- <ul class="nav nav-dark flex-column">+ <ul class="nav flex-column"><li class="nav-item mb-3">- <%= active_link_to_with_icon('chevron-left', Spree.t(:settings), spree.admin_dashboard_path, class: 'nav-link') %>+ <%= active_link_to_with_icon('chevron-left', Spree.t('admin.back_to_dashboard'), spree.admin_dashboard_path, class: 'nav-link') %></li><li class="nav-item">@@ -66,7 +66,7 @@<%= icon 'history' %><%= Spree.t('admin.audit_log') %>- <span class="badge badge-dark ml-auto with-tip rounded-pill" title="This feature is part of the Enterprise Edition.">Enterprise</span>+ <span class="badge ml-auto with-tip rounded-pill" title="This feature is part of the Enterprise Edition.">Enterprise</span><% end %></li><% end %>@@ -75,7 +75,9 @@</li></ul><% else %>- <ul class="nav nav-dark flex-column">+ <%= render 'spree/admin/shared/sidebar/store_dropdown' %>++ <ul class="nav flex-column"><% unless current_store.setup_completed? %><li class="nav-item"><%= active_link_to spree.admin_getting_started_path, class: 'nav-link' do %>@@ -115,9 +117,9 @@<% end %><% if discounts_active && defined?(Spree::GiftCard) && spree.respond_to?(:admin_gift_cards_path) && can?(:manage, Spree::GiftCard) %>- <ul class="ml-4 pl-1 mb-2 nav-submenu flex-column mt-1">+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><li class="nav-item">- <%= active_link_to Spree.t(:gift_cards), spree.admin_gift_cards_path, class: 'nav-link py-lg-1', active: %w[gift_cards gift_card_batches].include?(controller_name) %>+ <%= active_link_to Spree.t(:gift_cards), spree.admin_gift_cards_path, class: 'nav-link', active: %w[gift_cards gift_card_batches].include?(controller_name) %></li></ul><% end %>@@ -134,11 +136,8 @@<% end %><%= render 'spree/admin/shared/sidebar/custom_nav' %>- </ul>-- <ul class="nav nav-dark flex-column mt-4 mb-3">- <div class="text-uppercase small ml-2 mb-1 text-muted">Channels & Apps</div><%= render 'spree/admin/shared/sidebar/storefront_nav' %>+<% if spree.respond_to?(:admin_emails_path) %><li class="nav-item"><%= active_link_to_with_icon('send', Spree.t(:emails), spree.admin_emails_path, class: 'nav-link') %>@@ -151,36 +150,18 @@<span class="nav-link d-flex align-items-center pr-1 cursor-default with-tip" title="Connect your store to third-party services to automate your business processes."><%= icon 'plug' %><span><%= Spree.t(:integrations) %></span>- <span class="badge badge-dark ml-auto rounded-pill">Coming soon!</span>+ <span class="badge ml-auto rounded-pill">Coming soon!</span></span></li><% end %>- </ul>- <ul class="nav nav-dark flex-column mt-auto mb-3" id="settings-nav" data-turbo-permanent>- <div class="text-uppercase small ml-2 mb-1 text-muted"><%= Spree.t(:settings) %></div><% if defined?(current_account) && current_account.present? %><li class="nav-item"><%= active_link_to_with_icon 'users', Spree.t(:account_members), main_app.account_members_path(current_account), class: 'nav-link' %></li><% end %>- <li class="nav-item">+ <li class="nav-item border-top border-top-dashed pt-2"><%= active_link_to_with_icon('settings', Spree.t(:settings), spree.edit_admin_store_path(section: 'general-settings'), class: 'nav-link', active: params[:section] == 'general-settings') %></li></ul>-- <% if can?(:manage, current_store) && spree_update_available? %>- <%= link_to_with_icon 'arrow-up', 'New updates available', 'https://spreecommerce.org/docs/developer/upgrades', class: 'btn btn-dark w-100 py-1', target: '_blank' %>- <% end %>-- <% if can?(:manage, current_store) && !enterprise_edition? %>- <div class="nav nav-dark flex-column mt-2" id="plan-nav" data-turbo-permanent>- <div class="bg-transparent border-top border-dark pt-2 pl-2 d-flex align-items-center justify-content-between">- <span class="font-weight-light font-size-sm text-white with-tip text-muted" title="Spree v<%= Spree.version %>">- Community Edition- </span>- <%= link_to_with_icon 'bolt', 'Upgrade', 'https://spreecommerce.org/pricing/', class: 'btn btn-sm btn-dark with-tip', target: '_blank', title: 'Upgrade to Enterprise Edition to access more features, such as multi-store management, B2B, multi-vendor marketplace, and more.' %>- </div>- </div>- <% end %><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erbindex 264bb8a285..e004f4134c 100644--- a/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb@@ -3,7 +3,7 @@<%= active_link_to_with_icon('building-store', Spree.t('admin.storefront'), spree.admin_themes_path, class: 'nav-link', active: storefront_active) %><% if storefront_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu flex-column mt-1">+ <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1"><li class="nav-item"><%= active_link_to Spree.t(:themes), spree.admin_themes_path, class: 'nav-link' %></li>diff --git a/admin/app/views/spree/admin/shared/sidebar/_vendors_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_vendors_nav.html.erbindex 84d4dd6c5c..89066a090d 100644--- a/admin/app/views/spree/admin/shared/sidebar/_vendors_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_vendors_nav.html.erb@@ -3,6 +3,6 @@<%= icon 'heart-handshake' %><%= Spree.t(:vendors) %>- <span class="badge badge-dark ml-auto with-tip rounded-pill" title="This feature is part of the Enterprise Edition.">Enterprise</span>+ <span class="badge ml-auto with-tip rounded-pill" title="This feature is part of the Enterprise Edition.">Enterprise</span><% end %></li>\ No newline at end of filediff --git a/admin/config/locales/en.yml b/admin/config/locales/en.ymlindex 801f123f33..ca5b1e3629 100644--- a/admin/config/locales/en.yml+++ b/admin/config/locales/en.yml@@ -6,6 +6,7 @@ en:amount_spent: Amount spentaudit_log: Audit Logavg_order_value: Avg. Order Value+ back_to_dashboard: Back to Dashboardbulk_ops:products:body:diff --git a/admin/config/routes.rb b/admin/config/routes.rbindex 80e85fc753..51f5c0ab0d 100644--- a/admin/config/routes.rb+++ b/admin/config/routes.rb@@ -231,6 +231,7 @@ Spree::Core::Engine.add_routes doresource :dashboard, controller: 'dashboard'get '/dashboard/analytics', to: 'dashboard#analytics', as: :dashboard_analyticsget '/getting-started', to: 'dashboard#getting_started', as: :getting_started+ get '/dismiss_enterprise_edition_notice', to: 'dashboard#dismiss_enterprise_edition_notice', as: :dismiss_enterprise_edition_noticeroot to: 'dashboard#show'enddiff --git a/admin/spec/controllers/spree/admin/dashboard_controller_spec.rb b/admin/spec/controllers/spree/admin/dashboard_controller_spec.rbindex 107e128d81..de5f750d77 100644--- a/admin/spec/controllers/spree/admin/dashboard_controller_spec.rb+++ b/admin/spec/controllers/spree/admin/dashboard_controller_spec.rb@@ -46,4 +46,12 @@ describe Spree::Admin::DashboardController, type: :controller doexpect(response).to render_template(:getting_started)endend++ describe '#dismiss_enterprise_edition_notice' do+ it 'dismisses the enterprise edition notice' do+ patch :dismiss_enterprise_edition_notice+ expect(response).to redirect_to(spree.admin_dashboard_path)+ expect(session[:spree_enterprise_edition_notice_dismissed]).to be_truthy+ end+ endend