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.

Bring back Store Code in Admin UI

Damian Legawiecaa5b0689413b
diff --git a/backend/app/views/spree/admin/stores/_form.html.erb b/backend/app/views/spree/admin/stores/_form.html.erb
index 37790611d1..5c2163a546 100644
--- a/backend/app/views/spree/admin/stores/_form.html.erb
+++ b/backend/app/views/spree/admin/stores/_form.html.erb
@@ -22,6 +22,11 @@
<%= f.text_field :name, class: 'form-control', required: true %>
<%= f.error_message_on :name %>
<% end %>
+ <%= f.field_container :code, class: ['form-group'] do %>
+ <%= f.label :name, raw(Spree.t(:code) + required_span_tag) %>
+ <%= f.text_field :code, class: 'form-control', required: true %>
+ <%= f.error_message_on :code %>
+ <% end %>
<%= f.field_container :url, class: ['form-group'] do %>
<%= f.label :url, raw(Spree.t(:url) + required_span_tag) %>
<%= f.text_field :url, class: 'form-control', required: true %>
diff --git a/backend/spec/features/admin/store_spec.rb b/backend/spec/features/admin/store_spec.rb
index c6b792c690..1e7e7732a6 100644
--- a/backend/spec/features/admin/store_spec.rb
+++ b/backend/spec/features/admin/store_spec.rb
@@ -14,6 +14,7 @@ describe 'Stores', type: :feature, js: true do
it 'has required fields' do
expect(page).to have_field(id: 'store_name')
+ expect(page).to have_field(id: 'store_code')
expect(page).to have_field(id: 'store_url')
expect(page).to have_field(id: 'store_mail_from_address')
end
@@ -27,6 +28,7 @@ describe 'Stores', type: :feature, js: true do
it 'creates a new store' do
fill_in 'Name', with: 'Store name'
+ fill_in 'Code', with: 'example_store'
fill_in 'URL', with: 'store.example.com'
fill_in 'Mail from address', with: '[email protected]'
@@ -37,6 +39,7 @@ describe 'Stores', type: :feature, js: true do
it 'creates a new store with footer info' do
fill_in 'Name', with: 'Store name'
+ fill_in 'Code', with: 'example_store'
fill_in 'URL', with: 'store.example.com'
fill_in 'Mail from address', with: '[email protected]'
fill_in 'Description', with: 'New store description'
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index 61465bb7a6..da2fe2d564 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -5,7 +5,7 @@ module Spree
belongs_to :default_country, class_name: 'Spree::Country'
with_options presence: true do
- validates :name, :url, :mail_from_address, :default_currency
+ validates :name, :url, :mail_from_address, :default_currency, :code
end
connection.column_exists?(:spree_stores, :new_order_notifications_email) do
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index f367f148ad..d3de9cfd59 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -943,6 +943,7 @@ en:
available_locales: Available Locales
fields: Fields
language: Language
+ country: Country
localization_settings: Localization Settings
only_incomplete: Only incomplete
only_complete: Only complete
@@ -1025,6 +1026,7 @@ en:
login_as_existing: Login as Existing Customer
login_failed: Login authentication failed.
login_name: Login
+ logo: Logo
logo_alt: Brand logo
logout: Logout
look_for_similar_items: Look for similar items