solidus_backend 3.0.1 → 3.1.2

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/product_picker.js +2 -1
  3. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +1 -1
  4. data/app/controllers/spree/admin/locale_controller.rb +12 -11
  5. data/app/controllers/spree/admin/orders_controller.rb +1 -1
  6. data/app/controllers/spree/admin/products_controller.rb +1 -1
  7. data/app/controllers/spree/admin/resource_controller.rb +5 -2
  8. data/app/controllers/spree/admin/search_controller.rb +11 -1
  9. data/app/controllers/spree/admin/stock_items_controller.rb +6 -1
  10. data/app/controllers/spree/admin/variants_controller.rb +2 -2
  11. data/app/views/spree/admin/orders/index.html.erb +4 -0
  12. data/app/views/spree/admin/products/index.html.erb +1 -1
  13. data/app/views/spree/admin/promotion_code_batches/_form_fields.html.erb +22 -0
  14. data/app/views/spree/admin/promotion_code_batches/new.html.erb +4 -24
  15. data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -16
  16. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +1 -1
  17. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  18. data/app/views/spree/admin/shared/_order_tabs.html.erb +1 -1
  19. data/app/views/spree/admin/variants/_form.html.erb +1 -1
  20. data/app/views/spree/admin/variants/_table_filter.html.erb +1 -1
  21. data/app/views/spree/admin/variants/index.html.erb +1 -1
  22. data/lib/spree/backend/engine.rb +4 -0
  23. data/solidus_backend.gemspec +1 -1
  24. data/vendor/assets/javascripts/solidus_admin/select2_locales/{select2_locale_pt-PT.js → select2_locale_pt.js} +2 -2
  25. metadata +17 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efa1e8e4ed76655a54de7bfa571e16ff869216722bfef15006dddb2748676cb0
4
- data.tar.gz: 9119a85ad6f661c566446425b224fe975026d509c53a42da7a59bf0dd6c0bfc1
3
+ metadata.gz: faffdc96fe202da42b65e2db88378186cc0fd823b480afa9fc3870e4e9573396
4
+ data.tar.gz: 5bdb6db147ec1110ab143f9ff19986238d98efb351f4b4666bd3279dffd4d2fa
5
5
  SHA512:
6
- metadata.gz: b473137b585a7ee43e757b0cf7bfe4232f1b43ad5f5725b72448b84a310db04a4be6251b31a8ced31152013ea5c7862b6d3c0cddd0e520482e71d1b73b682e3f
7
- data.tar.gz: 99eba5d27ed1c2d61376ad8c5b38132245ac59786020fc33b83826f12fd0c2278a7b794da55d58be08aae15c82076bb8ca722dbd9a1ebedd48398740faa6a1cb
6
+ metadata.gz: f38458d7b4cc2e78d175fa2f10dc90b3d069eb02e804a65ead5fc7efc8e5e3ea6a74dee3f7a1caa29f7ef137b74183bbd7a3c850bc9f1f02405e448103750baf
7
+ data.tar.gz: a60fbc0edfd1eb08852eedd2b0cec89bc481e845fa88fc37e32d4ff7126a5d4dd547ba7d816e105c234912d1c47e8e618156361398b35ab535c2c7887e943bfd
@@ -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>
@@ -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
@@ -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
@@ -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">
@@ -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">
@@ -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 %>
@@ -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
 
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  </div>
13
13
 
14
- <% if product.variants.discarded.any? %>
14
+ <% if product.variants.with_discarded.discarded.any? %>
15
15
  <div class="col-2">
16
16
  <div class="field checkbox">
17
17
  <label>
@@ -14,7 +14,7 @@
14
14
  <% end %>
15
15
  <% end %>
16
16
 
17
- <% if @variants.any? || @product.variants.discarded.any? %>
17
+ <% if @product.variants.with_discarded.any? %>
18
18
  <%= render "table_filter", product: @product %>
19
19
  <%= render "table", variants: @variants %>
20
20
  <% else %>
@@ -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
@@ -32,6 +32,6 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency 'responders'
33
33
  s.add_dependency 'sassc-rails'
34
34
 
35
- s.add_dependency 'autoprefixer-rails'
35
+ s.add_dependency 'autoprefixer-rails', '~> 10.2', '>= 10.2.5.1'
36
36
  s.add_dependency 'handlebars_assets', '~> 0.23'
37
37
  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);
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.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-09-29 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.1
19
+ version: 3.1.2
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.1
26
+ version: 3.1.2
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.1
33
+ version: 3.1.2
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.1
40
+ version: 3.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coffee-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -140,16 +140,22 @@ dependencies:
140
140
  name: autoprefixer-rails
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '10.2'
143
146
  - - ">="
144
147
  - !ruby/object:Gem::Version
145
- version: '0'
148
+ version: 10.2.5.1
146
149
  type: :runtime
147
150
  prerelease: false
148
151
  version_requirements: !ruby/object:Gem::Requirement
149
152
  requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '10.2'
150
156
  - - ">="
151
157
  - !ruby/object:Gem::Version
152
- version: '0'
158
+ version: 10.2.5.1
153
159
  - !ruby/object:Gem::Dependency
154
160
  name: handlebars_assets
155
161
  requirement: !ruby/object:Gem::Requirement
@@ -510,6 +516,7 @@ files:
510
516
  - app/views/spree/admin/promotion_categories/edit.html.erb
511
517
  - app/views/spree/admin/promotion_categories/index.html.erb
512
518
  - app/views/spree/admin/promotion_categories/new.html.erb
519
+ - app/views/spree/admin/promotion_code_batches/_form_fields.html.erb
513
520
  - app/views/spree/admin/promotion_code_batches/download.csv.ruby
514
521
  - app/views/spree/admin/promotion_code_batches/index.html.erb
515
522
  - app/views/spree/admin/promotion_code_batches/new.html.erb
@@ -794,7 +801,7 @@ files:
794
801
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_nl.js
795
802
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pl.js
796
803
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pt-BR.js
797
- - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pt-PT.js
804
+ - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_pt.js
798
805
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_ro.js
799
806
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_rs.js
800
807
  - vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_ru.js
@@ -913,7 +920,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
913
920
  - !ruby/object:Gem::Version
914
921
  version: 1.8.23
915
922
  requirements: []
916
- rubygems_version: 3.1.4
923
+ rubygems_version: 3.1.6
917
924
  signing_key:
918
925
  specification_version: 4
919
926
  summary: Admin interface for the Solidus e-commerce framework.