solidus_backend 3.0.2 → 3.1.3

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 (24) 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/vendor/assets/javascripts/solidus_admin/select2_locales/{select2_locale_pt-PT.js → select2_locale_pt.js} +2 -2
  24. metadata +12 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b7299354ddbe351b37ff486c4a460fb9b6f90ff970930189fa50813961fa297
4
- data.tar.gz: e1960a9de707eabe9f5550a39dd63ea740c638b4dcdf3a95783a2676951c23c6
3
+ metadata.gz: 8d2ffe2f5b047902e746424ec130c9e47c26c0afe0819d5b65a5dd69271c932c
4
+ data.tar.gz: e9e4c1eed9321da8beb1c903d417409eb7d8adefc71cc659f044ee011addc730
5
5
  SHA512:
6
- metadata.gz: d105eef0f3b2e262a65e8bf71b9efc7068014bb3820d6812554ba154f48fb90a7862f4607453ffd5d69f2dd7dcdb1ed4057a4d21645831957dccf09c0f56c3ae
7
- data.tar.gz: 4a3d800b17a9fbd16af4164789591d31e72f159cc7749d942725606569d2ed43dd05f2ddfc8261d27a08559db3aeeebcb669509f83dcbc8e68132731a46073f9
6
+ metadata.gz: afe612336c190aee45444febca10597b456dcd323b6c0b95cf1180396d3c2c44444bb3b6691f0e235c70839ea8410f85e178980fcb1061671caa0e7b7cb6a64c
7
+ data.tar.gz: 0bdc494c94e9040f0132bfdfa397624a6bac51cfe4adb7b148fef6e2a06b03f905621ac28dade04945674e74185ba3247589ea6e0c3cb4ccf55aaf3b3f21b6b0
@@ -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
@@ -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.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-10 00:00:00.000000000 Z
11
+ date: 2021-11-17 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.2
19
+ version: 3.1.3
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.2
26
+ version: 3.1.3
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.2
33
+ version: 3.1.3
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.2
40
+ version: 3.1.3
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
@@ -904,7 +905,7 @@ homepage: http://solidus.io
904
905
  licenses:
905
906
  - BSD-3-Clause
906
907
  metadata: {}
907
- post_install_message:
908
+ post_install_message:
908
909
  rdoc_options: []
909
910
  require_paths:
910
911
  - lib
@@ -919,8 +920,8 @@ 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.2.20
923
- signing_key:
923
+ rubygems_version: 3.1.2
924
+ signing_key:
924
925
  specification_version: 4
925
926
  summary: Admin interface for the Solidus e-commerce framework.
926
927
  test_files: []