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.

Small improvements for new admin dashboard

Damian Legawiec48f366289aba
diff --git a/admin/app/assets/tailwind/spree/admin/components/_forms.css b/admin/app/assets/tailwind/spree/admin/components/_forms.css
index 13b1f00666..88feaa6dd0 100644
--- a/admin/app/assets/tailwind/spree/admin/components/_forms.css
+++ b/admin/app/assets/tailwind/spree/admin/components/_forms.css
@@ -99,6 +99,9 @@
.input-group > input {
@apply text-base border-0 focus:ring-0 focus:outline-none rounded-lg;
}
+ .input-group-append {
+ @apply px-3 text-center;
+ }
/* File input */
input[type="file"] {
diff --git a/admin/app/views/spree/admin/custom_domains/index.html.erb b/admin/app/views/spree/admin/custom_domains/index.html.erb
index 541ed38431..aef742ac80 100644
--- a/admin/app/views/spree/admin/custom_domains/index.html.erb
+++ b/admin/app/views/spree/admin/custom_domains/index.html.erb
@@ -20,9 +20,9 @@
<%= form_for current_store, url: spree.admin_store_path, data: { turbo: false, controller: 'enable-button', 'enable-button-disable-when-not-changed-value': true } do |f| %>
<% if Spree.root_domain.present? %>
<div class="flex items-center gap-6">
- <div class="input-group <% if current_store.custom_domains.any? %>disabled<% end %>">
- <span class="text-gray-600">https://</span>
- <%= f.text_field :code, class: 'border-0 focus:ring-0 focus:outline-none grow rounded-lg text-base', data: { enable_button_target: 'input' }, required: true, disabled: current_store.custom_domains.any? %>
+ <div class="input-group pr-2 grow <% if current_store.custom_domains.any? %>disabled<% end %>">
+ <span class="text-gray-400 pl-3 pr-0">https://</span>
+ <%= f.text_field :code, class: 'border-0 focus:ring-0 focus:outline-none grow rounded-lg text-base pl-0', data: { enable_button_target: 'input' }, required: true, disabled: current_store.custom_domains.any? %>
<span>.<%= Spree.root_domain %></span>
<%= clipboard_component(current_store.formatted_url) %>
diff --git a/admin/app/views/spree/admin/dashboard/setup_tasks/_set_customer_support_email.html.erb b/admin/app/views/spree/admin/dashboard/setup_tasks/_set_customer_support_email.html.erb
index 04b27cf45d..605a922b82 100644
--- a/admin/app/views/spree/admin/dashboard/setup_tasks/_set_customer_support_email.html.erb
+++ b/admin/app/views/spree/admin/dashboard/setup_tasks/_set_customer_support_email.html.erb
@@ -15,9 +15,7 @@
<%= f.label :customer_support_email, 'Customer support email' %>
<%= f.email_field :customer_support_email, class: 'form-input', required: true %>
</div>
- <div class="flex justify-between">
- <%= turbo_save_button_tag %>
- </div>
+ <%= turbo_save_button_tag %>
<% end %>
<% end %>
<% end %>
\ No newline at end of file
diff --git a/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_payment_method.html.erb b/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_payment_method.html.erb
index 6b5d137edb..8686effd34 100644
--- a/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_payment_method.html.erb
+++ b/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_payment_method.html.erb
@@ -4,5 +4,7 @@
</p>
<% else %>
<p><%= Spree.t('admin.store_setup_tasks.payment_methods.copy') %></p>
- <%= link_to Spree.t('admin.store_setup_tasks.payment_methods.setup'), spree.admin_payment_methods_path, class: 'btn btn-primary', data: { turbo_frame: '_top' } %>
+ <div>
+ <%= link_to Spree.t('admin.store_setup_tasks.payment_methods.setup'), spree.admin_payment_methods_path, class: 'btn btn-primary', data: { turbo_frame: '_top' } %>
+ </div>
<% end %>
\ No newline at end of file
diff --git a/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_taxes_collection.html.erb b/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_taxes_collection.html.erb
index 667cdbba35..1981dcddde 100644
--- a/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_taxes_collection.html.erb
+++ b/admin/app/views/spree/admin/dashboard/setup_tasks/_setup_taxes_collection.html.erb
@@ -2,5 +2,7 @@
<p><%= Spree.t('admin.store_setup_tasks.taxes.done', link: spree.admin_tax_rates_path).html_safe %></p>
<% else %>
<p><%= Spree.t('admin.store_setup_tasks.taxes.copy') %></p>
- <%= link_to Spree.t('admin.store_setup_tasks.taxes.setup'), spree.admin_tax_rates_path, class: 'btn btn-primary', data: { turbo_frame: '_top' } %>
+ <div>
+ <%= link_to Spree.t('admin.store_setup_tasks.taxes.setup'), spree.admin_tax_rates_path, class: 'btn btn-primary', data: { turbo_frame: '_top' } %>
+ </div>
<% end %>
diff --git a/admin/app/views/spree/admin/metafield_definitions/_table_row.html.erb b/admin/app/views/spree/admin/metafield_definitions/_table_row.html.erb
index 0bb10552a5..3b3d3ebe46 100644
--- a/admin/app/views/spree/admin/metafield_definitions/_table_row.html.erb
+++ b/admin/app/views/spree/admin/metafield_definitions/_table_row.html.erb
@@ -5,7 +5,7 @@
<td><span class="badge badge-light"><%= metafield_definition.metafield_type.demodulize.titleize %></span></td>
<td>
<%= form_with model: metafield_definition, url: admin_metafield_definition_path(metafield_definition), method: :patch, data: { controller: 'auto-submit' } do |f| %>
- <%= f.select :display_on, display_on_options(Spree::MetafieldDefinition), {}, { class: 'form-select form-select-sm w-auto', data: { action: 'auto-submit#submit' } } %>
+ <%= f.select :display_on, display_on_options(Spree::MetafieldDefinition), {}, { class: 'form-select form-select-sm', data: { action: 'auto-submit#submit' } } %>
<% end %>
</td>
<td>
diff --git a/admin/app/views/spree/admin/payment_methods/_payment_method.html.erb b/admin/app/views/spree/admin/payment_methods/_payment_method.html.erb
index 68c2cc0a1a..df7eeae35d 100644
--- a/admin/app/views/spree/admin/payment_methods/_payment_method.html.erb
+++ b/admin/app/views/spree/admin/payment_methods/_payment_method.html.erb
@@ -24,7 +24,7 @@
</td>
<td class="w-20">
<%= form_for payment_method, as: :payment_method, url: spree.admin_payment_method_path(payment_method), method: :patch, data: { controller: 'auto-submit' } do |f| %>
- <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm w-auto', data: { action: 'auto-submit#submit' } } %>
+ <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm', data: { action: 'auto-submit#submit' } } %>
<% end %>
</td>
<td class="w-10 text-center">
diff --git a/admin/app/views/spree/admin/payments/new.html.erb b/admin/app/views/spree/admin/payments/new.html.erb
index d5021055b4..dd0dcad079 100644
--- a/admin/app/views/spree/admin/payments/new.html.erb
+++ b/admin/app/views/spree/admin/payments/new.html.erb
@@ -10,32 +10,24 @@
<h5 class="card-title"><%= Spree.t(:new_payment) %></h5>
</div>
<div class="card-body">
- <div class="form-group mb-6">
- <%= f.label :amount, Spree.t(:amount) %>
- <div class="input-group">
- <%= f.number_field :amount,
- value: @payment.max_amount,
- max: @payment.max_amount,
- step: '.01',
- class: 'form-input',
- required: true %>
- <div class="input-group-append">
- <span class="input-group-text"><%= currency_symbol(@order.currency) %></span>
- </div>
- </div>
- </div>
+ <%= f.spree_number_field :amount,
+ value: @payment.max_amount,
+ max: @payment.max_amount,
+ step: '.01',
+ required: true,
+ append: currency_symbol(@order.currency) %>
<%= f.label :payment_method_id, Spree.t(:payment_method) %>
<ul class="list-group mb-6">
<% @payment_methods.each do |payment_method| %>
- <li class="list-group-item p-0">
- <%= link_to spree.new_admin_order_payment_path(@order, payment_method_id: payment_method.id), class: "form-check-label flex items-center gap-4 px-6 py-6 w-full cursor-pointer hover:bg-gray-25 text-gray-900" do %>
+ <li class="list-group-item p-0 overflow-hidden">
+ <%= link_to spree.new_admin_order_payment_path(@order, payment_method_id: payment_method.id), class: "form-check-label flex items-center gap-4 px-6 py-6 w-full cursor-pointer hover:bg-gray-25 text-gray-900 no-underline" do %>
<div class="form-check flex items-center">
<%= f.radio_button :payment_method_id, payment_method.id, class: "form-check-input" %>
</div>
<% if payment_method_icon_tag(payment_method.payment_icon_name).present? %>
- <%= payment_method_icon_tag(payment_method.payment_icon_name) %>
+ <%= payment_method_icon_tag(payment_method.payment_icon_name, height: 24) %>
<% end %>
<%= payment_method.name %>
diff --git a/admin/app/views/spree/admin/promotion_actions/edit.html.erb b/admin/app/views/spree/admin/promotion_actions/edit.html.erb
index d7a0ede4a1..734c13c66f 100644
--- a/admin/app/views/spree/admin/promotion_actions/edit.html.erb
+++ b/admin/app/views/spree/admin/promotion_actions/edit.html.erb
@@ -2,7 +2,7 @@
<%= form_with model: @promotion_action, url: spree.admin_promotion_action_path(@promotion, @promotion_action), method: :put, scope: :promotion_action do |f| %>
<div class="card" id="<%= spree_dom_id(@promotion_action) %>">
<div class="card-header flex justify-between items-center">
- <h5 class="card-title"><%= @promotion_action.human_name %></h5>
+ <h5 class="card-title text-base"><%= @promotion_action.human_name %></h5>
</div>
<div class="card-body">
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @promotion_action } %>
diff --git a/admin/app/views/spree/admin/promotion_rules/edit.html.erb b/admin/app/views/spree/admin/promotion_rules/edit.html.erb
index 8aad1bf7b6..0e0e0cba2d 100644
--- a/admin/app/views/spree/admin/promotion_rules/edit.html.erb
+++ b/admin/app/views/spree/admin/promotion_rules/edit.html.erb
@@ -2,7 +2,7 @@
<%= form_with model: @promotion_rule, url: spree.admin_promotion_rule_path(@promotion, @promotion_rule), method: :put, scope: :promotion_rule do |f| %>
<div class="card" id="<%= spree_dom_id(@promotion_rule) %>">
<div class="card-header flex justify-between items-center">
- <h5 class="card-title"><%= @promotion_rule.human_name %></h5>
+ <h5 class="card-title text-base"><%= @promotion_rule.human_name %></h5>
</div>
<div class="card-body">
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @promotion_rule } %>
diff --git a/admin/app/views/spree/admin/properties/_table_row.html.erb b/admin/app/views/spree/admin/properties/_table_row.html.erb
index e9aa55eaca..c456f4130d 100644
--- a/admin/app/views/spree/admin/properties/_table_row.html.erb
+++ b/admin/app/views/spree/admin/properties/_table_row.html.erb
@@ -16,7 +16,7 @@
</td>
<td>
<%= form_with model: property, url: admin_property_path(property), method: :patch, data: { controller: 'auto-submit' } do |f| %>
- <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm w-auto', data: { action: 'auto-submit#submit' } } %>
+ <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm', data: { action: 'auto-submit#submit' } } %>
<% end %>
</td>
<td class="w-10 actions">
diff --git a/admin/app/views/spree/admin/shipping_methods/_table_row.html.erb b/admin/app/views/spree/admin/shipping_methods/_table_row.html.erb
index 0144ddc142..05a3a6daff 100644
--- a/admin/app/views/spree/admin/shipping_methods/_table_row.html.erb
+++ b/admin/app/views/spree/admin/shipping_methods/_table_row.html.erb
@@ -24,7 +24,7 @@
</td>
<td class="w-10">
<%= form_with model: shipping_method, url: spree.admin_shipping_method_path(shipping_method), method: :patch, data: { controller: 'auto-submit' } do |f| %>
- <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm w-auto', data: { action: 'auto-submit#submit' } } %>
+ <%= f.select :display_on, display_on_options, {}, { class: 'form-select form-select-sm', data: { action: 'auto-submit#submit' } } %>
<% end %>
</td>
<td class="actions w-10">
diff --git a/admin/app/views/spree/admin/taxons/_form.html.erb b/admin/app/views/spree/admin/taxons/_form.html.erb
index aaff3beb4f..d1ddc70fb2 100644
--- a/admin/app/views/spree/admin/taxons/_form.html.erb
+++ b/admin/app/views/spree/admin/taxons/_form.html.erb
@@ -61,7 +61,7 @@
<div class="card-body border-b py-0">
<div class="flex items-center gap-2 py-2">
<%= f.label :sort_order, class: 'mb-0' %>
- <%= f.select :sort_order, taxon_sort_options_for_select, {}, { class: 'form-select form-select-sm w-auto ml-2', data: { action: 'change->auto-submit#submit' } } %>
+ <%= f.select :sort_order, taxon_sort_options_for_select, {}, { class: 'form-select form-select-sm ml-2', data: { action: 'change->auto-submit#submit' } } %>
</div>
</div>
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rb
index 9d42b6d7fa..40319c688f 100644
--- a/core/app/helpers/spree/base_helper.rb
+++ b/core/app/helpers/spree/base_helper.rb
@@ -256,6 +256,8 @@ module Spree
opts[:width] ||= opts[:height] * 1.5 if opts[:height]
opts[:size] = "#{opts[:width]}x#{opts[:height]}" if opts[:width] && opts[:height]
+ opts[:fallback] = 'payment_icons/storecredit.svg'
+
inline_svg "payment_icons/#{payment_method}.svg", opts
end