workarea-admin 3.5.11 → 3.5.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/jquery_ujs/insert.js +30 -0
  3. data/app/assets/javascripts/workarea/admin/application.js.erb +1 -0
  4. data/app/assets/javascripts/workarea/admin/modules/release_calendar_placeholders.js +1 -21
  5. data/app/controllers/workarea/admin/releases_controller.rb +0 -10
  6. data/app/view_models/workarea/admin/code_list_view_model.rb +1 -1
  7. data/app/view_models/workarea/admin/variant_view_model.rb +4 -0
  8. data/app/views/workarea/admin/catalog_products/content.html.haml +2 -0
  9. data/app/views/workarea/admin/catalog_products/edit.html.haml +4 -0
  10. data/app/views/workarea/admin/catalog_variants/edit.html.haml +2 -0
  11. data/app/views/workarea/admin/catalog_variants/index.html.haml +1 -1
  12. data/app/views/workarea/admin/catalog_variants/new.html.haml +2 -0
  13. data/app/views/workarea/admin/content/_edit.html.haml +1 -1
  14. data/app/views/workarea/admin/create_segments/setup.html.haml +2 -0
  15. data/app/views/workarea/admin/create_users/admin.html.haml +2 -0
  16. data/app/views/workarea/admin/facets/_applied.html.haml +1 -1
  17. data/app/views/workarea/admin/fulfillment_skus/edit.html.haml +3 -1
  18. data/app/views/workarea/admin/fulfillment_skus/new.html.haml +3 -1
  19. data/app/views/workarea/admin/inventory_skus/edit.html.haml +5 -1
  20. data/app/views/workarea/admin/inventory_skus/new.html.haml +3 -1
  21. data/app/views/workarea/admin/pricing_discount_code_lists/_cards.html.haml +1 -1
  22. data/app/views/workarea/admin/pricing_discount_code_lists/promo_codes.html.haml +1 -1
  23. data/app/views/workarea/admin/releases/show.html.haml +5 -1
  24. data/config/locales/en.yml +3 -1
  25. data/test/view_models/workarea/admin/code_list_view_model_test.rb +5 -0
  26. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8de6779953d29152d1a845ad3a339f15273bf641763118993e3b7440eaba74db
4
- data.tar.gz: 135e70f5f6573034c69de103a380d2c60c39ecfd2cb13d6ce1f82366d73326be
3
+ metadata.gz: 012d96e0ce66ade5a23b5294d490d9b5ea32a67462fc6f44a3e42ba1fbb70ca9
4
+ data.tar.gz: 495c4c9286915ccca98b591901675816d7dd81a8f570892f5bdbd5b7d59cf58b
5
5
  SHA512:
6
- metadata.gz: 85915842911642059a94e46fd17aec587b96a6d4d0a164f89f9fbcd679f97484334bb1c9e89638e3881a93800059ef5fe17f8800b34bde3be817da7384e04a16
7
- data.tar.gz: 06d255400491919a5a60c05bb28c66210e823732bdcf5ed49daf8c82953263370cccf7aae5dabde6c473134883c3250e958135ca29b714cf32e1cbf25cc7f45f
6
+ metadata.gz: e904cece312118b2b3dda842061f489030812d4a1fe1e1d1294a6b7267d175d25e6880727cc782784f7c07961746dda013244b2f059d2f99d323f6d55e08bd57
7
+ data.tar.gz: 779a0262c951d51efcd7d132c1944bbc0cd14a177ee9a762931e934bc8ff59108bfc81e27bde267469c24acb0e4410720bfd98c88d127a7806839f69dfbbbdea
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Add data-insert to an element. When that element is also data-remote, the
3
+ * server's response will be appended into the element matching the value of
4
+ * the data-insert attribute. (with WORKAREA modules initialized). If that
5
+ * element is also insert-before or insert-after, the response will instead
6
+ * be inserted before or after, respectively, the matching element.
7
+ */
8
+
9
+ $(document).on('ajax:success', function (event, response) {
10
+ var $element = $(event.target),
11
+ targetSelector = $element.data('insert'),
12
+ $target,
13
+ $content;
14
+
15
+ if (! $element.is('[data-insert]')) { return; }
16
+ if (_.isEmpty(targetSelector)) { return; }
17
+
18
+ $target = $(targetSelector);
19
+ $content = $(response);
20
+
21
+ if ($element.is('[data-insert-after]')) {
22
+ $content.insertAfter($target);
23
+ } else if ($element.is('[data-insert-before]')) {
24
+ $content.insertBefore($target);
25
+ } else {
26
+ $target.append($content);
27
+ }
28
+
29
+ WORKAREA.initModules($content);
30
+ });
@@ -14,6 +14,7 @@ window.feature.testAll();
14
14
  jquery3
15
15
  jquery_ujs
16
16
  jquery_ujs/replace
17
+ jquery_ujs/insert
17
18
  jquery-ui/core
18
19
  jquery-ui/widget
19
20
  jquery-ui/position
@@ -15,17 +15,6 @@ WORKAREA.registerModule('releaseCalendarPlaceholders', (function () {
15
15
  WORKAREA.initModules($calendar);
16
16
  },
17
17
 
18
- now = new Date(),
19
-
20
- standardTimezoneOffset = function() {
21
- var jan = new Date(now.getFullYear(), 0, 1).getTimezoneOffset(),
22
- jul = new Date(now.getFullYear(), 6, 1).getTimezoneOffset();
23
-
24
- return Math.max(jan, jul);
25
- },
26
-
27
- isDSTObserved = now.getTimezoneOffset() < standardTimezoneOffset(),
28
-
29
18
  /**
30
19
  * Makes the AJAX request for a new calendar based on a supplied time.
31
20
  * When the promise resolves the supplied placeholder element is
@@ -40,16 +29,7 @@ WORKAREA.registerModule('releaseCalendarPlaceholders', (function () {
40
29
  * @param {string} endpoint - the endpoint for the AJAX request
41
30
  */
42
31
  requestCalendar = function (startDate, placeholder, endpoint) {
43
- var timeOffset = parseInt(strftime('%z', new Date()));
44
-
45
- if (isDSTObserved) {
46
- timeOffset = timeOffset - 100;
47
- }
48
-
49
- $.get(endpoint, {
50
- start_date: startDate,
51
- time_offset: timeOffset
52
- })
32
+ $.get(endpoint, { start_date: startDate })
53
33
  .done(_.partial(displayCalendar, placeholder))
54
34
  .fail(
55
35
  _.partial(
@@ -9,7 +9,6 @@ module Workarea
9
9
  before_action :find_calendar, only: [:index, :update]
10
10
  before_action :authenticate_user_by_token, only: :calendar_feed
11
11
  skip_before_action :require_login, :require_admin, only: :calendar_feed
12
- around_action :set_time_zone, only: :index
13
12
 
14
13
  def index
15
14
  end
@@ -71,15 +70,6 @@ module Workarea
71
70
 
72
71
  private
73
72
 
74
- def set_time_zone
75
- old_time_zone = Time.zone
76
- time_offset = params[:time_offset].to_i / 100
77
- Time.zone = time_offset.hours unless params[:time_offset].blank?
78
- yield
79
- ensure
80
- Time.zone = old_time_zone
81
- end
82
-
83
73
  def find_release
84
74
  model = if params[:id].present?
85
75
  Release.find(params[:id])
@@ -10,7 +10,7 @@ module Workarea
10
10
  end
11
11
 
12
12
  def used_count
13
- model.count - unused_promo_codes.count
13
+ model.promo_codes.count - unused_promo_codes.count
14
14
  end
15
15
 
16
16
  def last_used_at
@@ -15,6 +15,10 @@ module Workarea
15
15
  inventory.available
16
16
  end
17
17
 
18
+ def available_to_sell_inventory
19
+ inventory.available_to_sell
20
+ end
21
+
18
22
  def fulfillment
19
23
  @fulfillment ||= Fulfillment::Sku.find_or_create_by(id: sku)
20
24
  end
@@ -34,6 +34,8 @@
34
34
  = label_tag "product[meta_description]", t('workarea.admin.fields.meta_description'), class: 'property__name'
35
35
  = text_field_tag 'product[meta_description]', @product.meta_description, class: 'text-box text-box--i18n', id: "product_meta_description"
36
36
 
37
+ = append_partials('admin.product_content_fields', product: @product)
38
+
37
39
  .workflow-bar
38
40
  .grid.grid--auto.grid--right.grid--middle
39
41
  .grid__cell= render 'workarea/admin/shared/publishing_select'
@@ -110,6 +110,8 @@
110
110
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.catalog_products.edit.details.learn_more'))
111
111
  %td.align-center -
112
112
 
113
+ = append_partials('admin.additional_product_details_information', product: @product)
114
+
113
115
  .section
114
116
 
115
117
  %h2= t('workarea.admin.catalog_products.edit.filters.label')
@@ -147,6 +149,8 @@
147
149
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.catalog_products.edit.filters.learn_more'))
148
150
  %td.align-center -
149
151
 
152
+ = append_partials('admin.additional_product_filters_information', product: @product)
153
+
150
154
  .grid.grid--huge
151
155
  .grid__cell.grid__cell--50.grid__cell--25-at-medium
152
156
  .property
@@ -70,6 +70,8 @@
70
70
  = render 'workarea/admin/shared/csv_formatting_tooltip'
71
71
  %td.align-center -
72
72
 
73
+ = append_partials('admin.additional_variant_information_fields', variant: @variant)
74
+
73
75
  .workflow-bar
74
76
  .grid.grid--auto.grid--right.grid--middle
75
77
  .grid__cell= render 'workarea/admin/shared/publishing_select'
@@ -45,7 +45,7 @@
45
45
  %td= link_to variant.fulfillment_policy, fulfillment_sku_path(variant.sku)
46
46
  %td.align-center
47
47
  = link_to inventory_sku_path(variant.sku) do
48
- = variant.available_inventory
48
+ = variant.available_to_sell_inventory
49
49
  %td.align-right
50
50
  = link_to pricing_sku_path(variant.sku) do
51
51
  = number_to_currency variant.pricing.sell_price
@@ -62,6 +62,8 @@
62
62
  = render 'workarea/admin/shared/csv_formatting_tooltip'
63
63
  %td.align-center -
64
64
 
65
+ = append_partials('admin.additional_variant_information_fields', variant: @variant)
66
+
65
67
  .workflow-bar
66
68
  .grid.grid--auto.grid--right.grid--middle
67
69
  .grid__cell= render 'workarea/admin/shared/activate_select', name: 'variant[activate_with]'
@@ -7,7 +7,7 @@
7
7
  .grid.grid--middle
8
8
  .grid__cell.grid__cell--50
9
9
  - if content.show_areas?
10
- %span= content.name
10
+ %span #{t('workarea.admin.content.edit.current_area')}:
11
11
  = inline_svg('workarea/admin/icons/navigate_next.svg', class: 'svg-icon svg-icon--small svg-icon--white')
12
12
  = form_tag request.path, method: 'get', class: 'content-editor__area-select-form' do
13
13
  = select_tag 'area_id', options_for_select(content.area_options, content.current_area), data: { form_submitting_control: '' }
@@ -10,6 +10,8 @@
10
10
  = render_message 'error', message
11
11
 
12
12
  = form_tag create_segments_path, method: 'post' do
13
+ = hidden_field_tag :id, @segment.id unless @segment.new_record?
14
+
13
15
  .section
14
16
  .property.property--required
15
17
  = label_tag 'segment_name', t('workarea.admin.fields.name'), class: 'property__name'
@@ -140,6 +140,8 @@
140
140
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon')
141
141
  %span= t('workarea.admin.users.permissions.help')
142
142
 
143
+ = append_partials('admin.user_permissions')
144
+
143
145
  .workflow-bar
144
146
  .grid.grid--middle
145
147
  .grid__cell.grid__cell--20
@@ -10,7 +10,7 @@
10
10
  - @search.facet_selections.each do |facet, values|
11
11
  - values.each do |value|
12
12
  %li.browsing-controls__applied-filter
13
- %span= value.titleize
13
+ %span= facet_value_display_name(facet, value)
14
14
  = link_to facet_path(facet, value), class: 'browsing-controls__applied-remove-link' do
15
15
  = inline_svg('workarea/admin/icons/close.svg', class: 'browsing-controls__applied-icon svg-icon svg-icon--small svg-icon--black', title: t('workarea.admin.facets.applied.remove_filter'))
16
16
 
@@ -31,7 +31,9 @@
31
31
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.fields.policy'))
32
32
 
33
33
  #policy-info.tooltip-content
34
- %p= t('workarea.admin.fulfillment_skus.edit.policy_info_html')
34
+ %p
35
+ = t('workarea.admin.fulfillment_skus.edit.policy_info_html')
36
+ = append_partials('admin.fulfillment_sku_policy_info')
35
37
  = select_tag 'sku[policy]', options_for_select(fulfillment_policies, @sku.policy.optionize)
36
38
 
37
39
  .property
@@ -29,7 +29,9 @@
29
29
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.fields.policy'))
30
30
 
31
31
  #policy-info.tooltip-content
32
- %p= t('workarea.admin.fulfillment_skus.edit.policy_info_html')
32
+ %p
33
+ = t('workarea.admin.fulfillment_skus.edit.policy_info_html')
34
+ = append_partials('admin.fulfillment_sku_policy_info')
33
35
  = select_tag 'sku[policy]', options_for_select(fulfillment_policies, @sku.policy.optionize)
34
36
 
35
37
  .property
@@ -32,7 +32,9 @@
32
32
  = link_to '#tracking-policy-info', data: { tooltip: '' } do
33
33
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.inventory_skus.edit.tracking_policy'))
34
34
  #tracking-policy-info.tooltip-content
35
- %p= t('workarea.admin.inventory_skus.edit.tracking_policy_info_html')
35
+ %p
36
+ = t('workarea.admin.inventory_skus.edit.tracking_policy_info_html')
37
+ = append_partials('admin.inventory_sku_policy_info')
36
38
  = select_tag 'sku[policy]', options_for_select(inventory_policies, @sku.policy.optionize)
37
39
 
38
40
  .grid.grid--huge
@@ -56,6 +58,8 @@
56
58
  = label_tag 'sku[backordered_until]', t('workarea.admin.inventory_skus.edit.backordered_ship_date'), class: 'property__name'
57
59
  = datetime_picker_tag 'sku[backordered_until]', @sku.backordered_until.try(:to_s, :date_only), class: 'text-box text-box--medium', data: { datepicker_field: { } }
58
60
 
61
+ = append_partials('admin.inventory_sku_fields', sku: @sku)
62
+
59
63
  .grid.grid--huge
60
64
  .grid__cell.grid__cell--50.grid__cell--25-at-medium
61
65
  .property
@@ -28,7 +28,9 @@
28
28
  = link_to '#tracking-policy-info', data: { tooltip: '' } do
29
29
  = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue', title: t('workarea.admin.inventory_skus.edit.tracking_policy'))
30
30
  #tracking-policy-info.tooltip-content
31
- %p= t('workarea.admin.inventory_skus.edit.tracking_policy_info_html')
31
+ %p
32
+ = t('workarea.admin.inventory_skus.edit.tracking_policy_info_html')
33
+ = append_partials('admin.inventory_sku_policy_info')
32
34
  = select_tag 'sku[policy]', options_for_select(inventory_policies, @sku.policy.optionize)
33
35
 
34
36
  .property
@@ -45,7 +45,7 @@
45
45
  .grid
46
46
  .grid__cell.grid__cell--50
47
47
  .align-center
48
- %h2.heading.heading--no-margin= model.count
48
+ %h2.heading.heading--no-margin= model.promo_codes.count
49
49
  %p #{t('workarea.admin.pricing_discount_code_lists.cards.promo_codes.total')}
50
50
  .grid__cell.grid__cell--50
51
51
  .align-center
@@ -17,7 +17,7 @@
17
17
 
18
18
  .view__container.view__container--narrow
19
19
  = render_cards_for(@code_list, :promo_codes)
20
- %p.align-center= t('workarea.admin.pricing_discount_code_lists.promo_code', count: @code_list.count)
20
+ %p.align-center= t('workarea.admin.pricing_discount_code_lists.promo_code', count: @code_list.promo_codes.count)
21
21
 
22
22
  %table
23
23
  %thead
@@ -32,7 +32,11 @@
32
32
 
33
33
  - else
34
34
  .grid__cell
35
- - if current_release.try(:id) == @release.id
35
+ - if @release.published? && !@release.scheduled?
36
+ = link_to t('workarea.admin.releases.show.visit_storefront_to_preview'), '#cannot-preview-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button workflow-bar__button--update'
37
+ #cannot-preview-info.tooltip-content
38
+ %p= t('workarea.admin.releases.show.unscheduled_republish_preview_info')
39
+ - elsif current_release.try(:id) == @release.id
36
40
  = link_to t('workarea.admin.releases.show.visit_storefront_to_preview'), storefront.root_path, class: 'workflow-bar__button workflow-bar__button--update'
37
41
  - else
38
42
  = form_tag release_session_path, method: :post do
@@ -703,6 +703,7 @@ en:
703
703
  loading: Loading...
704
704
  preview: Preview
705
705
  title: Content for %{content}
706
+ current_area: 'Current Area'
706
707
  form:
707
708
  all_blocks: All blocks
708
709
  cancel: Cancel
@@ -1863,7 +1864,7 @@ en:
1863
1864
  policy: 'Policy:'
1864
1865
  file: 'File:'
1865
1866
  edit:
1866
- policy_info_html: "<p><strong>Ship:</strong> Item requires shipping. System does nothing automatically for this SKU.</p> <p><strong>Ignore:</strong> Item does not require shipping. System does nothing automatically for this SKU.</p> <p><strong>Download:</strong> Generates a unique URL token that grants the customer access to attached file through a download link in the order summary.</p>"
1867
+ policy_info_html: "<p><strong>Shipping:</strong> Item requires shipping. System does nothing automatically for this SKU.</p><p><strong>Download:</strong> Generates a unique URL token that grants the customer access to attached file through a download link in the order summary.</p>"
1867
1868
  page_title: Edit Fulfillment SKU %{sku}
1868
1869
  save_sku: Save SKU
1869
1870
  flash_messages:
@@ -3189,6 +3190,7 @@ en:
3189
3190
  start_preview_in_storefront: Start preview in storefront
3190
3191
  undo: Undo
3191
3192
  visit_storefront_to_preview: Preview
3193
+ unscheduled_republish_preview_info: This release is already published, you'll need to schedule it again to preview its changes.
3192
3194
  no_changes_to_preview: There are no changes to preview. Click on the Plan Changes card to start!
3193
3195
  no_changes_to_publish: There are no changes to publish for this release. Click on the Plan Changes card to start!
3194
3196
  no_changes_to_undo: There are no changes to undo for this release. Click on the Plan Changes card to start!
@@ -21,6 +21,11 @@ module Workarea
21
21
 
22
22
  view_model = CodeListViewModel.wrap(code_list)
23
23
  assert_equal(1, view_model.used_count)
24
+
25
+ code_list.promo_codes.create!(code: "#{code_list.prefix}123")
26
+
27
+ view_model = CodeListViewModel.wrap(code_list)
28
+ assert_equal(1, view_model.used_count)
24
29
  end
25
30
 
26
31
  def test_last_used_at
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.11
4
+ version: 3.5.16
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-05-13 00:00:00.000000000 Z
11
+ date: 2020-07-22 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.11
19
+ version: 3.5.16
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.11
26
+ version: 3.5.16
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.11
33
+ version: 3.5.16
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.11
40
+ version: 3.5.16
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email:
@@ -175,6 +175,7 @@ files:
175
175
  - app/assets/images/workarea/admin/selected.svg
176
176
  - app/assets/images/workarea/admin/valid.svg
177
177
  - app/assets/javascripts/jquery_ui/admin/categorized_autocomplete.js
178
+ - app/assets/javascripts/jquery_ujs/insert.js
178
179
  - app/assets/javascripts/jquery_ujs/replace.js
179
180
  - app/assets/javascripts/workarea/admin/application.js.erb
180
181
  - app/assets/javascripts/workarea/admin/config.js.erb