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 (#12406)

Damian Legawiecff438962fc64
diff --git a/admin/app/assets/stylesheets/spree/admin/components/_buttons.scss b/admin/app/assets/stylesheets/spree/admin/components/_buttons.scss
index 455dbfc85c..43b4e9054f 100644
--- a/admin/app/assets/stylesheets/spree/admin/components/_buttons.scss
+++ b/admin/app/assets/stylesheets/spree/admin/components/_buttons.scss
@@ -109,6 +109,7 @@
.btn-link {
color: $primary !important;
+ border-color: $border-color;
&:hover, &:focus {
text-decoration: none !important;
@@ -183,7 +184,7 @@
color: $gray-200;
&:hover, &:focus {
- background-color: $gray-600 !important;
+ background: linear-gradient($gray-900, $primary) !important;
border-color: $gray-700 !important;
color: $white !important;
}
diff --git a/admin/app/assets/stylesheets/spree/admin/components/_variants_form.scss b/admin/app/assets/stylesheets/spree/admin/components/_variants_form.scss
index e324dd8f70..57ad5bebf0 100644
--- a/admin/app/assets/stylesheets/spree/admin/components/_variants_form.scss
+++ b/admin/app/assets/stylesheets/spree/admin/components/_variants_form.scss
@@ -13,10 +13,7 @@
&:not(:has(.options-creator__options_container .options-creator__option)) {
margin: 0;
border: none;
-
- .new_option_button {
- border: 0 none;
- }
+
.options-creator__option--new {
padding-left: 1rem;
}
diff --git a/admin/app/views/spree/admin/dashboard/analytics.html.erb b/admin/app/views/spree/admin/dashboard/analytics.html.erb
index 88e67db1d2..65b09668e0 100644
--- a/admin/app/views/spree/admin/dashboard/analytics.html.erb
+++ b/admin/app/views/spree/admin/dashboard/analytics.html.erb
@@ -6,7 +6,7 @@
<div class="card mb-4"
data-controller="tabs"
data-tabs-active-tab-class="active">
- <div class="card-header d-block border-0 h-auto">
+ <div class="card-header d-block border-0 h-auto p-2">
<div class="row">
<div class="col-6 col-lg-4 pr-2">
<div class="rounded cursor-pointer p-2 hover-light h-100 active" data-tabs-target="tab" data-action="click->tabs#change">
@@ -72,7 +72,7 @@
</div>
</div>
</div>
- <div class="card-body">
+ <div class="card-body p-2">
<div class="tab-content">
<div data-tabs-target="panel" data-index="1">
<% if currency_money(current_currency).symbol_first? %>
diff --git a/admin/app/views/spree/admin/oauth_applications/index.html.erb b/admin/app/views/spree/admin/oauth_applications/index.html.erb
index a8701ba27d..dcb3fc5157 100644
--- a/admin/app/views/spree/admin/oauth_applications/index.html.erb
+++ b/admin/app/views/spree/admin/oauth_applications/index.html.erb
@@ -1,9 +1,9 @@
<%= render 'spree/admin/shared/developers_nav' %>
-<%= content_for(:title, 'API Keys') %>
+<%= content_for(:title, Spree.t('admin.oauth_applications.list')) %>
<% content_for :page_actions do %>
- <%= button_link_to 'New API key', new_object_url, class: "btn-primary", icon: 'plus' %>
+ <%= button_link_to Spree.t('admin.oauth_applications.new'), new_object_url, class: "btn-primary", icon: 'plus' %>
<% end if can? :create, Spree::OauthApplication %>
<%= content_for :page_alerts do %>
@@ -16,7 +16,7 @@
<% end %>
<% if @oauth_applications.any? %>
- <div class="table-responsive rounded border mt-4 bg-white shadow-xs">
+ <div class="table-responsive rounded border mt-4 bg-white">
<table class="table">
<thead class="text-muted">
<tr>
@@ -30,7 +30,7 @@
<tbody>
<% @oauth_applications.each do |application| %>
<tr id="<%= spree_dom_id application %>">
- <td class="w-20"><%= application.name %></td>
+ <td class="w-20"><code><%= application.name %></code></td>
<td class="w-40">
<div class="input-group" data-controller="password-toggle">
<%= button_tag class: 'btn hover-gray px-1', data: { action: 'click->password-toggle#password' } do %>
@@ -43,18 +43,18 @@
<% if application.scopes.include?('write') %>
<span class="badge badge-warning">
<%= icon('pencil', class: 'mr-1') %>
- Read & Write
+ <%= Spree.t('admin.oauth_applications.read_and_write') %>
</span>
<% else %>
<span class="badge badge-light">
<%= icon('eye', class: 'mr-1') %>
- Read Only
+ <%= Spree.t('admin.oauth_applications.read_only') %>
</span>
<% end %>
</td>
<td class="w-15">
<% if application.last_used_at %>
- <%= application.last_used_at.to_s %>
+ <%= local_time(application.last_used_at) %>
<% else %>
<span class="text-muted"><%= Spree.t('admin.oauth_applications.never') %></span>
<% end %>
diff --git a/admin/app/views/spree/admin/oauth_applications/new.html.erb b/admin/app/views/spree/admin/oauth_applications/new.html.erb
index 659b796814..0abdf22d5f 100644
--- a/admin/app/views/spree/admin/oauth_applications/new.html.erb
+++ b/admin/app/views/spree/admin/oauth_applications/new.html.erb
@@ -1,10 +1,10 @@
<%= content_for :title do %>
- <%= Spree.t(:new_oauth_application) %>
+ <%= Spree.t('admin.oauth_applications.new') %>
<% end %>
<% content_for :page_title do %>
<%= page_header_back_button spree.admin_oauth_applications_url %>
- <%= Spree.t(:new_oauth_application) %>
+ <%= Spree.t('admin.oauth_applications.new') %>
<% end %>
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @oauth_application } %>
diff --git a/admin/app/views/spree/admin/orders/_line_items.html.erb b/admin/app/views/spree/admin/orders/_line_items.html.erb
index ed72283f4d..6957f8f012 100644
--- a/admin/app/views/spree/admin/orders/_line_items.html.erb
+++ b/admin/app/views/spree/admin/orders/_line_items.html.erb
@@ -57,8 +57,10 @@
</div>
</div>
<% elsif can?(:create, Spree::LineItem.new(order: @order)) %>
- <div data-toggle="modal" data-target="#modal">
- <%= link_to_with_icon 'plus', Spree.t(:new_line_item), spree.new_admin_order_line_item_path(@order), data: { turbo_frame: :dialog_modal }, class: "btn btn-link w-100 py-3" %>
+ <div class="card-body">
+ <div data-toggle="modal" data-target="#modal">
+ <%= link_to_with_icon 'plus', Spree.t(:new_line_item), spree.new_admin_order_line_item_path(@order), data: { turbo_frame: :dialog_modal }, class: "btn btn-link w-100 py-3" %>
+ </div>
</div>
<% end %>
<% end %>
diff --git a/admin/app/views/spree/admin/products/_empty_list.html.erb b/admin/app/views/spree/admin/products/_empty_list.html.erb
index 1c2f410d39..3ba1cc2819 100644
--- a/admin/app/views/spree/admin/products/_empty_list.html.erb
+++ b/admin/app/views/spree/admin/products/_empty_list.html.erb
@@ -1,3 +1 @@
-<div class="text-muted p-5 d-flex align-items-center w-100 justify-content-center">
- <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Product)) %>.
-</div>
+<%= render 'spree/admin/shared/no_resource_found' %>
diff --git a/admin/app/views/spree/admin/reports/index.html.erb b/admin/app/views/spree/admin/reports/index.html.erb
index ecf2b453fe..d0e2af82ba 100644
--- a/admin/app/views/spree/admin/reports/index.html.erb
+++ b/admin/app/views/spree/admin/reports/index.html.erb
@@ -18,7 +18,7 @@
<%= Spree.t("report_names.#{report_type}") %>
</td>
<td class="text-right w-10">
- <%= link_to Spree.t(:show_report), spree.new_admin_report_path(type: report_type), class: 'btn btn-primary btn-sm', data: { row_link_target: :link } %>
+ <%= link_to Spree.t(:show_report), spree.new_admin_report_path(type: report_type), class: 'btn btn-light btn-sm', data: { row_link_target: :link } %>
</td>
</tr>
<% end %>
diff --git a/admin/app/views/spree/admin/shared/_analytics_loader_skeleton.html.erb b/admin/app/views/spree/admin/shared/_analytics_loader_skeleton.html.erb
index 53438f5ee6..53457020a4 100644
--- a/admin/app/views/spree/admin/shared/_analytics_loader_skeleton.html.erb
+++ b/admin/app/views/spree/admin/shared/_analytics_loader_skeleton.html.erb
@@ -1,8 +1,8 @@
<div class="card mb-4">
- <div class="card-header d-block border-0 h-auto">
+ <div class="card-header d-block border-0 h-auto p-2">
<div class="row">
<div class="col-6 col-lg-4 pr-1">
- <div class="rounded cursor-pointer p-2 hover-light h-100 active">
+ <div class="rounded cursor-pointer p-2 hover-light h-100 active" style="min-height: 82px;">
<div class="d-flex justify-content-center flex-column mb-3 mb-lg-0">
<span class="font-size-sm text-muted">Total Sales</span>
<span class="font-size-lg text-dark font-weight-bold mt-1">
@@ -65,7 +65,7 @@
</div>
</div>
</div>
- <div class="card-body">
+ <div class="card-body p-2">
<div class="tab-content d-flex align-items-center justify-content-center" id="pills-tabContent" style="height: 300px">
<div class="spinner-border text-muted align-middle opacity-50" role="status">
<span class="sr-only"><%= Spree.t(:loading) %>...</span>
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 88981fd3e1..ec20db0c3d 100644
--- a/admin/app/views/spree/admin/shared/_content_header.html.erb
+++ b/admin/app/views/spree/admin/shared/_content_header.html.erb
@@ -32,7 +32,7 @@
<div class="dropdown-menu dropdown-menu-right">
<%= yield :page_actions_dropdown if content_for(:page_actions_dropdown) %>
<% if record %>
- <% if record.respond_to?(:audits) %>
+ <% if record.respond_to?(:audits) && spree.respond_to?(:admin_audits_path) %>
<a href="<%= spree.admin_audits_path(q: { auditable_id_eq: record.id, auditable_type_eq: record.class.to_s }) %>" target="_blank" class="dropdown-item">
<%= icon 'history' %>
<%= Spree.t(:audit_log) %>
diff --git a/admin/app/views/spree/admin/shared/_no_resource_found.html.erb b/admin/app/views/spree/admin/shared/_no_resource_found.html.erb
index b7abe7b167..45f87d56e4 100644
--- a/admin/app/views/spree/admin/shared/_no_resource_found.html.erb
+++ b/admin/app/views/spree/admin/shared/_no_resource_found.html.erb
@@ -1,4 +1,6 @@
+<% resource_name = model_class.name.underscore.humanize %>
+
<div class="text-muted p-5 d-flex align-items-center w-100 justify-content-center">
- <%= Spree.t(:no_resource_found, resource: plural_resource_name(model_class)) %>
- <%= link_to_with_icon 'plus', Spree.t(:add_one), new_object_url, class: 'btn btn-link ml-3' if can?(:create, model_class) %>
+ <%= Spree.t(:no_resource_found, resource: resource_name) %>
+ <%= link_to_with_icon 'plus', Spree.t(:add_one), new_object_url, class: 'btn btn-light ml-3' if can?(:create, model_class) && defined?(new_object_url) %>
</div>
\ No newline at end of file
diff --git a/admin/app/views/spree/admin/shared/_sidebar.html.erb b/admin/app/views/spree/admin/shared/_sidebar.html.erb
index 7919068685..f7ee2ad765 100644
--- a/admin/app/views/spree/admin/shared/_sidebar.html.erb
+++ b/admin/app/views/spree/admin/shared/_sidebar.html.erb
@@ -18,7 +18,7 @@
<% end %>
</div>
- <div class="position-sticky d-none d-lg-block w-100 z-index-1000 border-top border-gray-800 mt-auto py-2 bottom-0">
+ <div class="position-sticky d-none d-lg-block w-100 z-index-1000 mt-auto py-2 bottom-0">
<%= render 'spree/admin/shared/user_dropdown' %>
</div>
</div>
\ No newline at end of file
diff --git a/admin/app/views/spree/admin/shared/_user_dropdown.html.erb b/admin/app/views/spree/admin/shared/_user_dropdown.html.erb
index 69b6fbaa91..336d61852b 100644
--- a/admin/app/views/spree/admin/shared/_user_dropdown.html.erb
+++ b/admin/app/views/spree/admin/shared/_user_dropdown.html.erb
@@ -1,12 +1,12 @@
<% 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>
<button type="button"
- class="btn border-dark rounded-lg border-0 d-flex align-items-center justify-content-between text-left text-gray-400 w-100 p-2"
+ class="btn btn-dark d-flex align-items-center justify-content-between text-left w-100 border-transparent"
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">
- <%= try_spree_current_user.name&.full&.truncate(15) %><br />
+ <%= 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>
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.erb
index 24e977893e..0031cb7b5e 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
@@ -56,9 +56,11 @@
<li class="nav-item">
<%= active_link_to_with_icon('map-pin', Spree.t(:stock_locations), spree.admin_stock_locations_path, class: 'nav-link') %>
</li>
- <li class="nav-item">
- <%= active_link_to_with_icon('history', Spree.t(:audit_trail), spree.admin_audits_path, class: 'nav-link w-auto', active: %w[audits exports imports].include?(controller_name)) %>
- </li>
+ <% if spree.respond_to?(:admin_audits_path) %>
+ <li class="nav-item">
+ <%= active_link_to_with_icon('history', Spree.t(:audit_trail), spree.admin_audits_path, class: 'nav-link w-auto', active: %w[audits exports imports].include?(controller_name)) %>
+ </li>
+ <% end %>
<li class="nav-item">
<%= active_link_to_with_icon('terminal', Spree.t(:developers), spree.admin_oauth_applications_path, class: 'nav-link', active: %w[oauth_applications webhooks_subscribers].include?(controller_name)) %>
</li>
@@ -153,9 +155,9 @@
<% 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 text-white font-size-sm py-2 px-1 d-flex align-items-center justify-content-between">
- <span>Community Edition</span>
- <%= link_to_with_icon 'external-link', 'Upgrade', 'https://spreecommerce.org/pricing/', class: 'btn btn-sm btn-outline-primary 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 class="bg-transparent border-top border-dark pt-2 pl-1 d-flex align-items-center justify-content-between">
+ <span class="font-weight-light font-size-sm text-white">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 %>
diff --git a/admin/app/views/spree/admin/stores/form/_basic.html.erb b/admin/app/views/spree/admin/stores/form/_basic.html.erb
index 6415e9479a..042d0c058a 100644
--- a/admin/app/views/spree/admin/stores/form/_basic.html.erb
+++ b/admin/app/views/spree/admin/stores/form/_basic.html.erb
@@ -83,7 +83,7 @@
<div class="form-group">
<%= f.label :default_country_iso, Spree.t('i18n.country') %>
- <%= f.country_select :default_country_iso, {}, { data: { controller: 'autocomplete-select' } } %>
+ <%= f.collection_select :default_country_iso, Spree::Country.pluck(:iso, :name), :first, :last, {}, { data: { controller: 'autocomplete-select' } } %>
<%= f.error_message_on :default_country_iso %>
</div>
<div class="form-group">
diff --git a/admin/app/views/spree/admin/taxonomies/show.html.erb b/admin/app/views/spree/admin/taxonomies/show.html.erb
index 265390a24d..fc977c112e 100644
--- a/admin/app/views/spree/admin/taxonomies/show.html.erb
+++ b/admin/app/views/spree/admin/taxonomies/show.html.erb
@@ -20,10 +20,7 @@
<%= build_sortable_tree(@taxonomy, root_children) %>
<% end %>
<% else %>
- <div class="text-muted p-5 d-flex align-items-center w-100 justify-content-center">
- <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Taxon)) %>
- <%= link_to_with_icon 'plus', Spree.t(:add_one), spree.new_admin_taxonomy_taxon_path(@taxonomy), class: 'btn btn-link' if can?(:create, Spree::Taxon) %>
- </div>
+ <%= render 'spree/admin/shared/no_resource_found', resource_name: Spree.t(:taxons), new_object_url: spree.new_admin_taxonomy_taxon_path(@taxonomy) %>
<% end %>
</div>
</div>
diff --git a/admin/app/views/spree/admin/variants/form/_inventory.html.erb b/admin/app/views/spree/admin/variants/form/_inventory.html.erb
index aec8fb77b3..b5b17f9fc1 100644
--- a/admin/app/views/spree/admin/variants/form/_inventory.html.erb
+++ b/admin/app/views/spree/admin/variants/form/_inventory.html.erb
@@ -39,7 +39,7 @@
</tbody>
</table>
<div class="card-footer text-center bg-gray-25 text-muted">
- <%= Spree.t('admin.variants.stock_locations_link', link: spree.admin_stock_locations_path).html_safe %>
+ <%= Spree.t('admin.variants_form.stock_locations_link', link: spree.admin_stock_locations_path).html_safe %>
</div>
</div>
</div>
\ No newline at end of file
diff --git a/admin/app/views/spree/admin/variants/form/_pricing.html.erb b/admin/app/views/spree/admin/variants/form/_pricing.html.erb
index d23965b05d..f1e95bb816 100644
--- a/admin/app/views/spree/admin/variants/form/_pricing.html.erb
+++ b/admin/app/views/spree/admin/variants/form/_pricing.html.erb
@@ -18,7 +18,7 @@
</th>
<th>
<%= Spree.t(:compare_at_amount) %>
- <%= help_bubble(Spree.t(:compare_at_price_description)) %>
+ <%= help_bubble(Spree.t('admin.variants_form.compare_at_price_description')) %>
</th>
</tr>
</thead>
diff --git a/admin/config/locales/en.yml b/admin/config/locales/en.yml
index d79641fdd0..f43c92b044 100644
--- a/admin/config/locales/en.yml
+++ b/admin/config/locales/en.yml
@@ -156,10 +156,14 @@ en:
payment_link_sent: Payment link was sent to the customer
no_email_present: Please add an email address to send the payment link
oauth_applications:
- list: oAuth applications
- new: New oAuth application
+ list: API keys
+ new: New API key
uid: UID
scopes: Scopes
+ last_used: Last used
+ never: Never
+ read_only: Read Only
+ read_and_write: Read & Write
documentation_message: 'To learn how to authenticate requests to the Platform API, '
documentation_cta: see the documentation
reports:
@@ -336,10 +340,16 @@ en:
variants:
option_types_link: To add more option types please go to <a href="%{link}">Option Types</a>
variants:
- currencies_link: To add more currencies, go to <a href="%{link}">Store Settings</a>
- stock_locations_link: To add more stock locations please go to <a href="%{link}">Stock Locations</a>
search_results:
no_variants: We couldn't find any variants matching your search :(
+ variants_form:
+ currencies_link: To add more currencies, go to <a href="%{link}">Store Settings</a>
+ stock_locations_link: To add more stock locations please go to <a href="%{link}">Stock Locations</a>
+ compare_at_price_description: This price is used to shown marked price on the product page.
+ add_option:
+ empty: Add options like size or color
+ not_empty: Add another option
+ total_inventory_html: "Total inventory at %{stock_location} location: %{count} available"
page_builder:
show_more_button: Show explore category button
heading: Heading
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index e2bf7ff105..d9a6287f2d 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -70,6 +70,7 @@ en:
state: State
total: Total
considered_risky: Risky
+ item_count: Items
spree/order/bill_address:
address1: Billing address street
city: Billing address city
@@ -1325,15 +1326,18 @@ en:
payment_provider_settings: Payment Provider Settings
payment_state: Payment State
payment_states:
- balance_due: balance due
- checkout: checkout
- completed: completed
- credit_owed: credit owed
- failed: failed
- paid: paid
- pending: pending
- processing: processing
- void: void
+ balance_due: Balance due
+ checkout: Checkout
+ credit_owed: Credit owed
+ failed: Failed
+ paid: Paid
+ void: Void
+ complete: Complete
+ completed: Completed
+ pending: Pending
+ processing: Processing
+ refunded: Refunded
+ partially_refunded: Partially Refunded
payment_type: Payment type
payment_updated: Payment Updated
payments: Payments
@@ -1608,12 +1612,12 @@ en:
shipment_successfully_shipped: Shipment successfully shipped
shipment_state: Shipment State
shipment_states:
- backorder: backorder
- canceled: canceled
- partial: partial
- pending: pending
- ready: ready
- shipped: shipped
+ backorder: Backorder
+ canceled: Canceled
+ partial: Partial
+ pending: Unfulfilled
+ ready: Unfulfilled
+ shipped: Fulfilled
shipment_transfer_success: 'Variants successfully transferred'
shipment_transfer_error: 'There was an error transferring variants'
shipments: Shipments
@@ -1856,6 +1860,7 @@ en:
transfer_stock: Transfer Stock
transfer_to_location: Transfer To
translations: Translations
+ translations_for: "%{resource_name} translations"
tree: Tree
type: Type
type_to_search: Type to search