solidus_backend 4.2.3 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/solidus_backend_manifest.js +1 -3
  3. data/app/assets/stylesheets/spree/backend/components/_hint.scss +4 -0
  4. data/app/assets/stylesheets/spree/backend/components/_messages.scss +4 -11
  5. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +19 -2
  6. data/app/assets/stylesheets/spree/backend/components/_navigation_solidus_admin.scss +26 -5
  7. data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +0 -6
  8. data/app/assets/stylesheets/spree/backend/shared/_tables.scss +5 -0
  9. data/app/assets/stylesheets/spree/backend/themes/classic_dark.css.scss +16 -0
  10. data/app/assets/stylesheets/spree/backend/themes/classic_dimmed.css.scss +16 -0
  11. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_tables.scss +2 -0
  12. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_variables.scss +17 -6
  13. data/app/assets/stylesheets/spree/backend/themes/solidus_admin.css.scss +1 -0
  14. data/app/assets/stylesheets/spree/backend/themes/solidus_admin_dark.css.scss +16 -0
  15. data/app/assets/stylesheets/spree/backend/themes/solidus_admin_dimmed.css.scss +16 -0
  16. data/app/controllers/spree/admin/adjustments_controller.rb +1 -1
  17. data/app/controllers/spree/admin/locale_controller.rb +8 -2
  18. data/app/controllers/spree/admin/orders_controller.rb +2 -2
  19. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  20. data/app/controllers/spree/admin/products_controller.rb +2 -2
  21. data/app/controllers/spree/admin/theme_controller.rb +30 -0
  22. data/app/views/spree/admin/images/_image_row.html.erb +1 -5
  23. data/app/views/spree/admin/promotions/rules/_minimum_quantity.html.erb +5 -0
  24. data/app/views/spree/admin/shared/_head.html.erb +2 -1
  25. data/app/views/spree/admin/shared/_js_locale_data.html.erb +3 -3
  26. data/app/views/spree/admin/shared/_locale_selection.html.erb +13 -15
  27. data/app/views/spree/admin/shared/_locale_selection_solidus_admin.html.erb +17 -0
  28. data/app/views/spree/admin/shared/_navigation.html.erb +1 -0
  29. data/app/views/spree/admin/shared/_navigation_solidus_admin.html.erb +3 -27
  30. data/app/views/spree/admin/shared/_theme_selection.html.erb +21 -0
  31. data/app/views/spree/admin/shared/_theme_selection_solidus_admin.html.erb +25 -0
  32. data/config/routes.rb +1 -0
  33. data/lib/spree/backend.rb +0 -1
  34. data/lib/spree/backend_configuration.rb +12 -3
  35. data/solidus_backend.gemspec +0 -1
  36. metadata +16 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6267a01ab8a45958e1f7df1632238e14de1544ac777187e7e2eaa58d36ec054
4
- data.tar.gz: 01b2e9db90f1474080ede9a684eda4b5fc958fbba0899c6a1fc32bea8a3b8b9f
3
+ metadata.gz: 855db55d75a9f15861129db90e9f74f7ac4785118361326751e131593b51ed3c
4
+ data.tar.gz: 2a1845cee94fff5ec8a8b6be562d8bbb4be814739fbf246994f6f7f9b7660b3d
5
5
  SHA512:
6
- metadata.gz: b6017f2fa9ea50ca39efaf4e1110236404be68cd5a06b318804ffae31e53d634fa27de2d1acc655fc0e20472335384baba4d49bd6e3c05ab858356a3df17038f
7
- data.tar.gz: 1c62f8dbc04d83d7a90d3e0b1034a6bf2c48e740859a21891d28348cc1cda0c590cd9f9407a85055fa6d4e0981a37820c2b05ec9948be3b6bb1eb535706132ee
6
+ metadata.gz: 4a2c9a211255502d6ffcd5217de8ed1797f728b5f35684cc5cab9e36548fa3575af695d4add1d18d3c26cfb22c5b43e4275fecec21438d5918ec2c28fa3a142c
7
+ data.tar.gz: 3f4ebcfaf5f21bac101e9dcc64f3fc19c8886cdb0f113a4981176b130f8f9e3a970ab9e0cc3763f91bf92ea7a6675ee743722d1ef98b44bb73015e47fbc0fc78
@@ -1,9 +1,7 @@
1
1
  //= link_tree ../images
2
+ //= link_tree "../stylesheets/spree/backend/themes" .css
2
3
 
3
4
  //= link spree/backend/all.js
4
5
  //= link spree/backend/all.css
5
6
 
6
7
  //= link solidus_admin/select2_locales
7
-
8
- //= link spree/backend/themes/classic.css
9
- //= link spree/backend/themes/solidus_admin.css
@@ -1,3 +1,7 @@
1
1
  .hint-tooltip {
2
2
  cursor: pointer;
3
+
4
+ i {
5
+ color: $color-dark-light;
6
+ }
3
7
  }
@@ -25,35 +25,28 @@
25
25
  }
26
26
 
27
27
  .flash-wrapper {
28
+ bottom: 20px;
29
+ max-width: 320px;
28
30
  position: fixed;
29
- bottom: 0;
30
- left: $width-sidebar;
31
- right: 0;
31
+ right: 20px;
32
32
  z-index: 1000;
33
-
34
- .admin-nav-hidden & {
35
- left: $width-sidebar-collapsed;
36
- }
37
33
  }
38
34
 
39
35
  .flash {
40
- border-top: 3px solid;
41
36
  padding: 16px;
37
+ border-radius: 4px;
42
38
  text-align: center;
43
39
  font-size: 120%;
44
40
  color: $body-color;
45
41
 
46
42
  &.notice {
47
43
  background-color: rgba(theme-color-level(warning, -8), .95);
48
- border-top-color: theme-color(warning);
49
44
  }
50
45
  &.success {
51
46
  background-color: rgba(theme-color-level(success, -10), .95);
52
- border-top-color: theme-color(success);
53
47
  }
54
48
  &.error {
55
49
  background-color: rgba(theme-color-level(danger, -8), .95);
56
- border-top-color: theme-color(danger);
57
50
  }
58
51
  }
59
52
 
@@ -122,6 +122,22 @@ nav.menu {
122
122
  @media print {
123
123
  display: none
124
124
  }
125
+
126
+
127
+ .dark-only {
128
+ display: none;
129
+ @media (prefers-color-scheme: dark) {
130
+ display: block;
131
+ }
132
+ }
133
+
134
+ .light-only {
135
+ display: block;
136
+ @media (prefers-color-scheme: dark) {
137
+ display: none;
138
+ }
139
+ }
140
+
125
141
  }
126
142
 
127
143
  .admin-nav-header {
@@ -301,7 +317,8 @@ nav.menu {
301
317
  }
302
318
 
303
319
  .admin-navbar-selection {
304
- margin: 0 1.5em;
320
+ padding: 0 1.5em;
321
+ width: 100%;
305
322
  position: relative;
306
323
  overflow: hidden;
307
324
  display: inline-flex;
@@ -323,7 +340,7 @@ nav.menu {
323
340
  padding: .5rem 0 .5rem .25rem;
324
341
  }
325
342
 
326
- .admin-nav-hidden & {
343
+ .admin-nav-hidden & {
327
344
  position: relative;
328
345
 
329
346
  select {
@@ -4,7 +4,7 @@ $color-navbar-hover: $color-navbar !default;
4
4
  @import "spree/backend/components/switch_solidus_admin";
5
5
 
6
6
  .solidus-admin--nav {
7
- background-color: $color-light;
7
+ background-color: $solidus-admin-gray-15;
8
8
  position: sticky;
9
9
  top: 0;
10
10
  bottom: 0;
@@ -19,6 +19,20 @@ $color-navbar-hover: $color-navbar !default;
19
19
  min-height: 100vh;
20
20
  border-right: $color-light-accent 1px solid;
21
21
 
22
+ .dark-only {
23
+ display: none;
24
+ @media (prefers-color-scheme: dark) {
25
+ display: block;
26
+ }
27
+ }
28
+
29
+ .light-only {
30
+ display: none;
31
+ @media (prefers-color-scheme: light) {
32
+ display: block;
33
+ }
34
+ }
35
+
22
36
  &--wrapper {
23
37
  position: absolute;
24
38
  top: 0;
@@ -79,7 +93,7 @@ $color-navbar-hover: $color-navbar !default;
79
93
  }
80
94
 
81
95
  &--name {
82
- line-height: 24px;
96
+ line-height: 20px;
83
97
  font-size: 14px;
84
98
  font-weight: 600;
85
99
  color: $color-dark;
@@ -87,7 +101,7 @@ $color-navbar-hover: $color-navbar !default;
87
101
  }
88
102
 
89
103
  &--url {
90
- line-height: 20px;
104
+ line-height: 16px;
91
105
  font-size: 12px;
92
106
  font-weight: 400;
93
107
  color: $color-dark-light;
@@ -106,6 +120,7 @@ $color-navbar-hover: $color-navbar !default;
106
120
  padding: 0;
107
121
  list-style: none;
108
122
  text-align: left;
123
+ margin-bottom: 12px;
109
124
 
110
125
  li {
111
126
  padding: 0;
@@ -122,20 +137,26 @@ $color-navbar-hover: $color-navbar !default;
122
137
  padding: 2px 12px;
123
138
  width: 100%;
124
139
  border-radius: $border-radius;
125
- color: $color-primary;
140
+ color: $solidus-admin-gray-800;
126
141
  gap: 12px;
127
142
  display: flex;
128
143
  align-items: center;
129
144
 
130
145
  &::before,
131
146
  svg {
132
- display: inline-block;
147
+ display: inline-flex;
148
+ align-items: center;
149
+ justify-content: center;
133
150
  width: 18px;
134
151
  height: 18px;
135
152
  padding: 0;
136
153
  }
137
154
  }
138
155
 
156
+ li > label > span {
157
+ line-height: 20px;
158
+ }
159
+
139
160
  li.selected > a {
140
161
  background: $color-navbar-active-bg;
141
162
  color: $color-navbar-active;
@@ -12,12 +12,6 @@
12
12
  }
13
13
  }
14
14
 
15
- #actions_container {
16
- .edit_promotion {
17
- margin-top: 73px;
18
- }
19
- }
20
-
21
15
  .promotion-block {
22
16
  padding: 0 1.25rem 0.5rem;
23
17
  background-color: lighten($color-border, 5);
@@ -38,6 +38,7 @@ table {
38
38
  text-align: center;
39
39
  border-bottom: none;
40
40
  vertical-align: middle;
41
+ color: $color-dark-light;
41
42
 
42
43
  &:before {
43
44
  padding: 0;
@@ -111,6 +112,10 @@ table {
111
112
 
112
113
  th a {
113
114
  color: $color-dark;
115
+
116
+ &:hover {
117
+ color: $color-dark-light;
118
+ }
114
119
  }
115
120
 
116
121
  tbody {
@@ -0,0 +1,16 @@
1
+ @import 'spree/backend/themes/classic';
2
+
3
+ html {
4
+ background-color: #fff;
5
+ color: #fff;
6
+ -webkit-filter: invert(100%);
7
+ filter: invert(100%) hue-rotate(180deg);
8
+
9
+ img {
10
+ filter: invert(100%) hue-rotate(-180deg);
11
+ }
12
+
13
+ .brand-link img {
14
+ filter: invert(0%) hue-rotate(0deg);
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ @import 'spree/backend/themes/classic';
2
+
3
+ html {
4
+ background-color: #fff;
5
+ color: #fff;
6
+ -webkit-filter: invert(85%);
7
+ filter: invert(85%) hue-rotate(180deg);
8
+
9
+ img {
10
+ filter: invert(100%) hue-rotate(-180deg);
11
+ }
12
+
13
+ .brand-link img {
14
+ filter: invert(0%) hue-rotate(0deg);
15
+ }
16
+ }
@@ -1,3 +1,5 @@
1
+ @import "./colors";
2
+
1
3
  table.index {
2
4
  // Borders
3
5
  border-collapse: separate;
@@ -19,10 +19,10 @@ $color-dark-dark: $solidus-admin-gray-600;
19
19
  $color-dark-light: $solidus-admin-gray-500;
20
20
  $color-dark-accent: $solidus-admin-gray-200;
21
21
 
22
- $color-primary: $solidus-admin-black;
22
+ $color-primary: $solidus-admin-gray-700;
23
23
  $color-primary-light: $solidus-admin-gray-100;
24
24
 
25
- $color-light: $solidus-admin-gray-15;
25
+ $color-light: $solidus-admin-gray-25;
26
26
  $color-light-dark: $solidus-admin-gray-50;
27
27
  $color-light-accent: $solidus-admin-gray-100;
28
28
 
@@ -49,10 +49,10 @@ $color-navbar-active: $solidus-admin-solidus-red;
49
49
  $color-navbar-active-bg: $solidus-admin-gray-50;
50
50
  $color-navbar-submenu: $color-dark-light;
51
51
  $color-navbar-submenu-bg: $color-light;
52
- $color-navbar-submenu-active: $color-primary;
52
+ $color-navbar-submenu-active: $solidus-admin-solidus-red;
53
53
  $color-navbar-footer: $color-dark;
54
54
  $color-navbar-footer-bg: $color-light;
55
- $color-navbar-footer-active: $color-primary;
55
+ $color-navbar-footer-active: $solidus-admin-solidus-red;
56
56
  $color-icon-navbar: $color-dark-light;
57
57
 
58
58
  $color-navbar-hover-bg: $solidus-admin-gray-50;
@@ -61,7 +61,7 @@ $color-navbar-hover: $color-dark;
61
61
  // Basic Tabs colors
62
62
  $color-tab: $color-dark-light;
63
63
  $color-tab-bg: $color-light;
64
- $color-tab-border: $color-border;
64
+ $color-tab-border: $color-light-accent;
65
65
  $color-tab-active: $color-primary;
66
66
  $color-tab-active-bg: $color-white;
67
67
  $color-tab-active-border: $color-white;
@@ -74,6 +74,7 @@ $color-error: $color-red;
74
74
  // Breadcrumb custom variable
75
75
 
76
76
  $breadcrumb-color: $color-dark-light;
77
+ $breadcrumb-active-color: $color-dark;
77
78
 
78
79
  // Color for spinner
79
80
  $color-spinner: $color-white;
@@ -157,4 +158,14 @@ $main-header-height: 84px;
157
158
  $content-wrapper-bg: $color-white;
158
159
  $admin-body-bg: $color-white;
159
160
 
160
- $link-hover-color: $solidus-admin-solidus-red;
161
+ // Links
162
+ //--------------------------------------------------------------
163
+
164
+ $link-color: $solidus-admin-blue;
165
+ $link-hover-color: darken($solidus-admin-blue, 10%);
166
+
167
+ // Pagination
168
+ //--------------------------------------------------------------
169
+
170
+ $pagination-color: $color-primary;
171
+ $pagination-hover-color: $color-dark;
@@ -1,6 +1,7 @@
1
1
  @import "spree/backend/globals";
2
2
 
3
3
  @import "./solidus_admin/variables";
4
+ @import "./solidus_admin/colors";
4
5
 
5
6
  @import "spree/backend/vendor";
6
7
  @import "spree/backend/shared";
@@ -0,0 +1,16 @@
1
+ @import "./solidus_admin";
2
+
3
+ html {
4
+ background-color: #fff;
5
+ color: #fff;
6
+ -webkit-filter: invert(100%);
7
+ filter: invert(100%) hue-rotate(180deg);
8
+
9
+ img {
10
+ filter: invert(100%) hue-rotate(-180deg);
11
+ }
12
+
13
+ .brand-link img {
14
+ filter: invert(0%) hue-rotate(0deg);
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ @import "./solidus_admin";
2
+
3
+ html {
4
+ background-color: #fff;
5
+ color: #fff;
6
+ -webkit-filter: invert(85%);
7
+ filter: invert(85%) hue-rotate(180deg);
8
+
9
+ img {
10
+ filter: invert(100%) hue-rotate(-180deg);
11
+ }
12
+
13
+ .brand-link img {
14
+ filter: invert(0%) hue-rotate(0deg);
15
+ }
16
+ }
@@ -9,7 +9,7 @@ module Spree
9
9
  destroy.after :update_totals
10
10
  update.after :update_totals
11
11
 
12
- skip_before_action :load_resource, only: [:toggle_state, :edit, :update, :destroy]
12
+ skip_before_action :load_resource, only: [:edit, :update, :destroy]
13
13
 
14
14
  before_action :find_adjustment, only: [:destroy, :edit, :update]
15
15
 
@@ -11,9 +11,15 @@ module Spree
11
11
  if locale_is_available?(requested_locale)
12
12
  I18n.locale = requested_locale
13
13
  session[set_user_language_locale_key] = requested_locale
14
- render json: { locale: requested_locale, location: spree.admin_url }
14
+ respond_to do |format|
15
+ format.json { render json: { locale: requested_locale, location: spree.admin_url } }
16
+ format.html { redirect_back_or_to spree.admin_url, notice: t('spree.locale_changed') }
17
+ end
15
18
  else
16
- render json: { locale: I18n.locale }, status: 404
19
+ respond_to do |format|
20
+ format.json { render json: { locale: I18n.locale }, status: 404 }
21
+ format.html { redirect_back_or_to spree.admin_url, error: t('spree.error') }
22
+ end
17
23
  end
18
24
  end
19
25
 
@@ -4,8 +4,8 @@ module Spree
4
4
  module Admin
5
5
  class OrdersController < Spree::Admin::BaseController
6
6
  before_action :initialize_order_events
7
- before_action :load_order, only: [:edit, :update, :complete, :advance, :cancel, :resume, :approve, :resend, :unfinalize_adjustments, :finalize_adjustments, :cart, :confirm]
8
- around_action :lock_order, only: [:update, :advance, :complete, :confirm, :cancel, :resume, :approve, :resend]
7
+ before_action :load_order, only: [:edit, :complete, :advance, :cancel, :resume, :approve, :resend, :unfinalize_adjustments, :finalize_adjustments, :cart, :confirm]
8
+ around_action :lock_order, only: [:advance, :complete, :confirm, :cancel, :resume, :approve, :resend]
9
9
 
10
10
  rescue_from Spree::Order::InsufficientStock, with: :insufficient_stock_error
11
11
  respond_to :html
@@ -28,7 +28,7 @@ module Spree
28
28
  invoke_callbacks(:update, :before)
29
29
 
30
30
  attributes = payment_method_params
31
- attributes.each do |key, _value|
31
+ attributes.each_key do |key|
32
32
  if key.include?("password") && attributes[key].blank?
33
33
  attributes.delete(key)
34
34
  end
@@ -68,7 +68,7 @@ module Spree
68
68
  if updating_variant_property_rules?
69
69
  url_params = {}
70
70
  url_params[:ovi] = []
71
- params[:product][:variant_property_rules_attributes].each do |_index, param_attrs|
71
+ params[:product][:variant_property_rules_attributes].each_value do |param_attrs|
72
72
  url_params[:ovi] += param_attrs[:option_value_ids]
73
73
  end
74
74
  spree.admin_product_product_properties_url(@product, url_params)
@@ -133,7 +133,7 @@ module Spree
133
133
  def normalize_variant_property_rules
134
134
  return unless updating_variant_property_rules?
135
135
 
136
- params[:product][:variant_property_rules_attributes].each do |_index, param_attrs|
136
+ params[:product][:variant_property_rules_attributes].each_value do |param_attrs|
137
137
  param_attrs[:option_value_ids] = param_attrs[:option_value_ids].split(',')
138
138
  end
139
139
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ module Admin
5
+ class ThemeController < Spree::Admin::BaseController
6
+ skip_before_action :authorize_admin, only: [:set]
7
+
8
+ def set
9
+ requested_theme = params[:switch_to_theme].presence
10
+
11
+ # Avoid interpolating user content into the session key
12
+ system_theme = params[:system_theme].presence == "dark" ? "dark" : "light"
13
+ session_key = :"admin_#{system_theme}_theme"
14
+
15
+ if theme_is_available?(requested_theme)
16
+ session[session_key] = requested_theme
17
+ redirect_back_or_to spree.admin_url, notice: t('spree.theme_changed')
18
+ else
19
+ redirect_back_or_to spree.admin_url, error: t('spree.error')
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def theme_is_available?(theme)
26
+ theme && Spree::Backend::Config.themes.key?(theme.to_sym)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -13,11 +13,7 @@
13
13
  "spree/admin/shared/modal",
14
14
  target: "modal-image-#{image.id}",
15
15
  title: image.alt,
16
- content: %{
17
- <div class='align-center'>
18
- #{image_tag(image.url(:large))}
19
- </div>
20
- }.html_safe
16
+ content: tag.div(image_tag(image.url(:large)), class: 'align-center')
21
17
  ) %>
22
18
  </td>
23
19
 
@@ -0,0 +1,5 @@
1
+ <div class="field">
2
+ <% field_name = "#{param_prefix}[preferred_minimum_quantity]" %>
3
+ <%= label_tag field_name, promotion_rule.model_name.human %>
4
+ <%= number_field_tag field_name, promotion_rule.preferred_minimum_quantity, class: "fullwidth", min: 1 %>
5
+ </div>
@@ -6,7 +6,8 @@
6
6
  <title><%= admin_page_title %></title>
7
7
 
8
8
  <%= favicon_link_tag 'favicon.ico' %>
9
- <%= stylesheet_link_tag Spree::Backend::Config.theme_path, media: 'all', data: {turbolinks_track: 'reload'} %>
9
+ <%= stylesheet_link_tag Spree::Backend::Config.theme_path(session[:admin_light_theme]), media: '(prefers-color-scheme: light)', data: {turbolinks_track: 'reload'} %>
10
+ <%= stylesheet_link_tag Spree::Backend::Config.theme_path(session[:admin_dark_theme]), media: '(prefers-color-scheme: dark)', data: {turbolinks_track: 'reload'} %>
10
11
  <%= javascript_include_tag 'spree/backend/all', data: {turbolinks_track: 'reload'} %>
11
12
 
12
13
  <%- if Rails.env.test? %>
@@ -33,7 +33,7 @@
33
33
  <script data-hook='admin-custom-translations'>
34
34
  </script>
35
35
 
36
- <% if I18n.locale != :en %>
37
- <%= javascript_include_tag "solidus_admin/select2_locales/select2_locale_#{I18n.locale}",
38
- data: {turbolinks_track: 'reload'} %>
36
+ <% if I18n.locale != :en && I18n.locale %>
37
+ <% select2_locale_path = "solidus_admin/select2_locales/select2_locale_#{I18n.locale}" %>
38
+ <%= javascript_include_tag select2_locale_path, data: {turbolinks_track: 'reload'} if Rails.application.assets.find_asset(select2_locale_path) %>
39
39
  <% end %>
@@ -1,16 +1,14 @@
1
- <% available_locales = Spree.i18n_available_locales %>
2
- <% if available_locales.size > 1 %>
3
- <label class="admin-navbar-selection admin-locale-selection">
4
- <i class="fa fa-globe fa-fw" title="<%= I18n.t('spree.choose_dashboard_locale') %>"></i>
5
- <select class="js-locale-selection custom-select fullwidth">
6
- <%=
7
- options_for_select(
8
- available_locales.map do |locale|
9
- [I18n.t('spree.i18n.this_file_language', locale: locale, default: locale.to_s, fallback: false), locale]
10
- end.sort,
11
- selected: I18n.locale,
12
- )
13
- %>
14
- </select>
15
- </label>
1
+ <% available_locale_options_for_select = Spree.i18n_available_locales.map {
2
+ [I18n.t('spree.i18n.this_file_language', locale: _1, default: _1.to_s, fallback: false), _1]
3
+ }.sort %>
4
+
5
+ <% if available_locale_options_for_select.size > 1 %>
6
+ <%= form_tag(admin_set_locale_path(format: :html), method: :put, style: "width: 100%;") do %>
7
+ <label class="admin-navbar-selection admin-locale-selection">
8
+ <i class="fa fa-globe fa-fw" title="<%= I18n.t('spree.choose_dashboard_locale') %>"></i>
9
+ <select class="custom-select fullwidth" onchange="this.form.requestSubmit()">
10
+ <%= options_for_select(available_locale_options_for_select, I18n.locale) %>
11
+ </select>
12
+ </label>
13
+ <% end %>
16
14
  <% end %>
@@ -0,0 +1,17 @@
1
+ <% available_locale_options_for_select = Spree.i18n_available_locales.map {
2
+ [I18n.t('spree.i18n.this_file_language', locale: _1, default: _1.to_s, fallback: false), _1]
3
+ }.sort %>
4
+
5
+ <% if available_locale_options_for_select.size > 1 %>
6
+ <li>
7
+ <%= form_tag(admin_set_locale_path(format: :html), method: :put, style: "width: 100%;") do %>
8
+ <label>
9
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-global-line"></use></svg>
10
+ <select name="switch_to_locale" onchange="this.form.requestSubmit()">
11
+ <%= options_for_select(available_locale_options_for_select, selected: I18n.locale) %>
12
+ </select>
13
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-expand-up-down-line"></use></svg>
14
+ </label>
15
+ <% end %>
16
+ </li>
17
+ <% end %>
@@ -7,6 +7,7 @@
7
7
  <span class="text"><%= t('spree.minimize_menu') %></span>
8
8
  <% end %>
9
9
  <%= render partial: 'spree/admin/shared/locale_selection' %>
10
+ <%= render partial: 'spree/admin/shared/theme_selection' %>
10
11
  <% if lookup_context.exists?('spree/admin/shared/_navigation_footer') %>
11
12
  <%= render partial: 'spree/admin/shared/navigation_footer' %>
12
13
  <% else %>
@@ -8,7 +8,7 @@
8
8
  <%- end %>
9
9
 
10
10
  <%= link_to "//#{default_store.url}", target: '_blank', class: 'solidus-admin--nav--store-link' do %>
11
- <div style="flex-grow: 1">
11
+ <div style="flex-grow: 1; display: flex; flex-direction: column; gap: 2px;">
12
12
  <span class="solidus-admin--nav--store-link--name"><%= default_store.name %></span>
13
13
  <span class="solidus-admin--nav--store-link--url"><%= default_store.url %></span>
14
14
  </div>
@@ -49,32 +49,8 @@
49
49
  </summary>
50
50
 
51
51
  <ul>
52
- <% if (available_locales = Spree.i18n_available_locales).any? %>
53
- <li>
54
- <label>
55
- <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-global-line"></use></svg>
56
- <select class="js-locale-selection">
57
- <%= options_for_select(
58
- available_locales
59
- .map do |locale|
60
- [
61
- t(
62
- "spree.i18n.this_file_language",
63
- locale: locale,
64
- default: locale.to_s,
65
- fallback: false
66
- ),
67
- locale
68
- ]
69
- end
70
- .sort,
71
- selected: I18n.locale
72
- ) %>
73
- </select>
74
- <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-expand-up-down-line"></use></svg>
75
- </label>
76
- </li>
77
- <% end %>
52
+ <%= render 'spree/admin/shared/locale_selection_solidus_admin' %>
53
+ <%= render 'spree/admin/shared/theme_selection_solidus_admin' %>
78
54
 
79
55
  <% if can?(:admin, spree_current_user) %>
80
56
  <li data-hook="user-account-link">
@@ -0,0 +1,21 @@
1
+ <% theme_options_for_select = Spree::Backend::Config.themes.keys.map { |theme| [theme.to_s.humanize, theme] }.sort %>
2
+
3
+ <%= form_tag(admin_set_theme_path(format: :html), method: :put, style: "width: 100%;", class: "light-only") do %>
4
+ <%= hidden_field_tag :system_theme, :light %>
5
+ <label class="admin-navbar-selection">
6
+ <i class="fa fa-sun-o fa-fw" title="<%= I18n.t('spree.choose_dashboard_theme') %>"></i>
7
+ <select name="switch_to_theme" class="custom-select fullwidth" onchange="this.form.requestSubmit()">
8
+ <%= options_for_select(theme_options_for_select, session[:admin_light_theme] || Spree::Backend::Config.theme) %>
9
+ </select>
10
+ </label>
11
+ <% end %>
12
+
13
+ <%= form_tag(admin_set_theme_path(format: :html), method: :put, style: "width: 100%;", class: "dark-only") do %>
14
+ <%= hidden_field_tag :system_theme, :dark %>
15
+ <label class="admin-navbar-selection">
16
+ <i class="fa fa-moon-o fa-fw" title="<%= I18n.t('spree.choose_dashboard_theme') %>"></i>
17
+ <select name="switch_to_theme" class="custom-select fullwidth" onchange="this.form.requestSubmit()">
18
+ <%= options_for_select(theme_options_for_select, session[:admin_dark_theme] || Spree::Backend::Config.dark_theme) %>
19
+ </select>
20
+ </label>
21
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <% theme_options_for_select = Spree::Backend::Config.themes.keys.map { |theme| [theme.to_s.humanize, theme] }.sort %>
2
+
3
+ <li>
4
+ <%= form_tag(admin_set_theme_path(format: :html), method: :put, style: "width: 100%;", class: "light-only") do %>
5
+ <%= hidden_field_tag :system_theme, :light %>
6
+ <label>
7
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-sun-line"></use></svg>
8
+ <select name="switch_to_theme" onchange="this.form.requestSubmit()">
9
+ <%= options_for_select(theme_options_for_select, session[:admin_light_theme] || Spree::Backend::Config.theme) %>
10
+ </select>
11
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-expand-up-down-line"></use></svg>
12
+ </label>
13
+ <% end %>
14
+
15
+ <%= form_tag(admin_set_theme_path(format: :html), method: :put, style: "width: 100%;", class: "dark-only") do %>
16
+ <%= hidden_field_tag :system_theme, :dark %>
17
+ <label>
18
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-moon-line"></use></svg>
19
+ <select name="switch_to_theme" onchange="this.form.requestSubmit()">
20
+ <%= options_for_select(theme_options_for_select, session[:admin_dark_theme] || Spree::Backend::Config.dark_theme) %>
21
+ </select>
22
+ <svg aria-hidden="true"><use xlink:href="<%= image_path('spree/backend/themes/solidus_admin/remixicon.symbol.svg') %>#ri-expand-up-down-line"></use></svg>
23
+ </label>
24
+ <% end %>
25
+ </li>
data/config/routes.rb CHANGED
@@ -6,6 +6,7 @@ Spree::Core::Engine.routes.draw do
6
6
  get '/search/products', to: "search#products", as: :search_products
7
7
 
8
8
  put '/locale/set', to: 'locale#set', defaults: { format: :json }, as: :set_locale
9
+ put '/theme/set', to: 'theme#set', defaults: { format: :json }, as: :set_theme
9
10
 
10
11
  resources :dashboards, only: [] do
11
12
  collection do
data/lib/spree/backend.rb CHANGED
@@ -7,7 +7,6 @@ require 'jquery-rails'
7
7
  require 'sassc-rails'
8
8
  require 'handlebars_assets'
9
9
  require 'font-awesome-rails'
10
- require 'autoprefixer-rails'
11
10
  require 'jbuilder'
12
11
  require 'kaminari'
13
12
  require 'responders'
@@ -11,15 +11,24 @@ module Spree
11
11
  # @return [Hash] A hash containing the themes that are available for the admin panel
12
12
  preference :themes, :hash, default: {
13
13
  classic: 'spree/backend/all',
14
+ classic_dark: 'spree/backend/themes/classic_dark',
15
+ classic_dark_dimmed: 'spree/backend/themes/classic_dimmed',
16
+ solidus: 'spree/backend/themes/solidus_admin',
17
+ solidus_dark: 'spree/backend/themes/solidus_admin_dark',
18
+ solidus_dimmed: 'spree/backend/themes/solidus_admin_dimmed',
14
19
  solidus_admin: 'spree/backend/themes/solidus_admin'
15
20
  }
16
21
 
17
22
  # @!attribute [rw] theme
18
23
  # @return [String] Default admin theme name
19
- versioned_preference :theme, :string, initial_value: 'classic', boundaries: { "4.2.0" => "solidus_admin" }
24
+ versioned_preference :theme, :string, initial_value: 'classic', boundaries: { "4.2.0" => "solidus_admin", "4.4.0" => "solidus" }
20
25
 
21
- def theme_path(user_theme = nil)
22
- user_theme ? themes.fetch(user_theme.to_sym) : themes.fetch(theme.to_sym)
26
+ # @!attribute [rw] dark_theme
27
+ # @return [String] Dark admin theme name
28
+ versioned_preference :dark_theme, :string, initial_value: 'classic', boundaries: { "4.2.0" => "solidus_admin", "4.4.0" => 'solidus_dark' }
29
+
30
+ def theme_path(user_theme)
31
+ themes.fetch(user_theme&.to_sym, themes.fetch(theme.to_sym))
23
32
  end
24
33
 
25
34
  # @!attribute [rw] admin_updated_navbar
@@ -33,6 +33,5 @@ Gem::Specification.new do |s|
33
33
  s.add_dependency 'responders'
34
34
  s.add_dependency 'sassc-rails'
35
35
 
36
- s.add_dependency 'autoprefixer-rails', '~> 10.2', '>= 10.2.5.1'
37
36
  s.add_dependency 'handlebars_assets', '~> 0.23'
38
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-02 00:00:00.000000000 Z
11
+ date: 2023-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.3
19
+ version: 4.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.3
26
+ version: 4.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.2.3
33
+ version: 4.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.2.3
40
+ version: 4.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: font-awesome-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,26 +122,6 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: autoprefixer-rails
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '10.2'
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- version: 10.2.5.1
135
- type: :runtime
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: '10.2'
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: 10.2.5.1
145
125
  - !ruby/object:Gem::Dependency
146
126
  name: handlebars_assets
147
127
  requirement: !ruby/object:Gem::Requirement
@@ -348,10 +328,14 @@ files:
348
328
  - app/assets/stylesheets/spree/backend/shared/index.scss
349
329
  - app/assets/stylesheets/spree/backend/spree_admin.scss
350
330
  - app/assets/stylesheets/spree/backend/themes/classic.css.scss
331
+ - app/assets/stylesheets/spree/backend/themes/classic_dark.css.scss
332
+ - app/assets/stylesheets/spree/backend/themes/classic_dimmed.css.scss
351
333
  - app/assets/stylesheets/spree/backend/themes/solidus_admin.css.scss
352
334
  - app/assets/stylesheets/spree/backend/themes/solidus_admin/_colors.scss
353
335
  - app/assets/stylesheets/spree/backend/themes/solidus_admin/_tables.scss
354
336
  - app/assets/stylesheets/spree/backend/themes/solidus_admin/_variables.scss
337
+ - app/assets/stylesheets/spree/backend/themes/solidus_admin_dark.css.scss
338
+ - app/assets/stylesheets/spree/backend/themes/solidus_admin_dimmed.css.scss
355
339
  - app/assets/stylesheets/spree/backend/vendor/index.scss
356
340
  - app/concerns/spree/admin/sets_user_language_locale_key.rb
357
341
  - app/controllers/spree/admin/adjustment_reasons_controller.rb
@@ -403,6 +387,7 @@ files:
403
387
  - app/controllers/spree/admin/taxonomies_controller.rb
404
388
  - app/controllers/spree/admin/taxons/attachment_controller.rb
405
389
  - app/controllers/spree/admin/taxons_controller.rb
390
+ - app/controllers/spree/admin/theme_controller.rb
406
391
  - app/controllers/spree/admin/users/api_key_controller.rb
407
392
  - app/controllers/spree/admin/users_controller.rb
408
393
  - app/controllers/spree/admin/variant_property_rule_values_controller.rb
@@ -550,6 +535,7 @@ files:
550
535
  - app/views/spree/admin/promotions/rules/_first_order.html.erb
551
536
  - app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb
552
537
  - app/views/spree/admin/promotions/rules/_item_total.html.erb
538
+ - app/views/spree/admin/promotions/rules/_minimum_quantity.html.erb
553
539
  - app/views/spree/admin/promotions/rules/_nth_order.html.erb
554
540
  - app/views/spree/admin/promotions/rules/_one_use_per_user.html.erb
555
541
  - app/views/spree/admin/promotions/rules/_option_value.html.erb
@@ -598,6 +584,7 @@ files:
598
584
  - app/views/spree/admin/shared/_image.html.erb
599
585
  - app/views/spree/admin/shared/_js_locale_data.html.erb
600
586
  - app/views/spree/admin/shared/_locale_selection.html.erb
587
+ - app/views/spree/admin/shared/_locale_selection_solidus_admin.html.erb
601
588
  - app/views/spree/admin/shared/_menu.html.erb
602
589
  - app/views/spree/admin/shared/_modal.html.erb
603
590
  - app/views/spree/admin/shared/_navigation.html.erb
@@ -624,6 +611,8 @@ files:
624
611
  - app/views/spree/admin/shared/_table_filter.html.erb
625
612
  - app/views/spree/admin/shared/_tabs.html.erb
626
613
  - app/views/spree/admin/shared/_taxes_tabs.html.erb
614
+ - app/views/spree/admin/shared/_theme_selection.html.erb
615
+ - app/views/spree/admin/shared/_theme_selection_solidus_admin.html.erb
627
616
  - app/views/spree/admin/shared/_variant_search.html.erb
628
617
  - app/views/spree/admin/shared/named_types/_edit.html.erb
629
618
  - app/views/spree/admin/shared/named_types/_form.html.erb
@@ -930,7 +919,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
930
919
  - !ruby/object:Gem::Version
931
920
  version: 1.8.23
932
921
  requirements: []
933
- rubygems_version: 3.4.17
922
+ rubygems_version: 3.4.10
934
923
  signing_key:
935
924
  specification_version: 4
936
925
  summary: Admin interface for the Solidus e-commerce framework.