workarea-admin 3.4.28 → 3.4.29

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5e5e70ec8db64536691e2c00009ec4cc3fbeafa558d063613272f4e68d9d3a8
4
- data.tar.gz: fb41f84d15df3ec6e66e5005186916fec71e2e6d59b715a353254fb067edad67
3
+ metadata.gz: 9da8bc75f20143ab5701f535e4cce9e2b4a84f9330faab4cbd5fed620cdf6093
4
+ data.tar.gz: 6e06dfa75cc2b6292032eba0cd2ca07b14b2948b582e33eeecac0a1320a8646d
5
5
  SHA512:
6
- metadata.gz: a6dac33cba255d0f435cdfe82510a1bb048bab67b01a39c426441eb85edf362dd7f68be808c9eaa84594d1bb1c8eb79efff56bfce50b1ecd19d40194f66f5e22
7
- data.tar.gz: 9155090353b2d4b80e7860c4d14892dbcfd3a60ea83b1af751fd8baacb9f96085f234e1c541a301cabded3afea9d03720248e640fec99074496a10e956c06546
6
+ metadata.gz: 0b679c8124fd1b8d5ebf95d68665229a27ba2c16ca6299bac8cc578181b3e14fd2bbca99fc9bc1f0c744699121aa793f39ef2c6ea934ab6d73f995423de4ba65
7
+ data.tar.gz: 935c49a925308f4158eb9800bab1775ccd2e3383306126da65974436e4c59bd951f272c1730811c12cbd78bdc67f8bf79c33655fe6da07ebc5e285d416535162
@@ -102,7 +102,7 @@ module Workarea
102
102
  end
103
103
 
104
104
  def track_index_filters
105
- session[:last_index_path] = request.fullpath
105
+ session[:last_index_path] = request.fullpath unless request.xhr? || request.format.json?
106
106
  end
107
107
  end
108
108
  end
@@ -30,14 +30,14 @@ module Workarea
30
30
  #
31
31
  # @return [Money]
32
32
  def min_price
33
- sell_prices.first.sell
33
+ sell_prices.first&.sell
34
34
  end
35
35
 
36
36
  # The highest regular price set on this SKU.
37
37
  #
38
38
  # @return [Money]
39
39
  def max_price
40
- sell_prices.last.sell
40
+ sell_prices.last&.sell
41
41
  end
42
42
 
43
43
  # Show a price range if the `min_price` and `max_price` are not
@@ -45,7 +45,7 @@ module Workarea
45
45
  #
46
46
  # @return [Boolean]
47
47
  def show_range?
48
- min_price != max_price
48
+ min_price.present? && max_price.present? && min_price != max_price
49
49
  end
50
50
 
51
51
  # This SKU is considered "on sale" if it is marked as such, or if
@@ -14,25 +14,25 @@
14
14
  %li
15
15
  %strong #{t('workarea.admin.fields.tax_code')}:
16
16
  = model.tax_code.presence || '(none)'
17
- %li
18
- %strong #{t('workarea.admin.fields.msrp')}:
19
- - if model.msrp.blank?
20
- = t('workarea.admin.cards.attributes.no_value')
21
- - else
22
- = number_to_currency model.msrp
23
17
  %li
24
18
  %strong #{t('workarea.admin.fields.on_sale')}:
25
19
  = model.on_sale?.to_s.titleize
26
20
  %li
27
21
  %strong #{t('workarea.admin.fields.discountable')}:
28
22
  = model.discountable?.to_s.titleize
23
+ %li
24
+ %strong #{t('workarea.admin.fields.msrp')}:
25
+ - if model.msrp.blank?
26
+ = t('workarea.admin.cards.attributes.no_value')
27
+ - else
28
+ = number_to_currency model.msrp
29
+ = append_partials('admin.pricing_sku_attributes_card', pricing_sku: model)
29
30
  %li
30
31
  %strong= t('workarea.admin.fields.updated_at')
31
32
  #{local_time_ago(model.updated_at)}
32
33
  %li
33
34
  %strong= t('workarea.admin.fields.created_at')
34
35
  #{local_time_ago(model.created_at)}
35
- = append_partials('admin.pricing_sku_attributes_card', pricing_sku: model)
36
36
 
37
37
  = link_to edit_pricing_sku_path(model), class: 'card__button' do
38
38
  %span.button.button--small= t('workarea.admin.cards.attributes.button')
@@ -31,11 +31,6 @@
31
31
  = label_tag 'sku[tax_code]', t('workarea.admin.fields.tax_code'), class: 'property__name'
32
32
  = text_field_tag 'sku[tax_code]', @sku.tax_code, class: 'text-box'
33
33
 
34
- .property
35
- = label_tag 'sku_msrp', t('workarea.admin.fields.msrp'), class: 'property__name'
36
- = currency_symbol
37
- = text_field_tag 'sku[msrp]', @sku.msrp, class: 'text-box text-box--small'
38
-
39
34
  .grid
40
35
  .grid__cell.grid__cell--50.grid__cell--25-at-medium
41
36
  .property
@@ -47,6 +42,11 @@
47
42
  %span.property__name= t('workarea.admin.fields.discountable')
48
43
  = toggle_button_for 'sku[discountable]', @sku.discountable?, title_true: t('workarea.admin.pricing_skus.allow_discounting'), title_false: t('workarea.admin.pricing_skus.disallow_discounting')
49
44
 
45
+ .property
46
+ = label_tag 'sku_msrp', t('workarea.admin.fields.msrp'), class: 'property__name'
47
+ = currency_symbol
48
+ = text_field_tag 'sku[msrp]', @sku.msrp, class: 'text-box text-box--small'
49
+
50
50
  = append_partials('admin.pricing_sku_fields', sku: @sku)
51
51
 
52
52
  .grid.grid--huge
@@ -46,6 +46,7 @@
46
46
  = check_box_tag 'select_all', nil, false, id: 'select_all', class: 'checkbox__input', data: { bulk_action_select_all: '' }
47
47
  = label_tag 'select_all', t('workarea.admin.bulk_actions.select_all'), class: 'checkbox__label'
48
48
  %th= t('workarea.admin.fields.sku')
49
+ = append_partials('admin.pricing_skus_additional_field_labels')
49
50
  %th.align-right= t('workarea.admin.fields.msrp')
50
51
  %th.align-right= t('workarea.admin.fields.sell_price')
51
52
  %th.align-center= t('workarea.admin.fields.on_sale')
@@ -61,6 +62,7 @@
61
62
  %td
62
63
  = link_to result.id, pricing_sku_path(result)
63
64
  = upcoming_changesets_icon_for(result)
65
+ = append_partials('admin.pricing_skus_additional_fields', result: result)
64
66
  %td.align-right= number_to_currency result.msrp
65
67
  %td.align-right= result.sell_price
66
68
  %td.align-center= t("workarea.admin.#{result.on_sale?}")
@@ -26,13 +26,16 @@
26
26
  = label_tag 'sku[tax_code]', t('workarea.admin.fields.tax_code'), class: 'property__name'
27
27
  = text_field_tag 'sku[tax_code]', @sku.tax_code, class: 'text-box', placeholder: t('workarea.admin.pricing_skus.tax_code_placeholder')
28
28
 
29
- .property
30
- %span.property__name= t('workarea.admin.fields.on_sale')
31
- = toggle_button_for 'sku[on_sale]', @sku.on_sale?, title_true: t('workarea.admin.pricing_skus.on_sale'), title_false: t('workarea.admin.pricing_skus.not_on_sale')
29
+ .grid
30
+ .grid__cell.grid__cell--50.grid__cell--25-at-medium
31
+ .property
32
+ %span.property__name= t('workarea.admin.fields.on_sale')
33
+ = toggle_button_for 'sku[on_sale]', @sku.on_sale?, title_true: t('workarea.admin.pricing_skus.on_sale'), title_false: t('workarea.admin.pricing_skus.not_on_sale')
32
34
 
33
- .property
34
- %span.property__name= t('workarea.admin.fields.discountable')
35
- = toggle_button_for 'sku[discountable]', @sku.discountable?, title_true: t('workarea.admin.pricing_skus.allow_discounting'), title_false: t('workarea.admin.pricing_skus.disallow_discounting')
35
+ .grid__cell.grid__cell--50.grid__cell--25-at-medium
36
+ .property
37
+ %span.property__name= t('workarea.admin.fields.discountable')
38
+ = toggle_button_for 'sku[discountable]', @sku.discountable?, title_true: t('workarea.admin.pricing_skus.allow_discounting'), title_false: t('workarea.admin.pricing_skus.disallow_discounting')
36
39
 
37
40
  .property
38
41
  = label_tag 'sku_msrp', t('workarea.admin.fields.msrp'), class: 'property__name'
@@ -2,11 +2,13 @@
2
2
 
3
3
  .view
4
4
  .view__header
5
- .grid.grid--middle.grid--center
5
+ .grid.grid--middle.grid--right
6
6
  .grid__cell.grid__cell--50
7
7
  .view__heading
8
8
  = link_to "↑ #{t('workarea.admin.users.index.dashboard_link')}", people_dashboards_path, class: 'view__dashboard-button'
9
9
  %h1= t('workarea.admin.users.index.title')
10
+ .grid__cell.grid__cell--25
11
+ = append_partials('admin.user_index_aux_navigation')
10
12
 
11
13
  .view__container
12
14
  .browsing-controls.browsing-controls--with-divider.browsing-controls--center{ class: ('browsing-controls--filters-displayed' unless @search.toggle_facets?) }
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class IndexTrackingIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_track_index_filters
9
+ get admin.pricing_skus_path
10
+
11
+ assert_equal(admin.pricing_skus_path, session[:last_index_path])
12
+ assert_no_changes -> { session[:last_index_path] } do
13
+ get admin.catalog_products_path(format: :json)
14
+ end
15
+ assert_no_changes -> { session[:last_index_path] } do
16
+ get admin.catalog_products_path, xhr: true
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -234,6 +234,24 @@ module Workarea
234
234
  results = JSON.parse(response.body)['results']
235
235
  assert_equal(0, results.length)
236
236
  end
237
+
238
+ def test_limiting_results_by_type
239
+ Workarea.with_config do |config|
240
+ config.jump_to_type_limit = 2
241
+ config.jump_to_results_per_type = 2
242
+
243
+ 5.times { |i| create_product(name: "Test Product #{i}") }
244
+ 5.times { |i| create_category(name: "Test Category #{i}") }
245
+
246
+ get admin.jump_to_path(q: 'test')
247
+ results = JSON.parse(response.body)['results']
248
+
249
+ assert_equal(
250
+ %w(Products Products Categories Categories),
251
+ results.map { |r| r['type'] }
252
+ )
253
+ end
254
+ end
237
255
  end
238
256
  end
239
257
  end
@@ -30,6 +30,10 @@ module Workarea
30
30
  @sku.update!(on_sale: false)
31
31
 
32
32
  assert_equal(3.to_m, @sku.min_price)
33
+
34
+ @sku.prices.destroy_all
35
+
36
+ assert_nil(@sku.min_price)
33
37
  end
34
38
 
35
39
  def test_max_price
@@ -38,6 +42,10 @@ module Workarea
38
42
  @sku.update!(on_sale: false)
39
43
 
40
44
  assert_equal(4.to_m, @sku.max_price)
45
+
46
+ @sku.prices.destroy_all
47
+
48
+ assert_nil(@sku.min_price)
41
49
  end
42
50
 
43
51
  def test_show_range?
@@ -46,6 +54,10 @@ module Workarea
46
54
  @sku.prices.last.destroy!
47
55
 
48
56
  refute(@sku.show_range?)
57
+
58
+ @sku.prices.destroy_all
59
+
60
+ refute(@sku.show_range?)
49
61
  end
50
62
 
51
63
  def test_on_sale?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.28
4
+ version: 3.4.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-03 00:00:00.000000000 Z
11
+ date: 2020-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.4.28
19
+ version: 3.4.29
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.4.28
26
+ version: 3.4.29
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: workarea-storefront
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.4.28
33
+ version: 3.4.29
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.4.28
40
+ version: 3.4.29
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email:
@@ -1220,6 +1220,7 @@ files:
1220
1220
  - test/integration/workarea/admin/help_articles_integration_test.rb
1221
1221
  - test/integration/workarea/admin/impersonations_integration_test.rb
1222
1222
  - test/integration/workarea/admin/import_taxes_integration_test.rb
1223
+ - test/integration/workarea/admin/index_tracking_integration_test.rb
1223
1224
  - test/integration/workarea/admin/inventory_skus_integration_test.rb
1224
1225
  - test/integration/workarea/admin/jump_to_integration_test.rb
1225
1226
  - test/integration/workarea/admin/menus_integration_test.rb