workarea-admin 3.5.6 → 3.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a8fa975ea8aaf2ec8c71f21118f5a6672be8af2a16221654ee8caef70edf542
4
- data.tar.gz: 7aecf7b4a34ccf6f640940302d8c1f66441786457d1cba7d628e37dd2c9d305a
3
+ metadata.gz: a50c0890b678de1a3775d9227c9a1cf3a9c2a874e933342d986c943937d9b369
4
+ data.tar.gz: 0d30f205a6b061caa140360efdc87ebc9bc580a1673d09fb256a7dfc5a70b501
5
5
  SHA512:
6
- metadata.gz: 596fb4fccb2975532e5f7cd53a4b9855cb403a39abf885760f05e99fa86adf900ff1868285d0dc63e48a11b0dba603955727f65b0bfb184ee9d5b936b82ef15b
7
- data.tar.gz: 135d270f27bb7fa8cd61b803f5c568278a477e16dfb8dcd0669a4bd334a79937c2269b3e16f7ac7118a9f176f125b95d5c305dd3417d0850a52e057b9462c1dd
6
+ metadata.gz: 04c7943314cf9a6fc8ffe116bbdd0f6d15ccfa0f13f55e037869106593759a03d70e7554f1d898d9c9e740a8602722de9383bf067427d59a1f7ad56b6d2d3085
7
+ data.tar.gz: b305c1426413775da437f2887b25f42d8c4da83c75b4fbb32cf6a19bd05c1949b06425d25cc30feaeb7b2db35ecc64c6daef6ad50264d7c8a7b81a5a32ade014
@@ -101,11 +101,13 @@ WORKAREA.registerModule('datetimepickerFields', (function () {
101
101
  },
102
102
 
103
103
  injectUI = function($input) {
104
- var placeholder = JST['workarea/admin/templates/datetime_picker']({
104
+ var required = !_.isEmpty($input.attr('required')) ? 'required' : '',
105
+ placeholder = JST['workarea/admin/templates/datetime_picker']({
105
106
  id: $input.attr('id'),
106
107
  initialDateTime: parseDate($input),
107
108
  fieldSuffixes: WORKAREA.config.datetimepickerFields.fieldSuffixes,
108
- name: $input.attr('id')
109
+ name: $input.attr('id'),
110
+ required: required
109
111
  });
110
112
 
111
113
  // Prevents UI being injected twice on browser back
@@ -4,13 +4,13 @@
4
4
  <div class="grid__cell grid__cell--50-at-medium">
5
5
  <div class='property'>
6
6
  <label for="<%= name + fieldSuffixes.date %>" class='property__name'><%= I18n.t('workarea.admin.js.datetime_picker.date') %></label>
7
- <input type="text" name="<%= name + fieldSuffixes.date %>" id="<%= name + fieldSuffixes.date %>" class="text-box" data-datetimepicker-field-date-input='' placeholder='YYYY-MM-DD' pattern='^\d{4}-\d{2}-\d{2}$' />
7
+ <input type="text" name="<%= name + fieldSuffixes.date %>" id="<%= name + fieldSuffixes.date %>" class="text-box" data-datetimepicker-field-date-input='' placeholder='YYYY-MM-DD' pattern='^\d{4}-\d{2}-\d{2}$' <%= required %> />
8
8
  </div>
9
9
  </div>
10
10
  <div class="grid__cell grid__cell--50-at-medium">
11
11
  <div class='property'>
12
12
  <label for="<%= name + fieldSuffixes.hours %>" class='property__name'><%= I18n.t('workarea.admin.js.datetime_picker.time') %></label>
13
- <select id="<%= name + fieldSuffixes.hours %>" name="<%= name + fieldSuffixes.hours %>">
13
+ <select id="<%= name + fieldSuffixes.hours %>" name="<%= name + fieldSuffixes.hours %>" <%= required %>>
14
14
  <% for ( var i = 1; i <= 12; i++ ) {
15
15
  var selected = ( initialDateTime.hours == i ) ? 'selected' : '';
16
16
  %>
@@ -18,7 +18,7 @@
18
18
  <% } %>
19
19
  </select>
20
20
 
21
- <select id="<%= name + fieldSuffixes.minutes %>" name="<%= name + fieldSuffixes.minutes %>">
21
+ <select id="<%= name + fieldSuffixes.minutes %>" name="<%= name + fieldSuffixes.minutes %>" <%= required %>>
22
22
  <% for ( var i = 0; i < 60; i++ ) {
23
23
  if (i < 10) { i = '0' + i }
24
24
  var selected = ( initialDateTime.minutes == i ) ? 'selected' : '';
@@ -27,7 +27,7 @@
27
27
  <% } %>
28
28
  </select>
29
29
 
30
- <select id="<%= name + fieldSuffixes.ampm %>" name="<%= name + fieldSuffixes.ampm %>">
30
+ <select id="<%= name + fieldSuffixes.ampm %>" name="<%= name + fieldSuffixes.ampm %>" <%= required %>>
31
31
  <option value="am" <%= initialDateTime.ampm === 'am' ? 'selected' : '' %> >am</option>
32
32
  <option value="pm" <%= initialDateTime.ampm === 'pm' ? 'selected' : '' %> >pm</option>
33
33
  </select>
@@ -100,7 +100,7 @@ module Workarea
100
100
  end
101
101
 
102
102
  def track_index_filters
103
- session[:last_index_path] = request.fullpath
103
+ session[:last_index_path] = request.fullpath unless request.xhr? || request.format.json?
104
104
  end
105
105
  end
106
106
  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'
@@ -45,7 +45,7 @@
45
45
  = text_field_tag 'custom_event[name]', nil, class: 'text-box', required: true
46
46
  .property
47
47
  .box.box--rounded.box--padded
48
- = hidden_field_tag 'custom_event[occurred_at]', nil, data: { datetimepicker_field: { inline: true } }
48
+ = hidden_field_tag 'custom_event[occurred_at]', nil, required: true, data: { datetimepicker_field: { inline: true } }
49
49
  .align-center
50
50
  = submit_tag t('workarea.admin.reports.timeline.add_custom_event'), class: 'button button--create button--small'
51
51
 
@@ -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,22 @@ 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.config.jump_to_type_limit = 2
240
+ Workarea.config.jump_to_results_per_type = 2
241
+
242
+ 5.times { |i| create_product(name: "Test Product #{i}") }
243
+ 5.times { |i| create_category(name: "Test Category #{i}") }
244
+
245
+ get admin.jump_to_path(q: 'test')
246
+ results = JSON.parse(response.body)['results']
247
+
248
+ assert_equal(
249
+ %w(Products Products Categories Categories),
250
+ results.map { |r| r['type'] }
251
+ )
252
+ end
237
253
  end
238
254
  end
239
255
  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.5.6
4
+ version: 3.5.7
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.5.6
19
+ version: 3.5.7
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.5.6
26
+ version: 3.5.7
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.5.6
33
+ version: 3.5.7
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.5.6
40
+ version: 3.5.7
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email:
@@ -1334,6 +1334,7 @@ files:
1334
1334
  - test/integration/workarea/admin/help_articles_integration_test.rb
1335
1335
  - test/integration/workarea/admin/impersonations_integration_test.rb
1336
1336
  - test/integration/workarea/admin/import_taxes_integration_test.rb
1337
+ - test/integration/workarea/admin/index_tracking_integration_test.rb
1337
1338
  - test/integration/workarea/admin/inventory_skus_integration_test.rb
1338
1339
  - test/integration/workarea/admin/jump_to_integration_test.rb
1339
1340
  - test/integration/workarea/admin/menus_integration_test.rb