workarea-admin 3.4.21 → 3.4.22

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: 8eaf9d9ae8fc24cd0abfe8bd0cc1370c93d64e8e323c3108d7263c05f73559f7
4
- data.tar.gz: cffc4dc0fcb75d3808ca0b2e19c1e99ffba229cacc2e6e4b02caa87a7f3d0512
3
+ metadata.gz: b32e6145f8e516f84b24cea472151ef5821625ad0bb9b58b63d190b38cadd82b
4
+ data.tar.gz: 10600313f90bff7a68beeb48f734e050e8d97de0d8b8a11d6a2b5dbed7b441aa
5
5
  SHA512:
6
- metadata.gz: 430625b82db3973e9d4e3f031a3a8ccf69247b54c0182f272e63babebf6dbd644614cdce1cb4229ec687395f774017823eae9c38710cc52a1d2107545a44695c
7
- data.tar.gz: 9776eed1419df56f641ef9cec71f36469d2de8b5dbf7c0b2fad572891131803ec7d7513057d483b37f16e0fa5417a09257e4295b2a1e833824d20fcc2c1ae1dd
6
+ metadata.gz: 6dfc32ad70d7d4f0171d9afda5ca88ff69b263939fb6f730c8615be88b462c929d88fdbcf4429cdc894ad5f136fb642b3b5a46d7b1f1d563410b6ad28ace69ae
7
+ data.tar.gz: cb490aad1714c7c2679ace4c67657d9ac2665a9bce53f4c9e42b9035070f8c3d5155b7a88a7093f73429ff0e214428ea4a1c671af19f260d8af3a6105f322c40
@@ -7,9 +7,7 @@ module Workarea
7
7
  after_action :track_index_filters, only: :index
8
8
 
9
9
  def index
10
- if Configuration::S3.configured? && !request.xhr?
11
- DirectUpload.ensure_cors!(request.url)
12
- end
10
+ DirectUpload.ensure_cors!(request.url) if Configuration::S3.configured?
13
11
 
14
12
  search = Search::AdminAssets.new(params)
15
13
  @search = Admin::SearchViewModel.new(search, view_model_options)
@@ -8,7 +8,7 @@ module Workarea
8
8
 
9
9
  def sample
10
10
  filename = "#{@import.name.downcase.underscore}.#{@import.file_type}"
11
- send_data @import.sample_file_content, filename: filename, type: @import.file_type
11
+ send_data @import.sample_file_content, filename: filename, type: @import.mime_type, disposition: :attachment
12
12
  end
13
13
 
14
14
  def create
@@ -156,6 +156,16 @@ module Workarea
156
156
  new_query_string_params = request.query_parameters.merge(page: page)
157
157
  "#{request.path}?#{new_query_string_params.to_query}"
158
158
  end
159
+
160
+ def duration_in_words(duration)
161
+ parts = duration.parts
162
+ return t('workarea.duration.seconds', count: 0) if parts.empty?
163
+
164
+ parts
165
+ .sort_by { |unit, _ | ActiveSupport::Duration::PARTS.index(unit) }
166
+ .map { |unit, val| t("workarea.duration.#{unit}", count: val) }
167
+ .to_sentence
168
+ end
159
169
  end
160
170
  end
161
171
  end
@@ -33,7 +33,7 @@
33
33
  - Workarea.config.data_file_formats.each do |file_type|
34
34
  = link_to_unless @import.file_type.to_s == file_type.to_s, file_type.upcase, url_for(import: { model_type: @import.model_type, file_type: file_type }), data: { turbolinks: false }
35
35
  %br
36
- = link_to t('workarea.admin.data_file_imports.new.download_sample'), url_for(params.merge(action: 'sample')) if @import.samples.present?
36
+ = link_to t('workarea.admin.data_file_imports.new.download_sample'), url_for(params.merge(action: 'sample', format: @import.file_type)) if @import.samples.present?
37
37
 
38
38
  - if @import.samples.blank?
39
39
  %p.align-center= t('workarea.admin.data_file_imports.new.no_samples')
@@ -30,11 +30,22 @@
30
30
  = text_field_tag 'discount[tag_list]', @discount.tag_list, class: 'text-box'
31
31
  %span.property__note= t('workarea.admin.form.csv_field_note')
32
32
 
33
- .property
34
- %span.property__name
35
- = t('workarea.admin.fields.active')
36
- = inline_svg('workarea/admin/i18n.svg', class: 'svg-icon svg-icon--small') if locale_options.many? && Workarea.config.localized_active_fields
37
- = toggle_button_for 'discount[active]', @discount.active?
33
+ .grid
34
+ .grid__cell.grid__cell--50.grid__cell--25-at-medium
35
+ .property
36
+ %span.property__name
37
+ = t('workarea.admin.fields.active')
38
+ = inline_svg('workarea/admin/i18n.svg', class: 'svg-icon svg-icon--small') if locale_options.many? && Workarea.config.localized_active_fields
39
+ = toggle_button_for 'discount[active]', @discount.active?
40
+ .grid__cell.grid__cell--50.grid__cell--25-at-medium
41
+ .property
42
+ %span.property__name
43
+ = t('workarea.admin.fields.auto_deactivate')
44
+ = link_to '#auto-deactivate-info', data: { tooltip: '' } do
45
+ = inline_svg('workarea/admin/icons/help.svg', class: 'svg-icon svg-icon--small svg-icon--blue')
46
+ = toggle_button_for 'discount[auto_deactivate]', @discount.auto_deactivate?
47
+
48
+ #auto-deactivate-info.tooltip-content= t('workarea.admin.pricing_discounts.edit.auto_deactivate_info', duration: duration_in_words(Workarea.config.discount_staleness_ttl))
38
49
 
39
50
  .grid
40
51
  .grid__cell.grid__cell--33.grid__cell--25-at-medium
@@ -1502,6 +1502,7 @@ en:
1502
1502
  allow_sale_items: Allow Sale Items
1503
1503
  allow_sale_items: Allow Sale Items
1504
1504
  amount: Amount
1505
+ auto_deactivate: Auto Deactivate
1505
1506
  automate_metadata: Automate Metadata
1506
1507
  available: Available Units
1507
1508
  avatar: Avatar
@@ -2661,6 +2662,7 @@ en:
2661
2662
  list_help: You can allow more than one user tag for this discount by separating them with commas, e.g. vip, employee.
2662
2663
  edit:
2663
2664
  page_title: Attributes for %{name}
2665
+ auto_deactivate_info: A discount that can be auto-deactivated will becomes inactive automatically if it has not been updated or redeemed in the last %{duration}.
2664
2666
  flash_messages:
2665
2667
  removed: These changes have been removed
2666
2668
  saved: Your changes have been saved
@@ -78,6 +78,22 @@ module Workarea
78
78
  result = pagination_path_for(page: 2)
79
79
  assert_equal('/foo?asdf=blah&page=2', result)
80
80
  end
81
+
82
+ def test_duration_in_words
83
+ assert_equal(
84
+ t('workarea.duration.days', count: 2),
85
+ duration_in_words(2.days)
86
+ )
87
+
88
+ assert_equal(
89
+ [
90
+ t('workarea.duration.years', count: 1),
91
+ t('workarea.duration.months', count: 2),
92
+ t('workarea.duration.days', count: 12),
93
+ ].to_sentence,
94
+ duration_in_words(2.months + 1.years + 12.days)
95
+ )
96
+ end
81
97
  end
82
98
  end
83
99
  end
@@ -6,13 +6,15 @@ module Workarea
6
6
  include Admin::IntegrationTest
7
7
 
8
8
  def test_ensures_cors_policy_for_bulk_upload
9
- DirectUpload.expects(:ensure_cors!).once
9
+ Workarea.s3.expects(:put_bucket_cors).once
10
10
  get admin.content_assets_path
11
11
  assert(response.ok?)
12
12
 
13
- DirectUpload.expects(:ensure_cors!).never
14
13
  get admin.content_assets_path, xhr: true
15
14
  assert(response.ok?)
15
+
16
+ get admin.content_assets_path
17
+ assert(response.ok?)
16
18
  end
17
19
 
18
20
  def test_can_create_an_asset
@@ -79,6 +79,14 @@ module Workarea
79
79
 
80
80
  file = create_tempfile(response.body, extension: file_type)
81
81
  assert(IO.read(file.path).present?)
82
+ assert_equal(
83
+ "#{MIME::Types.type_for(file_type).first.to_s}; charset=utf-8",
84
+ response.headers['Content-Type']
85
+ )
86
+ assert_equal(
87
+ %(attachment; filename="catalog product.#{file_type}"),
88
+ response.headers['Content-Disposition']
89
+ )
82
90
 
83
91
  assert_no_changes 'Catalog::Product.first' do
84
92
  post admin.data_file_imports_path,
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.21
4
+ version: 3.4.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-12 00:00:00.000000000 Z
11
+ date: 2019-11-26 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.21
19
+ version: 3.4.22
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.21
26
+ version: 3.4.22
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.21
33
+ version: 3.4.22
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.21
40
+ version: 3.4.22
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email: