From baf5df96244bccffaf741ed0cbc50b649cbb71fa Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 4 Oct 2017 11:15:20 -0700 Subject: [PATCH 1/2] Simplify layout of stock location form --- .../admin/stock_locations/_form.html.erb | 161 +++++++++--------- .../spree/admin/stock_locations/edit.html.erb | 6 +- .../spree/admin/stock_locations/new.html.erb | 6 +- core/config/locales/en.yml | 5 + 4 files changed, 85 insertions(+), 93 deletions(-) diff --git a/backend/app/views/spree/admin/stock_locations/_form.html.erb b/backend/app/views/spree/admin/stock_locations/_form.html.erb index 22877c4fe6a..14ae5dffcf4 100644 --- a/backend/app/views/spree/admin/stock_locations/_form.html.erb +++ b/backend/app/views/spree/admin/stock_locations/_form.html.erb @@ -1,105 +1,96 @@ -
-
-
- <%= f.field_container :name do %> - <%= f.label :name, class: 'required' %>
- <%= f.text_field :name, class: 'fullwidth', required: true %> - <% end %> -
-
- <%= f.field_container :code do %> - <%= f.label :code %> - <%= f.text_field :code, class: 'fullwidth', label: false %> - <% end %> -
-
- <%= f.field_container :admin_name do %> - <%= f.label :admin_name %> - <%= f.text_field :admin_name, class: 'fullwidth', label: false %> - <% end %> -
-
+
+
+ <%= t('.general') %> + + <%= f.field_container :name do %> + <%= f.label :name, class: 'required' %>
+ <%= f.text_field :name, class: 'fullwidth', required: true %> + <% end %> + + <%= f.field_container :code do %> + <%= f.label :code %> + <%= f.text_field :code, :class => 'fullwidth', :label => false %> + <% end %> + + <%= f.field_container :admin_name do %> + <%= f.label :admin_name %> + <%= f.text_field :admin_name, class: 'fullwidth', label: false %> + <% end %> +
+ +
+ <%= t('.settings') %> -
<%= f.field_container :active do %> - -
    -
  • - <%= f.check_box :active %> - <%= f.label :active %> -
  • -
  • - <%= f.check_box :default %> - <%= f.label :default %> -
  • -
  • - <%= f.check_box :backorderable_default %> - <%= f.label :backorderable_default %> -
  • -
  • - <%= f.check_box :propagate_all_variants %> - <%= f.label :propagate_all_variants %> -
  • -
  • - <%= f.check_box :restock_inventory %> - <%= f.label :restock_inventory %> -
  • -
  • - <%= f.check_box :fulfillable %> - <%= f.label :fulfillable %> -
  • -
  • - <%= f.check_box :check_stock_on_transfer %> - <%= f.label :check_stock_on_transfer %> -
  • -
+ <%= f.check_box :active %> + <%= f.label :active %> + <% end %> + + <%= f.field_container :default do %> + <%= f.check_box :default %> + <%= f.label :default %> + <% end %> + + <%= f.field_container :backorderable_default do %> + <%= f.check_box :backorderable_default %> + <%= f.label :backorderable_default %> + <% end %> + + <%= f.field_container :propagate_all_variants do %> + <%= f.check_box :propagate_all_variants %> + <%= f.label :propagate_all_variants %> + <% end %> + + <%= f.field_container :restock_inventory do %> + <%= f.check_box :restock_inventory %> + <%= f.label :restock_inventory %> + <% end %> + + <%= f.field_container :fulfillable do %> + <%= f.check_box :fulfillable %> + <%= f.label :fulfillable %> <% end %> -
-
-
+ <%= f.field_container :check_stock_on_transfer do %> + <%= f.check_box :check_stock_on_transfer %> + <%= f.label :check_stock_on_transfer %> + <% end %> +
+ +
+ <%= t('.address') %> + + <%= f.field_container :check_stock_on_transfer do %> <%= f.label :address1 %> <%= f.text_field :address1, class: 'fullwidth' %> -
-
- -
-
- <%= f.label :city %> - <%= f.text_field :city, class: 'fullwidth' %> -
-
+ <% end %> -
-
+ <%= f.field_container :address2 do %> <%= f.label :address2 %> <%= f.text_field :address2, class: 'fullwidth' %> -
-
+ <% end %> -
-
+ <%= f.field_container :city do %> + <%= f.label :city %> + <%= f.text_field :city, class: 'fullwidth' %> + <% end %> + + <%= f.field_container :zipcode do %> <%= f.label :zipcode %> <%= f.text_field :zipcode, class: 'fullwidth' %> -
-
+ <% end %> -
-
+ <%= f.field_container :phone do %> <%= f.label :phone %> <%= f.phone_field :phone, class: 'fullwidth' %> -
-
+ <% end %> -
-
+ <%= f.field_container :country_id do %> <%= f.label :country_id %> <%= f.collection_select :country_id, available_countries, :id, :name, {}, { class: 'select2 fullwidth' } %> -
-
+ <% end %> -
-
+ <%= f.field_container :state do %> <% if f.object.country %> <%= f.label :state_id %> @@ -107,8 +98,8 @@ <%= f.collection_select :state_id, f.object.country.states.sort, :id, :name, { include_blank: true }, {class: 'select2 fullwidth', style: "display: #{f.object.country.states.empty? ? 'none' : 'block' };", disabled: f.object.country.states.empty?} %> <% end %> -
-
+ <% end %> + <% content_for :head do %> diff --git a/backend/app/views/spree/admin/stock_locations/edit.html.erb b/backend/app/views/spree/admin/stock_locations/edit.html.erb index dbbdfac8dbd..5ea0f5d81ae 100644 --- a/backend/app/views/spree/admin/stock_locations/edit.html.erb +++ b/backend/app/views/spree/admin/stock_locations/edit.html.erb @@ -12,8 +12,6 @@ <%= render partial: 'spree/shared/error_messages', locals: { target: @stock_location } %> <%= form_for [:admin, @stock_location] do |f| %> -
- <%= render partial: 'form', locals: { f: f } %> - <%= render partial: 'spree/admin/shared/edit_resource_links' %> -
+ <%= render :partial => 'form', :locals => { :f => f } %> + <%= render :partial => 'spree/admin/shared/edit_resource_links' %> <% end %> diff --git a/backend/app/views/spree/admin/stock_locations/new.html.erb b/backend/app/views/spree/admin/stock_locations/new.html.erb index 1c2a28b3d44..42dd81d3c2f 100644 --- a/backend/app/views/spree/admin/stock_locations/new.html.erb +++ b/backend/app/views/spree/admin/stock_locations/new.html.erb @@ -12,8 +12,6 @@ <%= render partial: 'spree/shared/error_messages', locals: { target: @stock_locations } %> <%= form_for [:admin, @stock_location] do |f| %> -
- <%= render partial: 'form', locals: { f: f } %> - <%= render partial: 'spree/admin/shared/new_resource_links' %> -
+ <%= render :partial => 'form', :locals => { :f => f } %> + <%= render :partial => 'spree/admin/shared/new_resource_links' %> <% end %> diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index b2abe99f4e7..0391f50a8e5 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -868,6 +868,11 @@ en: auto: All orders will attempt to use this promotion single_code_html: "This promotion uses the promotion code: %{code}" multiple_codes_html: "This promotion uses %{count} promotion codes" + stock_locations: + form: + general: General + settings: Settings + address: Address store_credits: add: "Add store credit" amount_authorized: "Amount Authorized" From 2ee01e269519aa13c601912799016c5d92634b60 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 4 Oct 2017 11:16:21 -0700 Subject: [PATCH 2/2] Add hints to stock location flags --- .../app/views/spree/admin/stock_locations/_form.html.erb | 6 ++++++ core/config/locales/en.yml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/backend/app/views/spree/admin/stock_locations/_form.html.erb b/backend/app/views/spree/admin/stock_locations/_form.html.erb index 14ae5dffcf4..d5406c17df6 100644 --- a/backend/app/views/spree/admin/stock_locations/_form.html.erb +++ b/backend/app/views/spree/admin/stock_locations/_form.html.erb @@ -24,6 +24,7 @@ <%= f.field_container :active do %> <%= f.check_box :active %> <%= f.label :active %> + <%= f.field_hint :active %> <% end %> <%= f.field_container :default do %> @@ -34,26 +35,31 @@ <%= f.field_container :backorderable_default do %> <%= f.check_box :backorderable_default %> <%= f.label :backorderable_default %> + <%= f.field_hint :backorderable_default %> <% end %> <%= f.field_container :propagate_all_variants do %> <%= f.check_box :propagate_all_variants %> <%= f.label :propagate_all_variants %> + <%= f.field_hint :propagate_all_variants %> <% end %> <%= f.field_container :restock_inventory do %> <%= f.check_box :restock_inventory %> <%= f.label :restock_inventory %> + <%= f.field_hint :restock_inventory %> <% end %> <%= f.field_container :fulfillable do %> <%= f.check_box :fulfillable %> <%= f.label :fulfillable %> + <%= f.field_hint :fulfillable %> <% end %> <%= f.field_container :check_stock_on_transfer do %> <%= f.check_box :check_stock_on_transfer %> <%= f.label :check_stock_on_transfer %> + <%= f.field_hint :check_stock_on_transfer %> <% end %> diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index 0391f50a8e5..fb14e5bddb7 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -1288,6 +1288,13 @@ en: spree/promotion: starts_at: "This determines when the promotion can be applied to orders.
If no value is specified, the promotion will be immediately available." expires_at: "This determines when the promotion expires.
If no value is specified, the promotion will never expire." + spree/stock_location: + active: "This determines whether stock from this location can be used when building packages.
Default: Checked" + backorderable_default: "When checked, stock items in this location will default to allowing backorders.
Default: Unchecked" + propagate_all_variants: "When checked, this will create a stock item for in this stock location.
Default: Checked" + restock_inventory: "When checked, returned inventory can be added back to this location's stock levels.
Default: checked" + fulfillable: "When unchecked, this indicates that items in this location don't require actual fulfilment. Stock will not be checked when shipping and emails will not be sent.
Default: Checked" + check_stock_on_transfer: "When checked, inventory levels will be checked when performing stock transfers.
Default: Checked" spree/store: cart_tax_country_iso: "This determines which country is used for taxes on carts (orders which don't yet have an address).
Default: None." spree/variant: