Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Admin UI update

Damian Legawiec0b6c76252342
diff --git a/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss b/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss
index 5ad98e3d90..4e4d6a00d6 100644
--- a/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss
+++ b/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss
@@ -51,6 +51,7 @@
align-items: center;
justify-content: flex-start;
background: transparent;
+ height: 2rem;
transition-property: background-color, color;
transition-duration: 0.01s;
diff --git a/admin/app/assets/stylesheets/spree/admin/global/_variables.scss b/admin/app/assets/stylesheets/spree/admin/global/_variables.scss
index 870352e321..cfb0f49066 100644
--- a/admin/app/assets/stylesheets/spree/admin/global/_variables.scss
+++ b/admin/app/assets/stylesheets/spree/admin/global/_variables.scss
@@ -62,7 +62,7 @@ $enable-responsive-font-sizes: true;
$font-family-sans-serif: Inter, sans-serif !default;
$font-size-base: 0.875rem !default;
$font-size-plus: 0.875rem !default;
-$font-size-sm: 0.8125rem !default;
+$font-size-sm: 0.75rem !default;
$font-size-lg: 1rem !default;
$font-weight-normal: 400 !default;
$font-weight-medium: 500 !default;
@@ -113,7 +113,7 @@ $box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),0 2px 4px -1px rgba(0, 0, 0, 0.06
$box-shadow-xs: rgba(43, 34, 51, 0.05) 0px 1px 1px !default;
$box-shadow-lg: rgba(0, 5, 13, 0.5) 0px 4px 8px 2px;
$input-box-shadow: $box-shadow-xs !default;
-$btn-box-shadow: $input-box-shadow !default;
+$btn-box-shadow: $box-shadow-xs !default;
$btn-font-weight: $font-weight-medium !default;
@@ -168,15 +168,15 @@ $display4-weight: 400 !default;
$dropdown-bg: $white !default;
$dropdown-border-width: 0px !default;
$dropdown-border-radius: 1rem !default;
-$dropdown-inner-border-radius: 0.75rem !default;
+$dropdown-inner-border-radius: 0.8rem !default;
$dropdown-link-hover-bg: rgba($gray-100, 0.5) !default;
-$dropdown-box-shadow: 0px 0px 0px 1px $gray-200, 0px 6px 12px -3px rgba($gray-300, 0.35), 0px 6px 18px 0px rgba($gray-300, 0.35) !default;
+$dropdown-box-shadow: 0px 0px 0px 1px rgba($gray-300, 0.5), 0px 6px 12px -3px rgba($gray-300, 0.35), 0px 6px 18px 0px rgba($gray-300, 0.35) !default;
$dropdown-padding-x: 0.25rem !default;
$dropdown-padding-y: 0.25rem !default;
$dropdown-divider-bg: $gray-50 !default;
$dropdown-divider-margin-y: 0.25rem !default;
$dropdown-header-color: $text-muted !default;
-$dropdown-item-padding-y: 0.35rem !default;
+$dropdown-item-padding-y: 0.5rem !default;
$dropdown-item-padding-x: 0.65rem !default;
$zindex-dropdown: 1050;
@@ -215,7 +215,7 @@ $embed-responsive-aspect-ratios: (
) !default;
// tables
-$table-cell-padding: 1.15rem .75rem !default;
+$table-cell-padding: 1rem .75rem !default;
$code-color: $body-color !default;
$code-bg: $gray-50 !default;
diff --git a/admin/app/assets/stylesheets/spree/admin/shared/_base.scss b/admin/app/assets/stylesheets/spree/admin/shared/_base.scss
index afd12bb14b..28e0d9dac2 100644
--- a/admin/app/assets/stylesheets/spree/admin/shared/_base.scss
+++ b/admin/app/assets/stylesheets/spree/admin/shared/_base.scss
@@ -4,11 +4,10 @@ html {
letter-spacing: normal;
text-rendering: optimizeLegibility;
text-size-adjust: 100%;
- line-height: 1;
}
body {
@extend .h-100;
- overflow-y:scroll;
+ overflow-y: scroll;
}
body * {
@@ -164,7 +163,7 @@ strong {
}
.focus-shadow {
&:focus, &:focus-within, &:active {
- box-shadow: $input-btn-focus-box-shadow;
+ box-shadow: $input-focus-box-shadow;
}
}
.focus-border {
diff --git a/admin/app/assets/stylesheets/spree/admin/shared/_forms.scss b/admin/app/assets/stylesheets/spree/admin/shared/_forms.scss
index 0160e9ad57..abec411427 100644
--- a/admin/app/assets/stylesheets/spree/admin/shared/_forms.scss
+++ b/admin/app/assets/stylesheets/spree/admin/shared/_forms.scss
@@ -3,6 +3,9 @@
border-color: $input-border-color;
box-shadow: $input-box-shadow;
}
+.custom-checkbox .custom-control-label::before, .custom-checkbox .custom-control-label::after {
+ top: 0rem;
+}
label {
font-weight: $font-weight-medium;
diff --git a/admin/app/models/spree/admin/form_builder.rb b/admin/app/models/spree/admin/form_builder.rb
index 703a044c1f..5d220e8f9b 100644
--- a/admin/app/models/spree/admin/form_builder.rb
+++ b/admin/app/models/spree/admin/form_builder.rb
@@ -30,7 +30,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.text_field(@object_name, method, objectify_options(options)) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -44,7 +44,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.number_field(@object_name, method, objectify_options(options)) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -58,7 +58,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.email_field(@object_name, method, objectify_options(options)) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -72,7 +72,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.date_field(@object_name, method, objectify_options(options)) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -86,7 +86,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.datetime_field(@object_name, method, objectify_options(options)) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -107,7 +107,7 @@ module Spree
@template.label(@object_name, method, get_label(method, options)) +
@template.text_area(@object_name, method, objectify_options(options)) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -122,7 +122,7 @@ module Spree
@template.content_tag(:div, class: 'trix-container') do
@template.rich_text_area(@object_name, method, objectify_options(options))
end +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -147,7 +147,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.select(@object_name, method, choices, objectify_options(options), html_options, &block) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -173,7 +173,7 @@ module Spree
@template.content_tag(:div, class: 'form-group') do
@template.label(@object_name, method, get_label(method, options)) +
@template.collection_select(@object_name, method, collection, value_method, text_method, objectify_options(options), html_options) +
- @template.error_message_on(@object_name, method) + field_help(method, options)
+ @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -187,7 +187,7 @@ module Spree
@template.content_tag(:div, class: 'custom-control custom-checkbox') do
@template.check_box(@object_name, method, objectify_options(options.merge(class: 'custom-control-input'))) +
@template.label(@object_name, method, get_label(method, options), class: 'custom-control-label')
- end + @template.error_message_on(@object_name, method) + field_help(method, options)
+ end + @template.error_message_on(@object_name, method) + field_help(method, options.merge!(class: 'form-text mt-2 ml-4'))
end
end
@@ -204,7 +204,7 @@ module Spree
@template.content_tag(:div, class: 'custom-control custom-radio') do
@template.radio_button(@object_name, method, tag_value, objectify_options(options.merge(class: 'custom-control-input'))) +
@template.label(@object_name, method, get_label(method, options), class: 'custom-control-label', for: options[:id])
- end + @template.error_message_on(@object_name, method) + field_help(method, options)
+ end + @template.error_message_on(@object_name, method) + field_help(method, options.merge(class: 'form-text mt-2'))
end
end
@@ -215,7 +215,8 @@ module Spree
# @option options [String] :help help text to display
# @return [String] HTML string containing the help text or empty string
def field_help(_method, options = {})
- @template.content_tag(:span, options[:help], class: 'form-text mt-2')
+ options[:class] ||= 'form-text mt-2'
+ @template.content_tag(:span, options[:help], class: options[:class])
end
private
diff --git a/admin/app/views/spree/admin/orders/_header.html.erb b/admin/app/views/spree/admin/orders/_header.html.erb
index 56a374ead7..c98bc9039b 100644
--- a/admin/app/views/spree/admin/orders/_header.html.erb
+++ b/admin/app/views/spree/admin/orders/_header.html.erb
@@ -41,8 +41,6 @@
can?(:create, Spree::CustomerReturn) && @order.return_authorizations.exists? %>
<% if can_create_ra || can_create_cr %>
- <div class="dropdown-divider"></div>
-
<% if can_create_ra %>
<%= link_to_with_icon "plus", Spree.t(:new_return_authorization),
spree.new_admin_order_return_authorization_path(@order),
@@ -54,8 +52,6 @@
spree.new_admin_order_customer_return_path(@order),
class: "btn dropdown-item" %>
<% end %>
-
- <div class="dropdown-divider"></div>
<% end %>
<% end %>
@@ -69,6 +65,5 @@
<%= icon "cancel" %>
<%= Spree.t(:cancel_order) %>
<% end %>
- <div class="dropdown-divider"></div>
<% end %>
<% end %>
diff --git a/admin/app/views/spree/admin/products/edit.html.erb b/admin/app/views/spree/admin/products/edit.html.erb
index 16c8c6cdc8..f1ce29ee20 100644
--- a/admin/app/views/spree/admin/products/edit.html.erb
+++ b/admin/app/views/spree/admin/products/edit.html.erb
@@ -8,8 +8,6 @@
<%= render_admin_partials(:product_dropdown_partials, product: @product) %>
- <div class="dropdown-divider"></div>
-
<%= external_page_preview_link(@product) %>
<% if can?(:clone, @product) %>
diff --git a/admin/app/views/spree/admin/promotions/form/_kind.html.erb b/admin/app/views/spree/admin/promotions/form/_kind.html.erb
index ae85448937..f546694c51 100644
--- a/admin/app/views/spree/admin/promotions/form/_kind.html.erb
+++ b/admin/app/views/spree/admin/promotions/form/_kind.html.erb
@@ -9,7 +9,7 @@
<%= f.radio_button :multi_codes, false, data: { action: 'change->reveal#toggle' }, class: 'custom-control-input' %>
<%= f.label :multi_codes_false, class: 'custom-control-label' do %>
One code for all customers
- <span class="form-text font-weight-normal mr-1">
+ <span class="form-text font-weight-normal mr-1 mt-2">
You can limit the number of times this code can be used.
</span>
<% end %>
@@ -22,7 +22,7 @@
<%= f.radio_button :multi_codes, true, data: { action: 'change->reveal#toggle' }, class: 'custom-control-input' %>
<%= f.label :multi_codes_true, class: 'custom-control-label' do %>
Generate unique codes
- <span class="form-text font-weight-normal mr-1">
+ <span class="form-text font-weight-normal mr-1 mt-2">
These codes are generated automatically and can be downloaded as a CSV file. Codes are unique and can only be used once.
</span>
<% end %>
@@ -30,7 +30,7 @@
<div data-reveal-target="item" class="ml-3 mt-2 row <% unless @promotion.multi_codes? %>hidden<% end %>">
<div class="col-6">
<%= f.text_field :code_prefix, class: 'form-control text-uppercase', placeholder: 'Coupon Prefix (optional)' %>
- <span class="form-text">
+ <span class="form-text mt-2">
eg. <strong>ABC</strong>
</span>
</div>
@@ -38,7 +38,7 @@
<% minimum_number_of_codes = @promotion.persisted? && @promotion.coupon_codes.count.positive? ? @promotion.coupon_codes.count : 1 %>
<% maximum_number_of_codes = ENV.fetch('PROMOTION_MAX_NUMBER_OF_CODES', 5000) %>
<%= f.number_field :number_of_codes, class: 'form-control', placeholder: 'Number of codes', min: minimum_number_of_codes, max: maximum_number_of_codes, step: 1 %>
- <span class="form-text">
+ <span class="form-text mt-2">
How many codes you want to generate.
<% if @promotion.persisted? %>
To add more codes just increase this number
diff --git a/admin/app/views/spree/admin/shared/_content_header.html.erb b/admin/app/views/spree/admin/shared/_content_header.html.erb
index f6bc772e35..0c50e2f613 100644
--- a/admin/app/views/spree/admin/shared/_content_header.html.erb
+++ b/admin/app/views/spree/admin/shared/_content_header.html.erb
@@ -27,7 +27,10 @@
<%= icon 'dots-vertical', class: 'mr-0' %>
<% end %>
<%= dropdown_menu id: 'page_actions_dropdown_menu' do %>
- <%= yield :page_actions_dropdown if content_for(:page_actions_dropdown) %>
+ <% if content_for?(:page_actions_dropdown) %>
+ <%= yield :page_actions_dropdown %>
+ <div class="dropdown-divider"></div>
+ <% end %>
<% if record && record.persisted? %>
<%= link_to_edit_metafields(record) %>
<%= link_to_edit_translations(record) %>
diff --git a/admin/app/views/spree/admin/stores/form/_checkout_links.html.erb b/admin/app/views/spree/admin/stores/form/_checkout_links.html.erb
index 65a62e82a8..df3f0d77d8 100644
--- a/admin/app/views/spree/admin/stores/form/_checkout_links.html.erb
+++ b/admin/app/views/spree/admin/stores/form/_checkout_links.html.erb
@@ -11,7 +11,7 @@
>
<%= turbo_frame_tag spree_dom_id(link), class: 'd-flex align-items-center w-100 py-2 pl-3 pr-2' do %>
<%= link_to link.label, spree.edit_admin_page_link_path(link), class: 'd-block text-dark flex-fill' %>
- <button class="btn btn-sm pr-0 handle shadow-none hover-grayh-100 px-1">
+ <button class="btn btn-sm pr-0 handle shadow-none hover-gray-200 px-1">
<%= icon 'grip-vertical', class: 'mr-0' %>
</button>
<% end %>