workarea-admin 3.4.37 → 3.4.42

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: 89563d62b41645ebdde7c2fbfc6d85571e1746bc6c063b72bb3752875a736d9f
4
- data.tar.gz: 9498efc069915970ece5e12dc22ad218e5809dd486fc613f41f98df732d5071a
3
+ metadata.gz: 48f2aebd5326ae73d326a0da5946c65394af32592db518b99386d710a4843f3e
4
+ data.tar.gz: 56f42f24deb50a9f8508ae4c187b6c940a0205ae922544b2edb208e5028fafec
5
5
  SHA512:
6
- metadata.gz: f2bbb6e0a67747bbaca53d6e48b10c817556903a37a2b7cc85656e96bd10ef8a5d913844f8a2b3358efc9b04669fa8439955233e1bd6d9ff0ee20c61ff0cd367
7
- data.tar.gz: e5ed533b1ce16b6ddd78942510efe4fa61f123bb00efa8336de36378b5aec30401bc72ff18e02d8be9cf3f7820441f361e092d44fad3b5003d7f64ae4c9c3378
6
+ metadata.gz: '02804b99d7bd74e9b2e466e770d9c769a3937010a361f30c0f73e6904f16ee930d5385e9b49b66356ac82ccf855a6cae0c87a854d48f2328afbc4668ef9c18d0'
7
+ data.tar.gz: 0ea526e27c8248f012b08a700c4fada40867e1f41caef37b9fce47699d55b2fe49bf8933ad95ed4c955c05860e355d53656543365af092f2eafadf8af2e975de
@@ -23,8 +23,9 @@ WORKAREA.registerModule('newNavigationTaxons', (function () {
23
23
  createRemoteSelect = function (event) {
24
24
  var $typeSelect = $(event.currentTarget),
25
25
  $idSelect = $('[name=navigable_id]', event.delegateTarget),
26
+ $section = $typeSelect.closest('[data-new-navigation-taxon]'),
26
27
  settings = getConfig($typeSelect),
27
- selected = $typeSelect.data('newNavigationTaxon');
28
+ selected = $section.data('newNavigationTaxon');
28
29
 
29
30
  if ($idSelect.is('.select2-hidden-accessible') && _.isUndefined(selected)) {
30
31
  destroyRemoteSelect($idSelect);
@@ -20,6 +20,10 @@ $toggle-button-status-negative-color: $red !default;
20
20
  display: inline-block;
21
21
  }
22
22
 
23
+ .toggle-button--disabled {
24
+ opacity: 0.5;
25
+ }
26
+
23
27
  /**
24
28
  * 1. provides positiioning context for `.toggle-button__label`
25
29
  * 2. height + vertical margin = `.text-box` height
@@ -21,8 +21,9 @@ module Workarea
21
21
  end
22
22
 
23
23
  if attributes[:inventory].present?
24
- inventory = Inventory::Sku.find_or_create_by(id: variant.sku)
24
+ inventory = Inventory::Sku.find_or_initialize_by(id: variant.sku)
25
25
  inventory.available = attributes[:inventory]
26
+ inventory.policy = 'standard' if inventory.new_record?
26
27
  inventory.save!
27
28
  end
28
29
  end
@@ -27,7 +27,7 @@ module Workarea
27
27
  self.current_order = nil
28
28
 
29
29
  flash[:success] = t('workarea.admin.users.flash_messages.stopped')
30
- redirect_to user_path(previous_user_id)
30
+ redirect_back_or(user_path(previous_user_id))
31
31
  end
32
32
  end
33
33
  end
@@ -42,7 +42,7 @@ module Workarea
42
42
  def storefront_view_model
43
43
  @storefront_view_model ||= Storefront::ProductViewModel.wrap(
44
44
  model,
45
- @options
45
+ options
46
46
  )
47
47
  end
48
48
 
@@ -93,16 +93,13 @@ module Workarea
93
93
  end
94
94
  end
95
95
 
96
- def options
97
- variants.reduce({}) do |memo, variant|
96
+ def variant_details
97
+ variants.each_with_object({}) do |variant, memo|
98
98
  variant.details.each do |name, value|
99
99
  memo[name] ||= []
100
- memo[name] << value
101
- memo[name].flatten!
100
+ memo[name] += Array.wrap(value)
102
101
  memo[name].uniq!
103
102
  end
104
-
105
- memo
106
103
  end
107
104
  end
108
105
 
@@ -125,7 +122,7 @@ module Workarea
125
122
  end
126
123
 
127
124
  def insights
128
- @insights ||= Insights::ProductViewModel.wrap(model, @options)
125
+ @insights ||= Insights::ProductViewModel.wrap(model, options)
129
126
  end
130
127
 
131
128
  def inventory
@@ -25,7 +25,7 @@
25
25
  .product-images__image-group
26
26
  .product-images__image
27
27
  .product-images__image-summary
28
- .product-images__image-summary-container= image_tag product_image_url(@image, :small), alt: "#{@image.option} #{t('workarea.admin.catalog_product_images.edit.image')}", id: @image.option.parameterize, class: 'product-images__image-summary-image'
28
+ .product-images__image-summary-container= image_tag product_image_url(@image, :small), alt: "#{@image.option} #{t('workarea.admin.catalog_product_images.edit.image')}", class: 'product-images__image-summary-image'
29
29
 
30
30
  .section
31
31
  %h2= t('workarea.admin.catalog_product_images.edit.edit_image')
@@ -110,7 +110,7 @@
110
110
  %p.align-center= t('workarea.admin.fields.inventory')
111
111
 
112
112
  %span.heading.heading--3.heading--no-margin.align-center
113
- = model.options.keys.to_sentence
113
+ = model.variant_details.keys.to_sentence
114
114
  %p.align-center= t('workarea.admin.fields.options')
115
115
 
116
116
  = link_to catalog_product_variants_path(model), class: 'card__button' do
@@ -63,11 +63,6 @@
63
63
  .property
64
64
  = text_field_tag 'new_details[]', nil, id: nil, class: 'text-box text-box--i18n', title: t('workarea.admin.catalog_variants.edit.options.new_attribute_value'), placeholder: t('workarea.admin.catalog_variants.edit.options.new_attribute_value_placeholder')
65
65
  %span.property__note= t('workarea.admin.catalog_variants.edit.options.new_attribute_value_note')
66
- %span.property__note
67
- = t('workarea.admin.catalog_variants.edit.options.new_attribute_value_csv')
68
- = link_to '#csv-help', data: { tooltip: '' } do
69
- = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.catalog_variants.edit.options.learn_more'))
70
- = render 'workarea/admin/shared/csv_formatting_tooltip'
71
66
  %td.align-center -
72
67
 
73
68
  .workflow-bar
@@ -55,11 +55,6 @@
55
55
  .property
56
56
  = text_field_tag 'new_details[]', nil, id: nil, class: 'text-box text-box--i18n', title: t('workarea.admin.catalog_variants.new.options.new_attribute_value'), placeholder: t('workarea.admin.catalog_variants.new.options.new_attribute_value_placeholder')
57
57
  %span.property__note= t('workarea.admin.catalog_variants.new.options.new_attribute_value_note')
58
- %span.property__note
59
- = t('workarea.admin.catalog_variants.new.options.new_attribute_value_csv')
60
- = link_to '#csv-help', data: { tooltip: '' } do
61
- = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.catalog_variants.new.options.learn_more'))
62
- = render 'workarea/admin/shared/csv_formatting_tooltip'
63
58
  %td.align-center -
64
59
 
65
60
  .workflow-bar
@@ -6,5 +6,5 @@
6
6
  #{local_time_ago(model.updated_at)}
7
7
  - else
8
8
  %span.summary__info-text-inactive= t('workarea.admin.navigation_menus.summary.inactive')
9
- %span.summary__info= t('workarea.admin.navigation_menus.summary.content_block', count: model.content.try(:blocks).size)
9
+ %span.summary__info= t('workarea.admin.navigation_menus.summary.content_block', count: model.content&.blocks&.size.to_i)
10
10
  %span.summary__type{ title: t('workarea.admin.navigation_menus.summary.type') }= t('workarea.admin.navigation_menus.summary.type')
@@ -5,7 +5,7 @@
5
5
  %span.discount__node
6
6
  %span.property.property--inline
7
7
  = text_field_tag 'discount[amount]', @discount.amount, class: 'text-box text-box--small', title: 'Amount of Discount', placeholder: '10', required: true
8
- %span.discount__node off products
8
+ %span.discount__node off the item's unit price
9
9
 
10
10
  .discount__node-line
11
11
  %p.discount__node-group
@@ -1,4 +1,4 @@
1
- .toggle-button{ data: data }
1
+ .toggle-button{ data: data, class: disabled ? 'toggle-button--disabled' : nil }
2
2
  .toggle-button__switch
3
3
  = radio_button_tag input_name, true, condition, disabled: disabled, class: 'toggle-button__input toggle-button__input--positive', title: title_true, id: "#{dom_id}_true"
4
4
  = label_tag "#{dom_id}_false", label_true, class: 'toggle-button__label toggle-button__label--positive', id: "#{dom_id}_false_label"
@@ -67,6 +67,7 @@
67
67
  = link_to current_impersonation.email, user_path(current_impersonation)
68
68
  %br
69
69
  = form_tag impersonations_path, method: 'delete', data: { disable_delete_confirmation: '' } do
70
+ = hidden_field_tag :return_to, return_to
70
71
  = button_tag t('workarea.admin.toolbar.stop_impersonation'), class: 'text-button text-button--destroy'
71
72
 
72
73
  - if allow_pricing_override?
@@ -485,7 +485,6 @@ en:
485
485
  new_attribute_name_note: 'Example: Material'
486
486
  new_attribute_name_placeholder: New Attribute Name
487
487
  new_attribute_value: New Attribute Value
488
- new_attribute_value_csv: 'Comma separated: just, like, this'
489
488
  new_attribute_value_note: 'Example: Cotton'
490
489
  new_attribute_value_placeholder: New Attribute Value
491
490
  remove: Remove
@@ -524,7 +523,6 @@ en:
524
523
  new_attribute_name_note: 'Example: Material'
525
524
  new_attribute_name_placeholder: New Attribute Name
526
525
  new_attribute_value: New Attribute Value
527
- new_attribute_value_csv: 'Comma separated: just, like, this'
528
526
  new_attribute_value_note: 'Example: Cotton'
529
527
  new_attribute_value_placeholder: New Attribute Value
530
528
  remove: Remove
@@ -3191,10 +3189,10 @@ en:
3191
3189
  description: Define what filters should be shown on search results and categories.
3192
3190
  title: Filters
3193
3191
  synonyms:
3194
- description: Define groups of search terms that should return the same result.
3192
+ description: Define groups of search terms that mean the same thing. Keep in mind this is not the same as "return the same results". For that task, use search customizations.
3195
3193
  phrase_example: united states,u s a,united states of america => usa
3196
3194
  phrase_example_description: 'You can create synonym functionality out of a phrase like so:'
3197
- simple_example: "tshirt, t-shirt, tee-shirt \nskirt, skort"
3195
+ simple_example: "denim, jeans, dungarees \nshirt, pullover, blouse"
3198
3196
  simple_example_description: 'Enter one synonym group per line, for example:'
3199
3197
  title: Synonyms
3200
3198
  title: Search Settings
@@ -3514,7 +3512,7 @@ en:
3514
3512
  changes_saved: Your changes have been saved
3515
3513
  saved: Your changes have been saved
3516
3514
  started: You are now browsing as %{email}
3517
- stopped: Impersonation for this user has been stopped.
3515
+ stopped: Impersonation has been stopped, you are now browsing as your account.
3518
3516
  created: This account has been created
3519
3517
  error: There was an error saving this account
3520
3518
  index:
@@ -70,7 +70,14 @@ module Workarea
70
70
  post admin.impersonations_path, params: { user_id: @user.id }
71
71
  delete admin.impersonations_path
72
72
 
73
- assert(response.redirect?)
73
+ assert_redirected_to(admin.user_path(@user.id))
74
+ assert_equal(previous_user_id, response_cookies['user_id'])
75
+ assert(session['admin_id'].blank?)
76
+
77
+ post admin.impersonations_path, params: { user_id: @user.id }
78
+ delete admin.impersonations_path(return_to: '/foo')
79
+
80
+ assert_redirected_to('/foo')
74
81
  assert_equal(previous_user_id, response_cookies['user_id'])
75
82
  assert(session['admin_id'].blank?)
76
83
  end
@@ -0,0 +1,10 @@
1
+ .new-navigation-link__section{ data: { new_navigation_taxon: 'bar' } }
2
+ %fieldset
3
+ %legend
4
+ %span.heading.heading--2 Existing
5
+ .property
6
+ = label_tag 'navigable_type', 'Type', class: 'property__name'
7
+ = select_tag 'navigable_type', options_for_select([['Foo', 'foo', { data: { new_navigation_taxon_endpoint: 'http://foo.com' } }], ['Bar', 'bar', { data: { new_navigation_taxon_endpoint: 'http://bar.com' } }]])
8
+ .property
9
+ = label_tag 'navigable_id', 'Name', class: 'property__name'
10
+ = select_tag 'navigable_id', options_for_select([['Bar', 'bar']], 'bar'), include_blank: true
@@ -6,7 +6,6 @@
6
6
  it('initializes select2 on navigable id select', function () {
7
7
  var markup = 'new_navigation_taxon.html',
8
8
  $fixture = $(fixture.load(markup, true)),
9
-
10
9
  $select = $('[name=navigable_id]', $fixture);
11
10
 
12
11
  expect($select.is('.select2-hidden-accessible')).to.not.be.ok;
@@ -14,6 +13,18 @@
14
13
  WORKAREA.newNavigationTaxons.init($fixture);
15
14
 
16
15
  expect($select.is('.select2-hidden-accessible')).to.be.ok;
16
+ expect($select.val()).to.equal('');
17
+ });
18
+
19
+ it('saves with the existing data', function () {
20
+ var markup = 'existing_navigation_taxon.html',
21
+ $fixture = $(fixture.load(markup, true)),
22
+ $select = $('[name=navigable_id]', $fixture);
23
+
24
+ WORKAREA.newNavigationTaxons.init($fixture);
25
+
26
+ expect($select.is('.select2-hidden-accessible')).to.be.ok;
27
+ expect($select.val()).to.equal('bar');
17
28
  });
18
29
  });
19
30
  });
@@ -34,12 +34,9 @@ module Workarea
34
34
  click_button 'Stop Impersonation'
35
35
  end
36
36
 
37
- assert_equal(admin.user_path(user), current_path)
37
+ assert_equal(storefront.root_path, current_path)
38
38
  assert(page.has_content?('Success'))
39
39
 
40
- find('.view').hover # Ensure tooltipster menu isn't open
41
- assert(page.has_content?('bcrouse@workarea.com'))
42
-
43
40
  visit storefront.users_account_path
44
41
  assert(page.has_no_content?('impersonated@workarea.com'))
45
42
 
@@ -23,7 +23,7 @@ module Workarea
23
23
  end
24
24
  end
25
25
 
26
- def test_options
26
+ def test_variant_details
27
27
  @view_model.variants.build(
28
28
  sku: 'SKU1',
29
29
  name: 'name',
@@ -42,7 +42,7 @@ module Workarea
42
42
 
43
43
  assert_equal(
44
44
  { 'Color' => ['Red', 'Black', 'White'], 'Size' => ['S', 'M', 'L'] },
45
- @view_model.options
45
+ @view_model.variant_details
46
46
  )
47
47
  end
48
48
 
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.37
4
+ version: 3.4.42
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-07-22 00:00:00.000000000 Z
11
+ date: 2020-10-14 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.37
19
+ version: 3.4.42
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.37
26
+ version: 3.4.42
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.37
33
+ version: 3.4.42
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.37
40
+ version: 3.4.42
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email:
@@ -1270,6 +1270,7 @@ files:
1270
1270
  - test/javascripts/fixtures/datepicker_fields.html.haml
1271
1271
  - test/javascripts/fixtures/datetimepicker_fields.html.haml
1272
1272
  - test/javascripts/fixtures/direct_upload.html.haml
1273
+ - test/javascripts/fixtures/existing_navigation_taxon.html.haml
1273
1274
  - test/javascripts/fixtures/help_lookup_button.haml
1274
1275
  - test/javascripts/fixtures/menu_editor_menu_list_sortable.html.haml
1275
1276
  - test/javascripts/fixtures/new_navigation_taxon.html.haml