solidus_backend 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/solidus_backend_manifest.js +2 -0
  3. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +32 -12
  4. data/app/assets/stylesheets/spree/backend/components/index.scss +15 -0
  5. data/app/assets/stylesheets/spree/backend/globals/index.scss +5 -0
  6. data/app/assets/stylesheets/spree/backend/plugins/index.scss +3 -0
  7. data/app/assets/stylesheets/spree/backend/sections/index.scss +14 -0
  8. data/app/assets/stylesheets/spree/backend/shared/index.scss +9 -0
  9. data/app/assets/stylesheets/spree/backend/spree_admin.scss +4 -55
  10. data/app/assets/stylesheets/spree/backend/themes/classic.css.scss +6 -0
  11. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_tables.scss +56 -0
  12. data/app/assets/stylesheets/spree/backend/themes/solidus_admin/_variables.scss +204 -0
  13. data/app/assets/stylesheets/spree/backend/themes/solidus_admin.css.scss +11 -0
  14. data/app/assets/stylesheets/spree/backend/vendor/index.scss +11 -0
  15. data/app/assets/stylesheets/spree/backend.css +5 -10
  16. data/app/concerns/spree/admin/sets_user_language_locale_key.rb +2 -0
  17. data/app/controllers/spree/admin/base_controller.rb +2 -0
  18. data/app/controllers/spree/admin/resource_controller.rb +8 -4
  19. data/app/helpers/spree/admin/navigation_helper.rb +3 -0
  20. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +1 -1
  21. data/app/views/spree/admin/customer_returns/edit.html.erb +1 -3
  22. data/app/views/spree/admin/reimbursements/edit.html.erb +2 -4
  23. data/app/views/spree/admin/shared/_head.html.erb +1 -1
  24. data/app/views/spree/admin/shared/_locale_selection.html.erb +3 -2
  25. data/app/views/spree/admin/tax_rates/_form.html.erb +1 -1
  26. data/app/views/spree/admin/zones/_form.html.erb +1 -1
  27. data/bin/rails +13 -0
  28. data/lib/spree/backend_configuration/menu_item.rb +57 -0
  29. data/lib/spree/backend_configuration.rb +16 -43
  30. metadata +18 -7
  31. data/app/assets/stylesheets/spree/backend/themes/blue_steel/globals/_variables_override.scss +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61dda9dcfdb524b8845d70ac171f6e93a627312e75cfe0d9419086e7341a4f42
4
- data.tar.gz: fc050671e822baa25c6a99538bd9b3144779664c16e91f2ac74a6f02f29f1eda
3
+ metadata.gz: 5de35cbe73ca913a8cb68611b23b3edbc4e1bdb4f4b47277e3c0e7952b11c6a5
4
+ data.tar.gz: a72c2b284154c2a4c0b7bfb24a282a4ea4d90cd51e81987e7bbe179380d7c48d
5
5
  SHA512:
6
- metadata.gz: 591fe52b3000187dc0c3f9e9cc76ce0cf946c5b9f361dc1bdfb06594362287cdec29c5b04b22b25f6c4fa2d5897307901e5b5eacfb2c62018ea307199411e904
7
- data.tar.gz: 1c47ec65f6ce9fea90f29bf6bec266b4c8094d00dfe353a1acd4661d352ea8f47c0a0e4c53989a0fe052f8687949a27384820cf59a3d650687c284d5d018710f
6
+ metadata.gz: 8cb21de79fb0fc2d1123ecda5930280d194d684ef446df41c485cd06f649e85760280c956560085199cad16fd0abb1bcf44c0e7c426850ba106c4b9cb97e9413
7
+ data.tar.gz: 6d7e8bdea1dce6ff1d855daf1f5e63f5b28246b1e936153ace0eb50a8efda9149b26108083a07fd2a1199603ff3e4d934314473904d636758a6c9c7819c45d56
@@ -4,3 +4,5 @@
4
4
  //= link spree/backend/all.css
5
5
 
6
6
  //= link solidus_admin/select2_locales
7
+
8
+ //= link_directory ../stylesheets/spree/backend/themes .css
@@ -14,6 +14,7 @@ $padding-y-navbar-submenu: 9px;
14
14
  display: block;
15
15
  height: 39px;
16
16
  z-index: 1;
17
+ margin-bottom: 1em;
17
18
 
18
19
  span {
19
20
  font-size: $font-size-sm;
@@ -288,22 +289,34 @@ nav.menu {
288
289
  }
289
290
  }
290
291
 
291
- .admin-locale-selection {
292
- margin: 1em;
292
+ .admin-navbar-selection {
293
+ margin: 0 1.5em;
293
294
  position: relative;
295
+ overflow: hidden;
296
+ display: inline-flex;
297
+ align-items: baseline;
298
+ min-height: 1.5em;
299
+
300
+ i {
301
+ cursor: pointer;
302
+ padding-right: 2.4em;
303
+ min-width: 1em;
304
+ height: 1em;
305
+ }
294
306
 
295
307
  &::after {
296
- content: "\f0ac";
297
308
  font-family: "FontAwesome";
298
309
  position: absolute;
299
310
  top: 0;
300
311
  left: 0;
301
312
  padding: .5rem 0 .5rem .25rem;
302
- z-index: -1;
303
313
  }
304
314
 
305
- .admin-nav-hidden & {
306
- .js-locale-selection.custom-select {
315
+ .admin-nav-hidden & {
316
+ position: relative;
317
+
318
+ select {
319
+ background-image: none;
307
320
  background-color: transparent;
308
321
  background-position: 1.5rem center;
309
322
  background-size: 8px 9px;
@@ -313,6 +326,10 @@ nav.menu {
313
326
  overflow: hidden;
314
327
  text-indent: 1rem;
315
328
  z-index: 1;
329
+ cursor: pointer;
330
+
331
+ // Move the select back to the left so it catches clicks
332
+ transform: translateX(-3rem);
316
333
 
317
334
  &:focus {
318
335
  box-shadow: none;
@@ -326,14 +343,16 @@ nav.menu {
326
343
  bottom: 0;
327
344
  }
328
345
 
346
+ body.admin-nav-hidden .admin-nav:not(.fits) {
347
+ .admin-navbar-selection::after {
348
+ z-index: 0;
349
+ }
350
+ }
351
+
329
352
  .admin-login-nav {
330
353
  list-style: none;
331
354
  padding: 0;
332
- margin: 1rem 0;
333
-
334
- li {
335
- padding: 0.3rem 1.2rem;
336
- }
355
+ margin: 1em 1.5em;
337
356
 
338
357
  a {
339
358
  display: inline-block;
@@ -345,7 +364,8 @@ nav.menu {
345
364
  }
346
365
 
347
366
  i {
348
- margin-right: 0.5rem;
367
+ margin-right: 1.2em;
368
+ min-width: 1em;
349
369
  }
350
370
  }
351
371
 
@@ -0,0 +1,15 @@
1
+ @import 'spree/backend/components/actions';
2
+ @import 'spree/backend/components/breadcrumb';
3
+ @import 'spree/backend/components/buttons';
4
+ @import 'spree/backend/components/number_with_currency';
5
+ @import 'spree/backend/components/hint';
6
+ @import 'spree/backend/components/image_placeholder';
7
+ @import 'spree/backend/components/list_group';
8
+ @import 'spree/backend/components/messages';
9
+ @import 'spree/backend/components/progress';
10
+ @import 'spree/backend/components/table-filter';
11
+ @import 'spree/backend/components/navigation';
12
+ @import 'spree/backend/components/sidebar';
13
+ @import 'spree/backend/components/editable_table';
14
+ @import 'spree/backend/components/pills';
15
+ @import 'spree/backend/components/tabs';
@@ -0,0 +1,5 @@
1
+ @import 'spree/backend/globals/functions';
2
+ @import 'spree/backend/globals/deprecation';
3
+ @import 'spree/backend/globals/variables_override';
4
+ @import 'spree/backend/globals/variables';
5
+ @import 'spree/backend/globals/deprecated_variables';
@@ -0,0 +1,3 @@
1
+ @import 'spree/backend/plugins/select2';
2
+ @import 'spree/backend/plugins/bootstrap_tooltip';
3
+ @import 'spree/backend/plugins/sortable';
@@ -0,0 +1,14 @@
1
+ @import 'spree/backend/sections/adjustments';
2
+ @import 'spree/backend/sections/orders';
3
+ @import 'spree/backend/sections/products';
4
+ @import 'spree/backend/sections/variants';
5
+ @import 'spree/backend/sections/promotions';
6
+ @import 'spree/backend/sections/bulk_transfer';
7
+ @import 'spree/backend/sections/return_authorizations';
8
+ @import 'spree/backend/sections/log_entries';
9
+ @import 'spree/backend/sections/taxonomies';
10
+ @import 'spree/backend/sections/taxons';
11
+ @import 'spree/backend/sections/users';
12
+ @import 'spree/backend/sections/store_credits';
13
+ @import 'spree/backend/sections/stock_management';
14
+ @import 'spree/backend/sections/style_guide';
@@ -0,0 +1,9 @@
1
+ @import 'spree/backend/shared/fonts';
2
+ @import 'spree/backend/shared/typography';
3
+ @import 'spree/backend/shared/images';
4
+ @import 'spree/backend/shared/tables';
5
+ @import 'spree/backend/shared/icons';
6
+ @import 'spree/backend/shared/forms';
7
+ @import 'spree/backend/shared/layout';
8
+ @import 'spree/backend/shared/header';
9
+ @import 'spree/backend/shared/utilities';
@@ -1,56 +1,5 @@
1
- @import 'spree/backend/globals/functions';
2
- @import 'spree/backend/globals/deprecation';
3
- @import 'spree/backend/globals/variables_override';
4
- @import 'spree/backend/globals/variables';
5
- @import 'spree/backend/globals/deprecated_variables';
1
+ @import 'spree/backend/themes/classic';
6
2
 
7
- @import 'bootstrap_custom';
8
- @import 'solidus_admin/bootstrap/bootstrap';
9
-
10
- @import 'spree/backend/globals/mixins';
11
-
12
- @import 'spree/backend/shared/fonts';
13
- @import 'spree/backend/shared/typography';
14
- @import 'spree/backend/shared/images';
15
- @import 'spree/backend/shared/tables';
16
- @import 'spree/backend/shared/icons';
17
- @import 'spree/backend/shared/forms';
18
- @import 'spree/backend/shared/layout';
19
- @import 'spree/backend/shared/header';
20
- @import 'spree/backend/shared/utilities';
21
-
22
- @import 'spree/backend/components/actions';
23
- @import 'spree/backend/components/breadcrumb';
24
- @import 'spree/backend/components/buttons';
25
- @import 'spree/backend/components/number_with_currency';
26
- @import 'spree/backend/components/hint';
27
- @import 'spree/backend/components/image_placeholder';
28
- @import 'spree/backend/components/list_group';
29
- @import 'spree/backend/components/messages';
30
- @import 'spree/backend/components/progress';
31
- @import 'spree/backend/components/table-filter';
32
- @import 'spree/backend/components/navigation';
33
- @import 'spree/backend/components/sidebar';
34
- @import 'spree/backend/components/editable_table';
35
- @import 'spree/backend/components/pills';
36
- @import 'spree/backend/components/tabs';
37
-
38
- @import 'font-awesome';
39
- @import 'spree/backend/plugins/select2';
40
- @import 'spree/backend/plugins/bootstrap_tooltip';
41
- @import 'spree/backend/plugins/sortable';
42
-
43
- @import 'spree/backend/sections/adjustments';
44
- @import 'spree/backend/sections/orders';
45
- @import 'spree/backend/sections/products';
46
- @import 'spree/backend/sections/variants';
47
- @import 'spree/backend/sections/promotions';
48
- @import 'spree/backend/sections/bulk_transfer';
49
- @import 'spree/backend/sections/return_authorizations';
50
- @import 'spree/backend/sections/log_entries';
51
- @import 'spree/backend/sections/taxonomies';
52
- @import 'spree/backend/sections/taxons';
53
- @import 'spree/backend/sections/users';
54
- @import 'spree/backend/sections/store_credits';
55
- @import 'spree/backend/sections/stock_management';
56
- @import 'spree/backend/sections/style_guide';
3
+ @warn "[Solidus] [Deprecation] " +
4
+ "importing or requiring `spree/backend/spree_admin` is deprecated and will be removed in the next major. " +
5
+ "Please use `spree/backend/themes/classic` instead.";
@@ -0,0 +1,6 @@
1
+ @import 'spree/backend/globals';
2
+ @import 'spree/backend/vendor';
3
+ @import 'spree/backend/shared';
4
+ @import 'spree/backend/components';
5
+ @import 'spree/backend/plugins';
6
+ @import 'spree/backend/sections';
@@ -0,0 +1,56 @@
1
+ table.index {
2
+ // Borders
3
+ border-collapse: separate;
4
+ border-spacing: 0;
5
+
6
+ > thead > tr > th:first-child {
7
+ border-top-left-radius: 4px;
8
+ }
9
+
10
+ > thead > tr > th:last-child {
11
+ border-top-right-radius: 4px;
12
+ }
13
+
14
+ > tbody > tr:last-child > td:first-child {
15
+ border-bottom-left-radius: 4px;
16
+ }
17
+
18
+ > tbody > tr:last-child > td:last-child {
19
+ border-bottom-right-radius: 4px;
20
+ }
21
+
22
+ > thead > tr > th {
23
+ border-top: 1px solid $theme-gray-100;
24
+ border-bottom: none
25
+ }
26
+
27
+ > thead > tr > th,
28
+ > tbody > tr > td {
29
+ &:first-child {
30
+ border-left: 1px solid $theme-gray-100;
31
+ }
32
+
33
+ &:last-child {
34
+ border-right: 1px solid $theme-gray-100;
35
+ }
36
+ }
37
+
38
+ > tbody > tr:last-child > td {
39
+ border-bottom: 1px solid $theme-gray-100;
40
+ }
41
+
42
+ // Colors
43
+ > th {
44
+ background-color: $theme-gray-15;
45
+ color: $theme-gray-600;
46
+ }
47
+
48
+ > td {
49
+ background-color: $theme-white;
50
+ color: $theme-black;
51
+ }
52
+ }
53
+
54
+ table#listing_products > tbody > tr > td > img {
55
+ width: 24px;
56
+ }
@@ -0,0 +1,204 @@
1
+
2
+ // -------------------------------------------------------------
3
+ // Variables used in all other files
4
+ //--------------------------------------------------------------
5
+
6
+ // Fonts
7
+ //--------------------------------------------------------------
8
+ $font-size-pill: 11px;
9
+ $label-font-size: 12px;
10
+
11
+ // Colors
12
+ //--------------------------------------------------------------
13
+
14
+ // Primary palette
15
+ $theme-solidus-red: #ef3023;
16
+ $theme-black: #222222;
17
+ $theme-graphite: #c7ccc7;
18
+ $theme-graphite-light: #d8dad8;
19
+ $theme-sand: #f5f3f0;
20
+ $theme-white: #ffffff;
21
+
22
+ // Secondary palette
23
+ $theme-yellow: #fdc071;
24
+ $theme-orange: #f68050;
25
+ $theme-blue: #2554b1;
26
+ $theme-moss: #2d3925;
27
+ $theme-forest: #096756;
28
+ $theme-midnight: #163449;
29
+ $theme-pink: #f6d7e2;
30
+ $theme-plum: #3a0e31;
31
+ $theme-sky: #cbdff1;
32
+ $theme-seafoam: #c1e0de;
33
+ $theme-dune: #e6bf9b;
34
+
35
+ // UI Red
36
+ $theme-red-100: #f8d6d3;
37
+ $theme-red-200: #f1ada7;
38
+ $theme-red-300: #ea8980;
39
+ $theme-red-400: #e36054;
40
+ $theme-red-500: #dc3728;
41
+ $theme-red-600: #b12c20;
42
+ $theme-red-700: #862219;
43
+ $theme-red-800: #561610;
44
+ $theme-red-900: #2b0b08;
45
+
46
+ // Grayscale
47
+ $theme-gray-15: #fafafa;
48
+ $theme-gray-25: #f5f5f5;
49
+ $theme-gray-50: #f0f0f0;
50
+ $theme-gray-100: #dedede;
51
+ $theme-gray-200: #cfcfcf;
52
+ $theme-gray-300: #bababa;
53
+ $theme-gray-400: #a3a3a3;
54
+ $theme-gray-500: #737373;
55
+ $theme-gray-600: #616161;
56
+ $theme-gray-700: #4a4a4a;
57
+ $theme-gray-800: #333333;
58
+
59
+ // Basic color palette for admin
60
+
61
+ $color-dark: $theme-gray-800;
62
+ $color-dark-dark: $theme-gray-600;
63
+ $color-dark-light: $theme-gray-500;
64
+ $color-dark-accent: $theme-gray-200;
65
+
66
+ $color-primary: $theme-black;
67
+ $color-primary-light: $theme-gray-100;
68
+
69
+ $color-light: $theme-gray-15;
70
+ $color-light-dark: $theme-gray-50;
71
+ $color-light-accent: $theme-gray-100;
72
+
73
+ $color-white: $theme-white;
74
+
75
+ $color-red: $theme-red-600;
76
+ $color-yellow: $theme-yellow;
77
+ $color-green: $theme-forest;
78
+
79
+ // Basic accents for admin
80
+ $box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.12);
81
+
82
+ // Body base colors
83
+ $color-border: $color-light-dark;
84
+ $color-disabled: $color-dark-light;
85
+
86
+ // Basic navigation colors
87
+ $color-header-bg: $theme-white;
88
+ $color-sidebar-bg: $color-light;
89
+ $color-sidebar-border: $color-border;
90
+ $color-navbar: $color-dark;
91
+ $color-navbar-bg: $color-light;
92
+ $color-navbar-active: $theme-solidus-red;
93
+ $color-navbar-active-bg: $theme-gray-25;
94
+ $color-navbar-submenu: $color-dark-light;
95
+ $color-navbar-submenu-bg: $color-light;
96
+ $color-navbar-submenu-active: $color-primary;
97
+ $color-navbar-footer: $color-dark;
98
+ $color-navbar-footer-bg: $color-light;
99
+ $color-navbar-footer-active: $color-primary;
100
+ $color-icon-navbar: $color-dark-light;
101
+
102
+ $color-navbar-hover-bg: $theme-gray-25;
103
+ $color-navbar-hover: $color-dark;
104
+
105
+ // Basic Tabs colors
106
+ $color-tab: $color-dark-light;
107
+ $color-tab-bg: $color-light;
108
+ $color-tab-border: $color-border;
109
+ $color-tab-active: $color-primary;
110
+ $color-tab-active-bg: $color-white;
111
+ $color-tab-active-border: $color-white;
112
+
113
+ // Basic flash colors
114
+ $color-success: $color-green;
115
+ $color-notice: $color-yellow;
116
+ $color-error: $color-red;
117
+
118
+ // Breadcrumb custom variable
119
+
120
+ $breadcrumb-color: $color-dark-light;
121
+
122
+ // Color for spinner
123
+ $color-spinner: $color-white;
124
+
125
+ // Style Guide
126
+ $color-style-guide-code: darken($color-light, 10%);
127
+ $color-style-guide-link: darken($color-light, 65%);
128
+ $color-style-guide-nav: $color-light;
129
+ $color-style-guide-nav-border: darken($color-light, 5%);
130
+ $color-style-guide-nav-link: darken($color-light, 65%);
131
+ $color-style-guide-nav-link-hover: darken($color-light, 5%);
132
+ $color-style-guide-section-border: darken($color-light, 10%);
133
+ $color-style-guide-swatch-border: darken($color-light, 10%);
134
+ $color-style-guide-table-border: $theme-sky;
135
+
136
+ // Table colors
137
+ $color-tbl-odd: $color-white;
138
+ $color-tbl-even: $color-light;
139
+ $color-tbl-thead: $color-light;
140
+
141
+ // Pill colors
142
+ //
143
+ // For now these are custom assigned colors just for this section. As we go
144
+ // about updating other areas of the admin we will likely want to pull these
145
+ // colors out into better named variables.
146
+ $color-pill-text: $theme-gray-800;
147
+ $color-pill-neutral: $theme-gray-100;
148
+ $color-pill-neutral-text: $color-pill-text;
149
+ $color-pill-complete: $theme-sky;
150
+ $color-pill-complete-text: $color-pill-text;
151
+ $color-pill-active: $theme-seafoam;
152
+ $color-pill-active-text: $color-pill-text;
153
+ $color-pill-inactive: $color-pill-neutral;
154
+ $color-pill-inactive-text: $theme-gray-600;
155
+ $color-pill-pending: $theme-yellow;
156
+ $color-pill-pending-text: $color-pill-text;
157
+ $color-pill-warning: $theme-orange;
158
+ $color-pill-warning-text: $color-pill-text;
159
+ $color-pill-error: $theme-red-300;
160
+ $color-pill-error-text: $color-pill-text;
161
+
162
+ // Available states
163
+ $states: (
164
+ active,
165
+ address,
166
+ awaiting_return,
167
+ backorder,
168
+ balance_due,
169
+ canceled,
170
+ cart,
171
+ checkout,
172
+ complete,
173
+ completed,
174
+ confirm,
175
+ credit_owed,
176
+ delivery,
177
+ error,
178
+ failed,
179
+ inactive,
180
+ paid,
181
+ payment,
182
+ pending,
183
+ ready,
184
+ returned,
185
+ shipped,
186
+ void
187
+ );
188
+
189
+ // Sidebar
190
+ //--------------------------------------------------------------
191
+ $width-sidebar: 240px;
192
+ $width-sidebar-flyout: 225px;
193
+ $width-sidebar-collapsed: 52px;
194
+ $sidebar-transition: 250ms ease-in;
195
+ $border-sidebar: 1px solid $color-sidebar-border;
196
+
197
+ // Main
198
+ //--------------------------------------------------------------
199
+ $main-header-height: 84px;
200
+
201
+ $content-wrapper-bg: $color-white;
202
+ $admin-body-bg: $color-white;
203
+
204
+ $link-hover-color: $theme-solidus-red;
@@ -0,0 +1,11 @@
1
+ @import "spree/backend/globals";
2
+
3
+ @import "./solidus_admin/variables";
4
+
5
+ @import "spree/backend/vendor";
6
+ @import "spree/backend/shared";
7
+ @import "spree/backend/components";
8
+ @import "spree/backend/plugins";
9
+ @import "spree/backend/sections";
10
+
11
+ @import "./solidus_admin/tables";
@@ -0,0 +1,11 @@
1
+ @import "solidus_admin/select2";
2
+ @import "solidus_admin/flatpickr/flatpickr";
3
+ @import "prism";
4
+
5
+ @import 'spree/backend/bootstrap_custom';
6
+ @import 'solidus_admin/bootstrap/bootstrap';
7
+ @import 'font-awesome';
8
+
9
+ // These mixins will modify existing Bootstrap ones and need to be imported
10
+ // after the Bootstrap has been processed.
11
+ @import 'spree/backend/globals/mixins';
@@ -1,11 +1,6 @@
1
1
  /*
2
- * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
- * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
- * the top of the compiled file, but it's generally better to create a new file per style scope.
5
-
6
- *= require solidus_admin/select2
7
- *= require solidus_admin/flatpickr/flatpickr
8
- *= require prism
9
-
10
- *= require spree/backend/spree_admin
11
- */
2
+ * This is a manifest file that is here only for legacy support purposes, please refer to themes direcly via
3
+ * appropriate `Spree::Config` settings.
4
+ *
5
+ *= require spree/backend/themes/classic
6
+ */
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  module Admin
3
5
  module SetsUserLanguageLocaleKey
@@ -8,6 +8,8 @@ module Spree
8
8
 
9
9
  before_action :authorize_admin
10
10
 
11
+ respond_to :html
12
+
11
13
  private
12
14
 
13
15
  # Overrides ControllerHelpers::Common
@@ -79,12 +79,16 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
79
79
  def update_positions
80
80
  ActiveRecord::Base.transaction do
81
81
  positions = params[:positions]
82
- records = model_class.where(id: positions.keys).to_a
83
82
 
84
83
  positions.each do |id, index|
85
- # To permit the use of UUID as id, we compare models id in database
86
- # and in params under the string representation instead of integer
87
- records.find { |r| r.id.to_s == id }&.set_list_position(index)
84
+ # Yes here there is a N+1 but acts_as_list use after update callback
85
+ # so we can't keep not reloaded data without create a bug
86
+ # (spec : backend/spec/controllers/spree/admin/resource_controller_spec.rb)
87
+ # "with take care of acts_as_list's after update callback" test
88
+ #
89
+ # TODO : create a global set_list_position on all concerned objects
90
+ # maybe in the acts_as_list gem
91
+ model_class.where(id: id).first&.set_list_position(index)
88
92
  end
89
93
  end
90
94
 
@@ -44,6 +44,7 @@ module Spree
44
44
  # * :label to override link text, otherwise based on the first resource name (translated)
45
45
  # * :route to override automatically determining the default route
46
46
  # * :match_path as an alternative way to control when the tab is active, /products would match /admin/products, /admin/products/5/variants etc.
47
+ # * :match_path can also be a callable that takes a request and determines whether the menu item is selected for the request.
47
48
  def tab(*args, &_block)
48
49
  options = { label: args.first.to_s }
49
50
 
@@ -66,6 +67,8 @@ module Spree
66
67
 
67
68
  selected = if options[:match_path].is_a? Regexp
68
69
  request.fullpath =~ options[:match_path]
70
+ elsif options[:match_path].respond_to?(:call)
71
+ options[:match_path].call(request)
69
72
  elsif options[:match_path]
70
73
  request.fullpath.starts_with?("#{spree.admin_path}#{options[:match_path]}")
71
74
  else
@@ -50,7 +50,7 @@
50
50
  <td>
51
51
  <%= form_for [:admin, return_item] do |f| %>
52
52
  <%= f.hidden_field 'reception_status_event', value: 'receive' %>
53
- <%= f.button t('spree.actions.receive'), class: 'with-tip', "data-action" => 'save' %>
53
+ <%= f.submit t('spree.actions.receive'), class: 'btn btn-primary' %>
54
54
  <% end %>
55
55
  </td>
56
56
  <% end %>
@@ -39,9 +39,7 @@
39
39
  <% if @customer_return.completely_decided? %>
40
40
  <%= form_for [:admin, @order, Spree::Reimbursement.new] do |f| %>
41
41
  <%= hidden_field_tag :build_from_customer_return_id, @customer_return.id %>
42
- <%= f.button class: 'button' do %>
43
- <%= t('spree.create_reimbursement') %>
44
- <% end %>
42
+ <%= f.submit t('spree.create_reimbursement'), class: 'btn btn-primary' %>
45
43
  <% end %>
46
44
  <% else %>
47
45
  <div class="no-objects-found">
@@ -62,9 +62,7 @@
62
62
  </fieldset>
63
63
 
64
64
  <div class="form-buttons filter-actions actions" data-hook="buttons">
65
- <%= f.button do %>
66
- <%= t('spree.update') %>
67
- <% end %>
65
+ <%= f.submit t('spree.update'), class: "btn btn-primary" %>
68
66
  </div>
69
67
  <br>
70
68
  <% end %>
@@ -96,7 +94,7 @@
96
94
  <% end %>
97
95
  <div class="form-buttons filter-actions actions" data-hook="reimburse-buttons">
98
96
  <% if !@reimbursement.reimbursed? %>
99
- <%= button_to [:perform, :admin, @order, @reimbursement], { class: 'button btn btn-primary', method: 'post' } do %>
97
+ <%= button_to [:perform, :admin, @order, @reimbursement], { class: 'button btn btn-primary', method: 'post', data: { disable_with: t('spree.reimburse') }} do %>
100
98
  <%= t('spree.reimburse') %>
101
99
  <% end %>
102
100
  <%= link_to t('spree.actions.cancel'), url_for([:edit, :admin, @order, @reimbursement.customer_return]), class: 'btn btn-default' %>
@@ -6,7 +6,7 @@
6
6
  <title><%= admin_page_title %></title>
7
7
 
8
8
  <%= favicon_link_tag 'favicon.ico' %>
9
- <%= stylesheet_link_tag 'spree/backend/all', media: 'all', data: {turbolinks_track: 'reload'} %>
9
+ <%= stylesheet_link_tag Spree::Backend::Config.theme_path, media: 'all', data: {turbolinks_track: 'reload'} %>
10
10
  <%= javascript_include_tag 'spree/backend/all', data: {turbolinks_track: 'reload'} %>
11
11
 
12
12
  <%- if Rails.env.test? %>
@@ -1,6 +1,7 @@
1
1
  <% available_locales = Spree.i18n_available_locales %>
2
2
  <% if available_locales.size > 1 %>
3
- <div class="admin-locale-selection">
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>
4
5
  <select class="js-locale-selection custom-select fullwidth">
5
6
  <%=
6
7
  options_for_select(
@@ -11,5 +12,5 @@
11
12
  )
12
13
  %>
13
14
  </select>
14
- </div>
15
+ </label>
15
16
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <div data-hook="admin_tax_rate_form_fields">
2
2
  <fieldset data-hook="tax_rates" class=" no-border-bottom">
3
- <legend align="center"><%= t('spree.general_settings') %></legend>
3
+ <legend align="center"><%= t('spree.store') %></legend>
4
4
  <div class="row">
5
5
 
6
6
  <div class="col-5">
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div data-hook="admin_zone_form_fields">
5
5
  <fieldset class="no-border-bottom">
6
- <legend align="center"><%= t('spree.general_settings') %></legend>
6
+ <legend align="center"><%= t('spree.store') %></legend>
7
7
 
8
8
  <%= zone_form.field_container :name do %>
9
9
  <%= zone_form.label :name %><br>
data/bin/rails ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/spree/backend/engine', __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__)
10
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+
12
+ require "rails/all"
13
+ require "rails/engine/commands"
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ class BackendConfiguration < Preferences::Configuration
5
+ # An item which should be drawn in the admin menu
6
+ class MenuItem
7
+ attr_reader :icon, :label, :partial, :condition, :sections, :match_path
8
+
9
+ attr_accessor :position
10
+
11
+ # @param sections [Array<Symbol>] The sections which are contained within
12
+ # this admin menu section.
13
+ # @param icon [String] The icon to draw for this menu item
14
+ # @param condition [Proc] A proc which returns true if this menu item
15
+ # should be drawn. If nil, it will be replaced with a proc which always
16
+ # returns true.
17
+ # @param label [Symbol] The translation key for a label to use for this
18
+ # menu item.
19
+ # @param partial [String] A partial to draw within this menu item for use
20
+ # in declaring a submenu
21
+ # @param url [String] A url where this link should send the user to
22
+ # @param position [Integer] The position in which the menu item should render
23
+ # nil will cause the item to render last
24
+ # @param match_path [String, Regexp, callable] (nil) If the {url} to determine the active tab is ambigous
25
+ # you can pass a String, Regexp or callable to identify this menu item. The callable
26
+ # accepts a request object and returns a Boolean value.
27
+ def initialize(
28
+ sections,
29
+ icon,
30
+ condition: nil,
31
+ label: nil,
32
+ partial: nil,
33
+ url: nil,
34
+ position: nil,
35
+ match_path: nil
36
+ )
37
+
38
+ @condition = condition || -> { true }
39
+ @sections = sections
40
+ @icon = icon
41
+ @label = label || sections.first
42
+ @partial = partial
43
+ @url = url
44
+ @position = position
45
+ @match_path = match_path
46
+ end
47
+
48
+ def url
49
+ if @url.respond_to?(:call)
50
+ @url.call
51
+ else
52
+ @url
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,11 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spree/preferences/configuration'
4
+ require 'spree/backend_configuration/menu_item'
4
5
 
5
6
  module Spree
6
7
  class BackendConfiguration < Preferences::Configuration
7
8
  preference :locale, :string, default: I18n.default_locale
8
9
 
10
+ # @!attribute [rw] themes
11
+ # @return [Hash] A hash containing the themes that are available for the admin panel
12
+ preference :themes, :hash, default: {
13
+ classic: 'spree/backend/all',
14
+ solidus_admin: 'spree/backend/themes/solidus_admin'
15
+ }
16
+
17
+ # @!attribute [rw] theme
18
+ # @return [String] Default admin theme name
19
+ versioned_preference :theme, :string, initial_value: 'classic', boundaries: { "4.1.0.a" => "solidus_admin" }
20
+
21
+ def theme_path(user_theme = nil)
22
+ user_theme ? themes.fetch(user_theme.to_sym) : themes.fetch(theme.to_sym)
23
+ end
24
+
9
25
  preference :frontend_product_path,
10
26
  :proc,
11
27
  default: proc {
@@ -33,49 +49,6 @@ module Spree
33
49
  STOCK_TABS ||= [:stock_items]
34
50
  USER_TABS ||= [:users, :store_credits]
35
51
 
36
- # An item which should be drawn in the admin menu
37
- class MenuItem
38
- attr_reader :icon, :label, :partial, :condition, :sections, :url, :match_path
39
-
40
- attr_accessor :position
41
-
42
- # @param sections [Array<Symbol>] The sections which are contained within
43
- # this admin menu section.
44
- # @param icon [String] The icon to draw for this menu item
45
- # @param condition [Proc] A proc which returns true if this menu item
46
- # should be drawn. If nil, it will be replaced with a proc which always
47
- # returns true.
48
- # @param label [Symbol] The translation key for a label to use for this
49
- # menu item.
50
- # @param partial [String] A partial to draw within this menu item for use
51
- # in declaring a submenu
52
- # @param url [String] A url where this link should send the user to
53
- # @param position [Integer] The position in which the menu item should render
54
- # nil will cause the item to render last
55
- # @param match_path [String, Regexp] (nil) If the {url} to determine the active tab is ambigous
56
- # you can pass a String or Regexp to identify this menu item
57
- def initialize(
58
- sections,
59
- icon,
60
- condition: nil,
61
- label: nil,
62
- partial: nil,
63
- url: nil,
64
- position: nil,
65
- match_path: nil
66
- )
67
-
68
- @condition = condition || -> { true }
69
- @sections = sections
70
- @icon = icon
71
- @label = label || sections.first
72
- @partial = partial
73
- @url = url
74
- @position = position
75
- @match_path = match_path
76
- end
77
- end
78
-
79
52
  # Items can be added to the menu by using code like the following:
80
53
  #
81
54
  # Spree::Backend::Config.configure do |config|
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.0.1
4
+ version: 4.1.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-06-30 00:00:00.000000000 Z
11
+ date: 2023-06-29 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.0.1
19
+ version: 4.1.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.0.1
26
+ version: 4.1.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.0.1
33
+ version: 4.1.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.0.1
40
+ version: 4.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: font-awesome-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -303,17 +303,20 @@ files:
303
303
  - app/assets/stylesheets/spree/backend/components/_stock_table.scss
304
304
  - app/assets/stylesheets/spree/backend/components/_table-filter.scss
305
305
  - app/assets/stylesheets/spree/backend/components/_tabs.scss
306
+ - app/assets/stylesheets/spree/backend/components/index.scss
306
307
  - app/assets/stylesheets/spree/backend/globals/_deprecated_variables.scss
307
308
  - app/assets/stylesheets/spree/backend/globals/_deprecation.scss
308
309
  - app/assets/stylesheets/spree/backend/globals/_functions.scss
309
310
  - app/assets/stylesheets/spree/backend/globals/_mixins.scss
310
311
  - app/assets/stylesheets/spree/backend/globals/_variables.scss
311
312
  - app/assets/stylesheets/spree/backend/globals/_variables_override.scss
313
+ - app/assets/stylesheets/spree/backend/globals/index.scss
312
314
  - app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss
313
315
  - app/assets/stylesheets/spree/backend/globals/mixins/_line_through.scss
314
316
  - app/assets/stylesheets/spree/backend/plugins/_bootstrap_tooltip.scss
315
317
  - app/assets/stylesheets/spree/backend/plugins/_select2.scss
316
318
  - app/assets/stylesheets/spree/backend/plugins/_sortable.scss
319
+ - app/assets/stylesheets/spree/backend/plugins/index.scss
317
320
  - app/assets/stylesheets/spree/backend/sections/_adjustments.scss
318
321
  - app/assets/stylesheets/spree/backend/sections/_bulk_transfer.scss
319
322
  - app/assets/stylesheets/spree/backend/sections/_image_settings.scss
@@ -329,6 +332,7 @@ files:
329
332
  - app/assets/stylesheets/spree/backend/sections/_taxons.scss
330
333
  - app/assets/stylesheets/spree/backend/sections/_users.scss
331
334
  - app/assets/stylesheets/spree/backend/sections/_variants.scss
335
+ - app/assets/stylesheets/spree/backend/sections/index.scss
332
336
  - app/assets/stylesheets/spree/backend/shared/_fonts.scss
333
337
  - app/assets/stylesheets/spree/backend/shared/_forms.scss
334
338
  - app/assets/stylesheets/spree/backend/shared/_header.scss
@@ -338,8 +342,13 @@ files:
338
342
  - app/assets/stylesheets/spree/backend/shared/_tables.scss
339
343
  - app/assets/stylesheets/spree/backend/shared/_typography.scss
340
344
  - app/assets/stylesheets/spree/backend/shared/_utilities.scss
345
+ - app/assets/stylesheets/spree/backend/shared/index.scss
341
346
  - app/assets/stylesheets/spree/backend/spree_admin.scss
342
- - app/assets/stylesheets/spree/backend/themes/blue_steel/globals/_variables_override.scss
347
+ - app/assets/stylesheets/spree/backend/themes/classic.css.scss
348
+ - app/assets/stylesheets/spree/backend/themes/solidus_admin.css.scss
349
+ - app/assets/stylesheets/spree/backend/themes/solidus_admin/_tables.scss
350
+ - app/assets/stylesheets/spree/backend/themes/solidus_admin/_variables.scss
351
+ - app/assets/stylesheets/spree/backend/vendor/index.scss
343
352
  - app/concerns/spree/admin/sets_user_language_locale_key.rb
344
353
  - app/controllers/spree/admin/adjustment_reasons_controller.rb
345
354
  - app/controllers/spree/admin/adjustments_controller.rb
@@ -721,6 +730,7 @@ files:
721
730
  - app/views/spree/admin/zones/new.html.erb
722
731
  - app/views/spree/layouts/admin.html.erb
723
732
  - app/views/spree/layouts/admin_style_guide.html.erb
733
+ - bin/rails
724
734
  - config/initializers/assets.rb
725
735
  - config/initializers/form_builder.rb
726
736
  - config/routes.rb
@@ -731,6 +741,7 @@ files:
731
741
  - lib/spree/backend/config.rb
732
742
  - lib/spree/backend/engine.rb
733
743
  - lib/spree/backend_configuration.rb
744
+ - lib/spree/backend_configuration/menu_item.rb
734
745
  - lib/spree_backend.rb
735
746
  - solidus_backend.gemspec
736
747
  - vendor/assets/fonts/inter/Inter-Regular.woff
@@ -1,25 +0,0 @@
1
- $cerulean: hsl(216, 57, 47);
2
-
3
- $white: hsl(220, 0, 100);
4
- $gray-light: hsl(220, 9, 71);
5
- $gray: hsl(220, 8, 23);
6
- $gray-dark: hsl(220, 12, 18);
7
- $black: hsl(220, 19, 13);
8
-
9
- $color-primary: $cerulean;
10
-
11
- $color-sidebar-bg: $gray;
12
- $color-sidebar-border: very-light(#5498DA, 12); // $color-border
13
- $color-navbar: $gray-light;
14
- $color-navbar-bg: $gray;
15
- $color-navbar-active: $white;
16
- $color-navbar-active-bg: $color-primary;
17
- $color-navbar-submenu: tint($gray-light, 40%);
18
- $color-navbar-submenu-bg: $gray-dark;
19
- $color-navbar-submenu-active: tint($color-primary, 20%);
20
- $color-navbar-footer: $color-navbar;
21
- $color-navbar-footer-active: $color-navbar-active;
22
-
23
- // Sidebar
24
- //--------------------------------------------------------------
25
- $border-sidebar: none;