solidus_backend 3.0.8 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_backend might be problematic. Click here for more details.

Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/components/sortable_table.js +1 -9
  3. data/app/assets/javascripts/spree/backend/product_picker.js +2 -1
  4. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +1 -1
  5. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +32 -0
  6. data/app/controllers/spree/admin/locale_controller.rb +12 -11
  7. data/app/controllers/spree/admin/orders_controller.rb +1 -1
  8. data/app/controllers/spree/admin/products_controller.rb +1 -1
  9. data/app/controllers/spree/admin/resource_controller.rb +5 -2
  10. data/app/controllers/spree/admin/search_controller.rb +11 -1
  11. data/app/controllers/spree/admin/stock_items_controller.rb +6 -1
  12. data/app/controllers/spree/admin/users_controller.rb +2 -2
  13. data/app/controllers/spree/admin/variants_controller.rb +2 -2
  14. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  15. data/app/views/spree/admin/orders/index.html.erb +4 -0
  16. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  17. data/app/views/spree/admin/products/index.html.erb +1 -1
  18. data/app/views/spree/admin/promotion_code_batches/_form_fields.html.erb +22 -0
  19. data/app/views/spree/admin/promotion_code_batches/new.html.erb +4 -24
  20. data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -16
  21. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +1 -1
  22. data/app/views/spree/admin/refunds/new.html.erb +6 -6
  23. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  24. data/app/views/spree/admin/shared/_order_tabs.html.erb +1 -1
  25. data/app/views/spree/admin/stores/_form.html.erb +2 -2
  26. data/app/views/spree/admin/users/_form.html.erb +0 -1
  27. data/app/views/spree/admin/users/index.html.erb +1 -1
  28. data/app/views/spree/admin/variants/_form.html.erb +1 -1
  29. data/app/views/spree/admin/variants/_table.html.erb +6 -7
  30. data/app/views/spree/admin/variants/_table_filter.html.erb +8 -8
  31. data/app/views/spree/admin/variants/index.html.erb +1 -1
  32. data/config/routes.rb +3 -3
  33. data/lib/spree/backend/engine.rb +4 -0
  34. data/vendor/assets/javascripts/solidus_admin/select2_locales/{select2_locale_pt-PT.js → select2_locale_pt.js} +2 -2
  35. data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_lists.scss +0 -35
  36. metadata +9 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 013dd9d01948eac2de99e184d6bb7f395f82416263cd714a632850955005144b
4
- data.tar.gz: 35bf7fdf47cab56c76d89dfee1f711f388c69de5799954c2334bbfb3e5f3f831
3
+ metadata.gz: d99632eb3b53cdf636ca14545438db728190e9f2443805f2b2f7ba2a3f77ed82
4
+ data.tar.gz: 0ff28214c5691ac1c04500c69a3f8d9956f0413fd059eb2b53317219dbc48db2
5
5
  SHA512:
6
- metadata.gz: f38d975c0c853412f13079a7cbc8cb69c06df8c1a1c950a9d7aa26d97387f90480e15bd3c6bf81ebeedafa60ab06c6594795826f1dcc2ca612b41f5ee6517340
7
- data.tar.gz: 9a84581e63970a276a646de74b7e75999f93c961722730eef87c0a357b290463c9c1d7d22315c258eaec4616cfe514045645384bf1ceb2a8e14c2ac94d8f566a
6
+ metadata.gz: 5462a343a6e68e7df57049e33010c2c251e55a203d0d90935ea58e6a974ba60f16bb530d60d5c9eaa11f91d366750caaa45a523e596caf9eb5f9eaec0f376975
7
+ data.tar.gz: 0411ffc0b40f531e62e6872c496147020c8165d300aa7a4157348b95b589bef7f81c4cca82701735a25c3d14c23feaebc5e5b6e88e57efc17f7ea575644e5aaa
@@ -1,14 +1,6 @@
1
1
  //= require solidus_admin/Sortable
2
2
  /* eslint no-unused-vars: "off" */
3
3
 
4
- /* Check if string is valid UUID */
5
- function isAValidUUID(str) {
6
- // https://stackoverflow.com/a/13653180/8170555
7
- const regexExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
8
-
9
- return regexExp.test(str);
10
- }
11
-
12
4
  Spree.SortableTable = {
13
5
  refresh: function() {
14
6
  var sortable_tables = document.querySelectorAll('table.sortable');
@@ -24,7 +16,7 @@ Spree.SortableTable = {
24
16
  var idAttr = el.id;
25
17
  if (idAttr) {
26
18
  var objId = idAttr.split('_').slice(-1);
27
- if (!isNaN(objId) || isAValidUUID(objId)) {
19
+ if (!isNaN(objId)) {
28
20
  positions['positions['+objId+']'] = index + 1;
29
21
  }
30
22
  }
@@ -15,7 +15,8 @@ $.fn.productAutocomplete = function (options) {
15
15
  initSelection: function (element, callback) {
16
16
  $.get(Spree.pathFor('admin/search/products'), {
17
17
  ids: element.val().split(','),
18
- token: Spree.api_key
18
+ token: Spree.api_key,
19
+ show_all: true
19
20
  }, function (data) {
20
21
  callback(multiple ? data.products : data.products[0]);
21
22
  });
@@ -1,5 +1,5 @@
1
1
  <td class="stock-location-name">
2
- <a href="/admin/stock_locations/{{stockLocationId}}/stock_movements?q%5Bvariant_sku_eq%5D={{variantSku}}">
2
+ <a href="{{admin_url}}/stock_locations/{{stockLocationId}}/stock_movements?q%5Bvariant_sku_eq%5D={{variantSku}}">
3
3
  {{stockLocationName}}
4
4
  </a>
5
5
  </td>
@@ -57,6 +57,38 @@ ul.text_list {
57
57
  padding-left: 0;
58
58
  }
59
59
 
60
+ dl {
61
+ width: 100%;
62
+ overflow: hidden;
63
+ margin: 5px 0;
64
+ color: lighten($body-color, 15);
65
+
66
+ dt, dd {
67
+ float: left;
68
+ line-height: 16px;
69
+ padding: 5px;
70
+ }
71
+
72
+ dt {
73
+ width: 40%;
74
+ font-weight: $font-weight-bold;
75
+ padding-left: 0;
76
+ clear: left;
77
+ }
78
+
79
+ dd {
80
+ width: 60%;
81
+ padding-right: 0;
82
+ margin-left: 0;
83
+ }
84
+ }
85
+
86
+ .dl-collapse {
87
+ dt, dd {
88
+ width: auto;
89
+ }
90
+ }
91
+
60
92
  // Helpers
61
93
  .align-center { text-align: center }
62
94
  .align-right { text-align: right }
@@ -4,21 +4,22 @@ module Spree
4
4
  module Admin
5
5
  class LocaleController < Spree::Admin::BaseController
6
6
  def set
7
- locale = params[:switch_to_locale].to_s.presence
7
+ requested_locale = params[:switch_to_locale].to_s.presence
8
8
 
9
- if locale && I18n.available_locales.include?(locale.to_sym)
10
- I18n.locale = locale
11
- session[set_user_language_locale_key] = locale
12
-
13
- respond_to do |format|
14
- format.json { render json: { locale: locale, location: spree.admin_url } }
15
- end
9
+ if locale_is_available?(requested_locale)
10
+ I18n.locale = requested_locale
11
+ session[set_user_language_locale_key] = requested_locale
12
+ render json: { locale: requested_locale, location: spree.admin_url }
16
13
  else
17
- respond_to do |format|
18
- format.json { render json: { locale: I18n.locale }, status: 404 }
19
- end
14
+ render json: { locale: I18n.locale }, status: 404
20
15
  end
21
16
  end
17
+
18
+ private
19
+
20
+ def locale_is_available?(locale)
21
+ locale && I18n.available_locales.include?(locale.to_sym)
22
+ end
22
23
  end
23
24
  end
24
25
  end
@@ -86,7 +86,7 @@ module Spree
86
86
  if @order.can_complete?
87
87
  flash[:success] = t('spree.order_ready_for_confirm')
88
88
  else
89
- flash[:error] = @order.errors.full_messages
89
+ flash[:error] = @order.errors.full_messages.join(', ')
90
90
  end
91
91
  redirect_to confirm_admin_order_url(@order)
92
92
  end
@@ -104,7 +104,7 @@ module Spree
104
104
  end
105
105
 
106
106
  def product_includes
107
- [:variant_images, { variants: [:images], master: [:images, :default_price] }]
107
+ [:variant_images, { variants: [:images], master: [:images, :prices] }]
108
108
  end
109
109
 
110
110
  def clone_object_url(resource)
@@ -78,8 +78,11 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
78
78
 
79
79
  def update_positions
80
80
  ActiveRecord::Base.transaction do
81
- params[:positions].each do |id, index|
82
- model_class.find_by(id: id)&.set_list_position(index)
81
+ positions = params[:positions]
82
+ records = model_class.where(id: positions.keys).to_a
83
+
84
+ positions.each do |id, index|
85
+ records.find { |r| r.id == id.to_i }&.set_list_position(index)
83
86
  end
84
87
  end
85
88
 
@@ -29,10 +29,20 @@ module Spree
29
29
  @products = Spree::Product.ransack(params[:q]).result
30
30
  end
31
31
 
32
- @products = @products.distinct.page(params[:page]).per(params[:per_page])
32
+ @products = list_products
33
33
  expires_in 15.minutes, public: true
34
34
  headers['Surrogate-Control'] = "max-age=#{15.minutes}"
35
35
  end
36
+
37
+ private
38
+
39
+ def list_products
40
+ if params[:show_all]
41
+ @products.distinct.page(params[:page])
42
+ else
43
+ @products.distinct.page(params[:page]).per(params[:per_page])
44
+ end
45
+ end
36
46
  end
37
47
  end
38
48
  end
@@ -51,7 +51,12 @@ module Spree
51
51
 
52
52
  def variant_scope
53
53
  scope = Spree::Variant.accessible_by(current_ability)
54
- scope = scope.where(product: @product) if @product
54
+ if @product
55
+ scope = scope.where(
56
+ product: @product,
57
+ is_master: !@product.has_variants?
58
+ )
59
+ end
55
60
  scope = scope.order(:sku)
56
61
  scope
57
62
  end
@@ -92,7 +92,7 @@ module Spree
92
92
 
93
93
  @search = super.ransack(params[:q])
94
94
  @collection = @search.result.includes(:spree_roles)
95
- @collection = @collection.includes(:orders)
95
+ @collection = @collection.includes(:spree_orders)
96
96
  @collection = @collection.page(params[:page]).per(Spree::Config[:admin_products_per_page])
97
97
  end
98
98
 
@@ -121,7 +121,7 @@ module Spree
121
121
  # handling raise from Spree::Admin::ResourceController#destroy
122
122
  def user_destroy_with_orders_error
123
123
  invoke_callbacks(:destroy, :fails)
124
- render status: :forbidden, plain: t("spree.error_user_destroy_with_orders")
124
+ render status: :forbidden, text: t('spree.error_user_destroy_with_orders')
125
125
  end
126
126
 
127
127
  def sign_in_if_change_own_password
@@ -16,7 +16,7 @@ module Spree
16
16
  @object.attributes = @object.product.master.attributes.except('id', 'created_at', 'deleted_at',
17
17
  'sku', 'is_master')
18
18
  # Shallow Clone of the default price to populate the price field.
19
- @object.default_price = @object.product.master.default_price.clone
19
+ @object.prices.build(@object.product.master.default_price.attributes.except("id", "created_at", "updated_at", "deleted_at"))
20
20
  end
21
21
 
22
22
  def collection
@@ -35,7 +35,7 @@ module Spree
35
35
  end
36
36
 
37
37
  def variant_includes
38
- [{ option_values: :option_type }, :default_price]
38
+ [{ option_values: :option_type }, :prices]
39
39
  end
40
40
 
41
41
  def redirect_on_empty_option_values
@@ -13,12 +13,12 @@
13
13
  <tr data-hook="adjustment_buttons">
14
14
  <td class="align-right" colspan="2" style="width: 50%">
15
15
  <% if can? :update, Spree::Adjustment %>
16
- <%= button_to t('spree.unfinalize_all_adjustments'), adjustments_unfinalize_admin_order_path(@order), method: :put %>
16
+ <%= button_to t('spree.unfinalize_all_adjustments'), adjustments_unfinalize_admin_order_path(@order), method: :get %>
17
17
  <% end %>
18
18
  </td>
19
19
  <td colspan="2" style="width: 50%">
20
20
  <% if can? :update, Spree::Adjustment %>
21
- <%= button_to t('spree.finalize_all_adjustments'), adjustments_finalize_admin_order_path(@order), method: :put %>
21
+ <%= button_to t('spree.finalize_all_adjustments'), adjustments_finalize_admin_order_path(@order), method: :get %>
22
22
  <% end %>
23
23
  </td>
24
24
  <td class='actions'>&nbsp;</td>
@@ -48,6 +48,10 @@
48
48
  <%= f.text_field :shipments_number_start %>
49
49
  </div>
50
50
 
51
+ <div class="field">
52
+ <%= label_tag :q_shipment_state, t('spree.shipment_state') %>
53
+ <%= f.select :shipment_state_eq, %i[backorder canceled partial pending ready shipped].map { |state| [t("spree.shipment_states.#{state}"), state] }, { include_blank: true }, { class: "custom-select fullwidth" } %>
54
+ </div>
51
55
  </div>
52
56
 
53
57
  <div class="col-12 col-md-6 col-lg-4 col-xl-6">
@@ -58,7 +58,7 @@
58
58
  <% allowed_actions = payment.actions.select { |a| can?(a.to_sym, payment) } %>
59
59
  <% allowed_actions.each do |action| %>
60
60
  <% if action == 'credit' %>
61
- <%= link_to_with_icon 'mail-reply', t('spree.actions.refund'), new_admin_order_payment_refund_path(@order, payment), no_text: true %>
61
+ <%= link_to_with_icon 'reply', t('spree.refund'), new_admin_order_payment_refund_path(@order, payment), no_text: true %>
62
62
  <% elsif action == 'capture' && !@order.completed? %>
63
63
  <%# no capture prior to completion. payments get captured when the order completes. %>
64
64
  <% else %>
@@ -78,7 +78,7 @@
78
78
  <%= render 'spree/admin/shared/image', image: product.gallery.images.first, size: :mini %>
79
79
  </td>
80
80
  <td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
81
- <td class="align-right"><%= product.display_price.to_html %></td>
81
+ <td class="align-right"><%= product.display_price&.to_html %></td>
82
82
  <td class="actions" data-hook="admin_products_index_row_actions">
83
83
  <%= link_to_edit product, no_text: true, class: 'edit' if can?(:edit, product) && !product.deleted? %>
84
84
  &nbsp;
@@ -0,0 +1,22 @@
1
+ <div class="field">
2
+ <%= batch.label :base_code, class: "required" %>
3
+ <%= batch.text_field :base_code, class: "fullwidth", required: true %>
4
+ </div>
5
+ <div class="field">
6
+ <%= batch.label :number_of_codes, class: "required" %>
7
+ <%= batch.number_field :number_of_codes, class: "fullwidth", min: 1, required: true %>
8
+ </div>
9
+ <div class="field">
10
+ <%= batch.label :join_characters %>
11
+ <%= batch.text_field :join_characters, class: "fullwidth" %>
12
+ </div>
13
+ <% unless promotion_id %>
14
+ <div class="field">
15
+ <%= f.label :per_code_usage_limit %>
16
+ <%= f.text_field :per_code_usage_limit, class: "fullwidth" %>
17
+ </div>
18
+ <% end %>
19
+ <div class="field">
20
+ <%= batch.label :email %>
21
+ <%= batch.text_field :email, class: "fullwidth" %>
22
+ </div>
@@ -1,28 +1,8 @@
1
1
  <% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
2
2
  <% admin_breadcrumb(link_to @promotion.name, spree.admin_promotion_path(@promotion.id)) %>
3
3
  <% admin_breadcrumb(plural_resource_name(Spree::PromotionCodeBatch)) %>
4
-
5
- <%= form_for :promotion_code_batch, url: collection_url do |f| %>
6
- <%= f.hidden_field :promotion_id, value: params[:promotion_id] %>
7
-
8
- <%= f.field_container :base_code do %>
9
- <%= f.label :base_code %>
10
- <%= f.text_field :base_code, class: "fullwidth" %>
11
- <% end %>
12
-
13
- <%= f.field_container :join_characters do %>
14
- <%= f.label :join_characters %>
15
- <%= f.text_field :join_characters, class: "fullwidth" %>
16
- <% end %>
17
-
18
- <%= f.field_container :number_of_codes do %>
19
- <%= f.label :number_of_codes %>
20
- <%= f.text_field :number_of_codes, class: "fullwidth" %>
21
- <% end %>
22
-
23
- <%= f.field_container :email do %>
24
- <%= f.label :email %>
25
- <%= f.text_field :email, class: "fullwidth", value: spree_current_user.email %>
26
- <% end %>
27
- <%= f.submit t('spree.actions.create'), class: 'btn btn-primary' %>
4
+ <%= form_for :promotion_code_batch, url: collection_url do |batch| %>
5
+ <%= batch.hidden_field :promotion_id, value: params[:promotion_id] %>
6
+ <%= render partial: 'form_fields', locals: {batch: batch, promotion_id: params[:promotion_id]} %>
7
+ <%= batch.submit t('spree.actions.create'), class: 'btn btn-primary' %>
28
8
  <% end %>
@@ -35,22 +35,7 @@
35
35
 
36
36
  <div data-activation-type="multiple_codes">
37
37
  <%= fields_for :promotion_code_batch, @promotion_code_batch do |batch| %>
38
- <div class="field">
39
- <%= batch.label :base_code, class: "required" %>
40
- <%= batch.text_field :base_code, class: "fullwidth", required: true %>
41
- </div>
42
- <div class="field">
43
- <%= batch.label :number_of_codes, class: "required" %>
44
- <%= batch.number_field :number_of_codes, class: "fullwidth", min: 1, required: true %>
45
- </div>
46
- <div class="field">
47
- <%= batch.label :join_characters %>
48
- <%= batch.text_field :join_characters, class: "fullwidth" %>
49
- </div>
50
- <div class="field">
51
- <%= f.label :per_code_usage_limit %>
52
- <%= f.text_field :per_code_usage_limit, class: "fullwidth" %>
53
- </div>
38
+ <%= render partial: 'spree/admin/promotion_code_batches/form_fields', locals: {f: f, batch: batch, promotion_id: params[:promotion_id]} %>
54
39
  <% end %>
55
40
  </div>
56
41
 
@@ -1,7 +1,7 @@
1
1
  <div class="row">
2
2
  <div class="col-6">
3
3
  <div class="field">
4
- <%= select_tag "#{param_prefix}[preferred_operator]", options_for_select(Spree::Promotion::Rules::ItemTotal::OPERATORS.map{|o| [t(o, scope: 'spree.item_total_rule.operators'),o]}, promotion_rule.preferred_operator), {class: 'custom-select select_item_total fullwidth'} %>
4
+ <%= select_tag "#{param_prefix}[preferred_operator]", options_for_select(promotion_rule.class.operator_options, promotion_rule.preferred_operator), {class: 'custom-select select_item_total fullwidth'} %>
5
5
  </div>
6
6
  </div>
7
7
  <div class="col-6">
@@ -10,14 +10,14 @@
10
10
  <div data-hook="admin_refund_form_fields" class="row">
11
11
  <div class="col-3">
12
12
  <div class="field">
13
- <label><%= t('spree.payment_amount') %></label><br>
14
- <%= Spree::Money.new(@refund.payment.amount) %>
13
+ <%= t('spree.payment_amount') %><br/>
14
+ <%= @refund.payment.amount %>
15
15
  </div>
16
16
  </div>
17
17
  <div class="col-3">
18
18
  <div class="field">
19
- <label><%= t('spree.credit_allowed') %></label><br/>
20
- <%= Spree::Money.new(@refund.payment.credit_allowed) %>
19
+ <%= t('spree.credit_allowed') %><br/>
20
+ <%= @refund.payment.credit_allowed %>
21
21
  </div>
22
22
  </div>
23
23
  <div class="col-3">
@@ -29,13 +29,13 @@
29
29
  <div class="col-3">
30
30
  <div class="field">
31
31
  <%= f.label :refund_reason_id %><br/>
32
- <%= f.collection_select(:refund_reason_id, refund_reasons, :id, :name, {prompt: t("spree.choose_reason")}, {class: 'custom-select fullwidth'}) %>
32
+ <%= f.collection_select(:refund_reason_id, refund_reasons, :id, :name, {include_blank: true}, {class: 'custom-select fullwidth'}) %>
33
33
  </div>
34
34
  </div>
35
35
  </div>
36
36
 
37
37
  <div class="form-buttons filter-actions actions" data-hook="buttons">
38
- <%= f.submit t('spree.actions.refund'), class: 'btn btn-primary' %>
38
+ <%= f.submit Spree::Refund.model_name.human, class: 'btn btn-primary' %>
39
39
  <%= link_to t('spree.actions.cancel'), admin_order_payments_url(@refund.payment.order), class: 'btn btn-primary' %>
40
40
  </div>
41
41
  </fieldset>
@@ -100,7 +100,7 @@
100
100
  <%= button_to [:perform, :admin, @order, @reimbursement], { class: 'button btn btn-primary', method: 'post' } do %>
101
101
  <%= t('spree.reimburse') %>
102
102
  <% end %>
103
- <%= link_to t('spree.actions.cancel'), url_for([:admin, @order, @reimbursement.customer_return]), class: 'btn btn-default' %>
103
+ <%= link_to t('spree.actions.cancel'), url_for([:edit, :admin, @order, @reimbursement.customer_return]), class: 'btn btn-default' %>
104
104
  <% end %>
105
105
  </div>
106
106
  </fieldset>
@@ -1,5 +1,5 @@
1
1
  <% admin_breadcrumb(link_to plural_resource_name(Spree::Order), spree.admin_orders_path) %>
2
- <% admin_breadcrumb(link_to "##{@order.number}", spree.edit_admin_order_path(@order)) %>
2
+ <% admin_breadcrumb(link_to @order.number, spree.edit_admin_order_path(@order)) %>
3
3
 
4
4
 
5
5
  <% content_for :sidebar_title do %>
@@ -62,8 +62,8 @@
62
62
  <%= f.field_container :cart_tax_country_iso do %>
63
63
  <%= f.label :cart_tax_country_iso %>
64
64
  <%= f.field_hint :cart_tax_country_iso %>
65
- <%= f.collection_select :cart_tax_country_iso,
66
- available_countries(restrict_to_zone: nil), :iso, :name,
65
+ <%= f.select :cart_tax_country_iso,
66
+ Spree::Country.all.map { |c| [c.name, c.iso] },
67
67
  { include_blank: t(".no_cart_tax_country") },
68
68
  { class: "custom-select fullwidth" } %>
69
69
  <%= f.error_message_on :cart_tax_country_iso %>
@@ -40,7 +40,6 @@
40
40
  <%= label_tag nil, plural_resource_name(Spree::StockLocation) %>
41
41
  <ul>
42
42
  <% if can?(:manage, Spree::UserStockLocation) %>
43
- <%= hidden_field_tag('user[stock_location_ids][]', nil) %>
44
43
  <% @stock_locations.each do |stock_location| %>
45
44
  <li>
46
45
  <label>
@@ -89,7 +89,7 @@
89
89
  <% if can?(:edit, user) %>
90
90
  <%= link_to_edit user, no_text: true %>
91
91
  <% end %>
92
- <% if can?(:destroy, user) && user.can_be_deleted? %>
92
+ <% if can?(:destroy, user) && user.orders.count.zero? %>
93
93
  <%= link_to_delete user, no_text: true %>
94
94
  <% end %>
95
95
  </td>
@@ -65,7 +65,7 @@
65
65
  <div class="col-3">
66
66
  <div class="field" data-hook="price">
67
67
  <%= f.label :price %>
68
- <%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :price, currency: @variant.find_or_build_default_price.currency %>
68
+ <%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :price, currency: @variant.default_price_or_build.currency %>
69
69
  </div>
70
70
  </div>
71
71
 
@@ -3,9 +3,10 @@
3
3
  <table class="index sortable" data-sortable-link="<%= update_positions_admin_product_variants_path(@product) %>">
4
4
  <colgroup>
5
5
  <col style="width: 5%" />
6
- <col style="width: 35%" />
7
- <col style="width: 20%" />
8
6
  <col style="width: 25%" />
7
+ <col style="width: 20%" />
8
+ <col style="width: 20%" />
9
+ <col style="width: 15%" />
9
10
  <col style="width: 15%" />
10
11
  </colgroup>
11
12
  <thead data-hook="variants_header">
@@ -39,11 +40,9 @@
39
40
  </td>
40
41
  </tr>
41
42
  <% end %>
43
+ <% if variants.empty? %>
44
+ <tr><td colspan="4"><%= t('spree.none') %></td></tr>
45
+ <% end %>
42
46
  </tbody>
43
47
  </table>
44
- <% if variants.empty? %>
45
- <div class="alert alert-warning">
46
- <%= t('.no_variants_found', term: params[:variant_search_term]) %>
47
- </div>
48
- <% end %>
49
48
  <%= paginate variants, theme: "solidus_admin" %>
@@ -4,14 +4,14 @@
4
4
 
5
5
  <% content_for :table_filter do %>
6
6
  <%= form_for :variant_search, url: spree.admin_product_variants_path(product), method: :get do |f| %>
7
- <div class="row">
8
- <div class="col-10">
9
- <div data-hook="admin_variants_index_search" class="field">
10
- <%= f.label :variant_search_term, t('spree.variant_search_placeholder') %>
11
- <%= text_field_tag :variant_search_term, params[:variant_search_term], class: "fullwidth", placeholder: t('spree.variant_search_placeholder') %>
12
- </div>
7
+ <div class="col-10">
8
+ <div data-hook="admin_variants_index_search" class="field">
9
+ <%= f.label :variant_search_term, t('spree.variant_search_placeholder') %>
10
+ <%= text_field_tag :variant_search_term, params[:variant_search_term], class: "fullwidth", placeholder: t('spree.variant_search_placeholder') %>
13
11
  </div>
12
+ </div>
14
13
 
14
+ <% if product.variants.with_discarded.discarded.any? %>
15
15
  <div class="col-2">
16
16
  <div class="field checkbox">
17
17
  <label>
@@ -20,10 +20,10 @@
20
20
  </label>
21
21
  </div>
22
22
  </div>
23
- </div>
23
+ <% end %>
24
24
 
25
25
  <div class="actions filter-actions">
26
- <%= button_tag t('spree.filter_results'), class: 'btn btn-primary' %>
26
+ <%= f.button :search %>
27
27
  </div>
28
28
  <% end %>
29
29
  <% end %>
@@ -14,7 +14,7 @@
14
14
  <% end %>
15
15
  <% end %>
16
16
 
17
- <% if @variants.any? || @product.variants.discarded.any? || params[:variant_search_term].present? %>
17
+ <% if @product.variants.with_discarded.any? %>
18
18
  <%= render "table_filter", product: @product %>
19
19
  <%= render "table", variants: @variants %>
20
20
  <% else %>
data/config/routes.rb CHANGED
@@ -77,8 +77,8 @@ Spree::Core::Engine.routes.draw do
77
77
  get :confirm
78
78
  put :complete
79
79
  post :resend
80
- put "/adjustments/unfinalize", to: "orders#unfinalize_adjustments"
81
- put "/adjustments/finalize", to: "orders#finalize_adjustments"
80
+ get "/adjustments/unfinalize", to: "orders#unfinalize_adjustments"
81
+ get "/adjustments/finalize", to: "orders#finalize_adjustments"
82
82
  put :approve
83
83
  put :cancel
84
84
  put :resume
@@ -91,7 +91,7 @@ Spree::Core::Engine.routes.draw do
91
91
  end
92
92
  end
93
93
 
94
- resources :adjustments, except: [:show]
94
+ resources :adjustments
95
95
  resources :return_authorizations do
96
96
  member do
97
97
  put :fire
@@ -8,6 +8,10 @@ module Spree
8
8
  # Leave initializer empty for backwards-compatability. Other apps
9
9
  # might still rely on this event.
10
10
  initializer "spree.backend.environment", before: :load_config_initializers do; end
11
+
12
+ config.after_initialize do
13
+ Spree::Backend::Config.check_load_defaults_called('Spree::Backend::Config')
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -4,7 +4,7 @@
4
4
  (function ($) {
5
5
  "use strict";
6
6
 
7
- $.fn.select2.locales['pt-PT'] = {
7
+ $.fn.select2.locales['pt'] = {
8
8
  formatNoMatches: function () { return "Nenhum resultado encontrado"; },
9
9
  formatInputTooShort: function (input, min) { var n = min - input.length; return "Introduza " + n + " car" + (n == 1 ? "ácter" : "acteres"); },
10
10
  formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " car" + (n == 1 ? "ácter" : "acteres"); },
@@ -13,5 +13,5 @@
13
13
  formatSearching: function () { return "A pesquisar…"; }
14
14
  };
15
15
 
16
- $.extend($.fn.select2.defaults, $.fn.select2.locales['pt-PT']);
16
+ $.extend($.fn.select2.defaults, $.fn.select2.locales['pt']);
17
17
  })(jQuery);
@@ -5,38 +5,3 @@
5
5
  padding-left: 0;
6
6
  list-style: none;
7
7
  }
8
-
9
- dl {
10
- display: flex;
11
- flex-wrap: wrap;
12
- justify-content: space-between;
13
- width: 100%;
14
- overflow: hidden;
15
- margin: 5px 0;
16
- color: lighten($body-color, 15);
17
-
18
- dt,
19
- dd {
20
- min-width: 40%;
21
- line-height: 16px;
22
- padding: 5px;
23
- }
24
-
25
- dt {
26
- font-weight: $font-weight-bold;
27
- padding-left: 0;
28
- }
29
-
30
- dd {
31
- text-align: right;
32
- padding-right: 0;
33
- margin-left: 0;
34
- }
35
- }
36
-
37
- .dl-collapse {
38
- dt,
39
- dd {
40
- width: auto;
41
- }
42
- }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-22 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.8
19
+ version: 3.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.8
26
+ version: 3.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.8
33
+ version: 3.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.8
40
+ version: 3.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coffee-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -516,6 +516,7 @@ files:
516
516
  - app/views/spree/admin/promotion_categories/edit.html.erb
517
517
  - app/views/spree/admin/promotion_categories/index.html.erb
518
518
  - app/views/spree/admin/promotion_categories/new.html.erb
519
+ - app/views/spree/admin/promotion_code_batches/_form_fields.html.erb
519
520
  - app/views/spree/admin/promotion_code_batches/download.csv.ruby
520
521
  - app/views/spree/admin/promotion_code_batches/index.html.erb
521
522
  - app/views/spree/admin/promotion_code_batches/new.html.erb
@@ -800,7 +801,7 @@ files:
800
801
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_nl.js
801
802
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pl.js
802
803
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pt-BR.js
803
- - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pt-PT.js
804
+ - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pt.js
804
805
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_ro.js
805
806
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_rs.js
806
807
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_ru.js
@@ -919,7 +920,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
919
920
  - !ruby/object:Gem::Version
920
921
  version: 1.8.23
921
922
  requirements: []
922
- rubygems_version: 3.3.7
923
+ rubygems_version: 3.2.20
923
924
  signing_key:
924
925
  specification_version: 4
925
926
  summary: Admin interface for the Solidus e-commerce framework.