solidus_backend 2.8.3 → 2.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42d818d792b65cf64ed6573d5764375d7651985927544fbaf05bb8db3a290102
4
- data.tar.gz: e4e6d3ff0f88f9d3a61932591f1ad72c6944eba2a05d530fcf317a1fb999425f
3
+ metadata.gz: 656d0d74738d27331ee61f3919b4c00730a2a838ca7d4a9d61ff0a8da4541fc7
4
+ data.tar.gz: 6ccf4e5b45e08d135f8962bad14c93a01ef02694d38b235a4a9a440278f98474
5
5
  SHA512:
6
- metadata.gz: 5949b35132b3528773ee6cc944217a3caba9febbbad05afd98160e20e274e0a2d54a92fca40c16df083ec95003615ff31e81a0afc45111b03eecaa4476407bde
7
- data.tar.gz: a346b8490020652efb99c6c8383ef0a374e0a5a282ed5d716eba76a6f35f2d6a3032f300cba5b5da4d1c336db0f490faec48d9f4261427d11700402f86d794a8
6
+ metadata.gz: b80bdbb8243e9fdb07e36490b5182a64cdb70986e2b069984add6aa01f7ffc25f9bc85e2bdaf431b69157384121a7198f259f1615db4d7b6902a2efc8af99ef4
7
+ data.tar.gz: 595378c0c2a1cfa6cbfd2b6c116a10a470dff9d56daca491188202583b6063ef60fc8f6e4c705c3dbc00adaa68ce73ab3de61c59cf940863f089f605820b7eea
@@ -13,7 +13,8 @@ Spree.Views.Stock.EditStockItemRow = Backbone.View.extend({
13
13
  "click .submit": "onSubmit",
14
14
  "submit form": "onSubmit",
15
15
  "click .cancel": "onCancel",
16
- 'input [name="count_on_hand"]': "countOnHandChanged"
16
+ 'input [name="count_on_hand"]': "countOnHandChanged",
17
+ 'input [name="backorderable"]': "backorderableChanged"
17
18
  },
18
19
 
19
20
  template: HandlebarsTemplates['stock_items/stock_location_stock_item'],
@@ -43,6 +44,20 @@ Spree.Views.Stock.EditStockItemRow = Backbone.View.extend({
43
44
  this.render();
44
45
  },
45
46
 
47
+ onChange: function() {
48
+ var count_on_hand_changed = this.previousAttributes.count_on_hand != this.model.attributes.count_on_hand;
49
+ var backorderable_changed = this.previousAttributes.backorderable != this.model.attributes.backorderable;
50
+ var changed = count_on_hand_changed || backorderable_changed;
51
+
52
+ this.$el.toggleClass('changed', changed);
53
+ },
54
+
55
+ backorderableChanged: function(ev) {
56
+ this.model.set("backorderable", ev.target.checked);
57
+
58
+ this.onChange();
59
+ },
60
+
46
61
  countOnHandChanged: function(ev) {
47
62
  var diff = parseInt(ev.currentTarget.value), newCount;
48
63
  if (isNaN(diff)) diff = 0;
@@ -56,7 +71,8 @@ Spree.Views.Stock.EditStockItemRow = Backbone.View.extend({
56
71
  this.model.set("count_on_hand", newCount);
57
72
  this.$count_on_hand_display.text(newCount);
58
73
  }
59
- this.$el.toggleClass('changed', diff !== 0);
74
+
75
+ this.onChange();
60
76
  },
61
77
 
62
78
  onSuccess: function() {
@@ -1,5 +1,5 @@
1
1
  // Make color very close to white
2
- @function very-light($color, $adjust: 3){
2
+ @function very-light($color, $adjust: 3){
3
3
  @if type-of($adjust) == 'number' and $adjust > 0 {
4
4
  @for $i from 0 through 100 {
5
5
  @if lighten($color, $i) == white and ($i - $adjust) > $adjust {
@@ -10,6 +10,7 @@
10
10
  @else {
11
11
  @debug "Please correct $adjust value. It should be number and larger then 0. Currently it is '#{type-of($adjust)}' with value '#{$adjust}'"
12
12
  }
13
+ @return $color;
13
14
  };
14
15
 
15
16
  // Quick fix for dynamic variables missing in SASS
@@ -57,6 +57,15 @@ describe "Product Stock", type: :feature do
57
57
  expect(stock_item.stock_movements.first.quantity).to eq(-4)
58
58
  end
59
59
 
60
+ it "can toggle backorderable", js: true do
61
+ toggle_backorderable(value: false)
62
+
63
+ click_link "Product Stock"
64
+ within("tr#spree_variant_#{variant.id}") do
65
+ expect(find(:css, "input[type='checkbox']")).not_to be_checked
66
+ end
67
+ end
68
+
60
69
  def adjust_count_on_hand(count_on_hand)
61
70
  within("tr#spree_variant_#{variant.id}") do
62
71
  find(:css, "input[type='number']").set(count_on_hand)
@@ -65,6 +74,14 @@ describe "Product Stock", type: :feature do
65
74
  expect(page).to have_content('Updated Successfully')
66
75
  end
67
76
 
77
+ def toggle_backorderable(value: true)
78
+ within("tr#spree_variant_#{variant.id}") do
79
+ find(:css, "input[type='checkbox']").set(value)
80
+ click_icon :check
81
+ end
82
+ expect(page).to have_content('Updated Successfully')
83
+ end
84
+
68
85
  context "with stock locations that don't have stock items for variant yet" do
69
86
  before do
70
87
  create(:stock_location, name: 'Other location', propagate_all_variants: false)
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: 2.8.3
4
+ version: 2.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-16 00:00:00.000000000 Z
11
+ date: 2019-06-12 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: 2.8.3
19
+ version: 2.8.4
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: 2.8.3
26
+ version: 2.8.4
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: 2.8.3
33
+ version: 2.8.4
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: 2.8.3
40
+ version: 2.8.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coffee-rails
43
43
  requirement: !ruby/object:Gem::Requirement