workarea-admin 3.4.18 → 3.4.19

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: 14d73797f080c9e96f5b59dde83886636b155ab7f7022a378b161eb01c2d3670
4
- data.tar.gz: 95987b4b59852ae6feea6d2e349b48174d6f166d41cbb8297bc00ae1110388dc
3
+ metadata.gz: 2c08425b237953579d29e22a8fbc38b70bedbf3347d293ec3912ed9b6c388800
4
+ data.tar.gz: 86b06b877c1b0816c15be5df0ea499a6d7abcb3dbce2d0c89f5761c8c147aa5a
5
5
  SHA512:
6
- metadata.gz: 7b4143771ef560953b1b63ef9dcc3aef3aa8e9f3067f7e4567a9fcfdd5d21fa77d7e375c17133e5e7197e90cf2c27515445e52924e40ae05b0608c53f04b6ccf
7
- data.tar.gz: 6a71949b108e7a1fe3a679ff33ba809cede0524b082da5e4a69045a606a607946a099b592281469a79bab1710a246a5b0d2521e7b0c872872d1811a92422f2e5
6
+ metadata.gz: cc92a2c5fe37b7620d3f6438349038e5749e838175d18031efc4c0a1e023b77b611f00682a7f2219432d0cd00ca5324b65fe435ec36b14679e66d738f709aa5b
7
+ data.tar.gz: 1e7f31d4a2a7f60a9f1c74e746ac67c7eb1b6ce268aa52d99a378ec841ebc732e8679eda22b194af6c46332df10dc4844f09ea6b6ebc3abeade722aa8961b19e
@@ -9,7 +9,10 @@ module Workarea
9
9
 
10
10
  def index
11
11
  search = Search::AdminCategories.new(
12
- params.merge(autocomplete: request.xhr?)
12
+ params.merge(
13
+ autocomplete: request.xhr?,
14
+ exclude_ids: exclude_ids
15
+ )
13
16
  )
14
17
 
15
18
  @search = SearchViewModel.new(search, view_model_options)
@@ -44,6 +47,14 @@ module Workarea
44
47
 
45
48
  private
46
49
 
50
+ def exclude_ids
51
+ if params[:exclude_ids].blank?
52
+ []
53
+ else
54
+ Catalog::Category.in(id: params[:exclude_ids]).map { |c| Search::Admin.for(c).id }
55
+ end
56
+ end
57
+
47
58
  def find_category
48
59
  if params[:id].present?
49
60
  @category = Catalog::Category.find_by(slug: params[:id])
@@ -3,7 +3,15 @@ module Workarea
3
3
  class TimelineViewModel < ApplicationViewModel
4
4
  def upcoming_changesets
5
5
  @upcoming_changesets ||= ChangesetViewModel.wrap(
6
- model_changesets + content_changesets
6
+ (model_changesets + content_changesets)
7
+ .sort { |c| c.release.publish_at }
8
+ .reverse
9
+ )
10
+ end
11
+
12
+ def unscheduled_changesets
13
+ @unscheduled_changesets ||= ChangesetViewModel.wrap(
14
+ unscheduled_model_changesets + unscheduled_content_changesets
7
15
  )
8
16
  end
9
17
 
@@ -40,6 +48,12 @@ module Workarea
40
48
  .any_in(release_id: upcoming_releases.map(&:id))
41
49
  end
42
50
 
51
+ def unscheduled_model_changesets
52
+ Release::Changeset
53
+ .by_document_path(model)
54
+ .any_in(release_id: unscheduled_releases.map(&:id))
55
+ end
56
+
43
57
  def content_changesets
44
58
  return [] unless model.is_a?(Contentable)
45
59
 
@@ -49,8 +63,21 @@ module Workarea
49
63
  .to_a
50
64
  end
51
65
 
66
+ def unscheduled_content_changesets
67
+ return [] unless model.is_a?(Contentable)
68
+
69
+ Workarea::Content.for(model)
70
+ .changesets
71
+ .any_in(release_id: unscheduled_releases.map(&:id))
72
+ .to_a
73
+ end
74
+
52
75
  def upcoming_releases
53
- @upcoming_releases ||= Release.upcoming.to_a
76
+ @upcoming_releases ||= (Release.upcoming - unscheduled_releases).to_a
77
+ end
78
+
79
+ def unscheduled_releases
80
+ @unscheduled_releases ||= Release.unscheduled.to_a
54
81
  end
55
82
  end
56
83
  end
@@ -2,4 +2,4 @@
2
2
  Name
3
3
  = select_tag 'product_rule[operator]', options_for_select([['equal', 'equal'], ['not equal', 'not_equal']], rule.operator)
4
4
  - categories = Workarea::Catalog::Category.any_in(id: rule.terms)
5
- = select_tag 'product_rule[value]', options_from_collection_for_select(categories, 'id', 'name', rule.terms), multiple: true, data: { remote_select: { source: catalog_categories_path, options: { placeholder: 'Choose a category...' } }.to_json }
5
+ = select_tag 'product_rule[value]', options_from_collection_for_select(categories, 'id', 'name', rule.terms), multiple: true, data: { remote_select: { source: catalog_categories_path(exclude_ids: rule.product_list.id), options: { placeholder: t('workarea.admin.product_rules.fields.category.choose') } }.to_json }
@@ -19,6 +19,39 @@
19
19
  .grid.grid--center
20
20
  .grid__cell.grid__cell--80-at-medium
21
21
  .grid
22
+ - @timeline.unscheduled_changesets.each_with_index do |changeset, index|
23
+ .activity-group.activity-group--bordered
24
+ .grid__cell.grid__cell--20
25
+ - if index == 0
26
+ .date-marker
27
+ .date-marker__annotation= t('workarea.admin.timeline.unscheduled_changes')
28
+ .date-marker__day ?
29
+ .grid__cell.grid__cell--80
30
+ .activity
31
+ .activity__header
32
+ = inline_svg('workarea/admin/icons/release_timeline.svg', class: 'activity__avatar')
33
+ %h3.activity__name= link_to changeset.release.name, release_path(changeset.release)
34
+ %p.activity__time
35
+ = changeset.publish_humanized
36
+ .activity__actions
37
+ .grid.grid--auto
38
+ .grid__cell
39
+ = form_tag release_session_path, method: :post do
40
+ = hidden_field_tag :release_id, changeset.release.id
41
+ = hidden_field_tag :return_to, url_for(@timeline.subject)
42
+ = button_tag value: 'edit_changes', class: 'text-button' do
43
+ %span= t('workarea.admin.timeline.edit')
44
+ = inline_svg('workarea/admin/icons/edit.svg', class: 'text-button__icon')
45
+ .grid__cell
46
+ = form_tag release_changeset_path(changeset.release, changeset), method: :delete, class: 'action-group__item', data: { deletion_form: { message: t('workarea.admin.timeline.delete_confirmation') } } do
47
+ = button_tag value: 'delete_changeset', class: 'text-button' do
48
+ %span= t('workarea.admin.actions.delete')
49
+ = inline_svg('workarea/admin/icons/delete.svg', class: 'text-button__icon')
50
+ .activity__message
51
+ .release-changeset.release-changeset--activity
52
+ - changeset.changed_fields.each do |field|
53
+ = render_changeset_field(changeset, field)
54
+
22
55
  - @timeline.upcoming_changesets.each_with_index do |changeset, index|
23
56
  .activity-group.activity-group--bordered
24
57
  .grid__cell.grid__cell--20
@@ -2801,6 +2801,7 @@ en:
2801
2801
  category:
2802
2802
  name: Category that does
2803
2803
  placeholder: Category A, Category B
2804
+ choose: Choose a category...
2804
2805
  publish_authorization:
2805
2806
  unauthorized: You are not authorized to publish changes now. You may add these changes to a release.
2806
2807
  recommendations:
@@ -3442,6 +3443,7 @@ en:
3442
3443
  no_activity: No activity to show
3443
3444
  timeline_for: Timeline For
3444
3445
  today: Today
3446
+ unscheduled_changes: Unscheduled Changes
3445
3447
  upcoming_changes: Upcoming Changes
3446
3448
  toolbar:
3447
3449
  adjust_order_pricing: Adjust Order Pricing
@@ -44,6 +44,21 @@ module Workarea
44
44
  refute(results['results'].first['top'])
45
45
  end
46
46
 
47
+ def test_exclude_categories_from_search_results
48
+ category = create_category(name: 'Category')
49
+ ignored = create_category(name: 'Category')
50
+
51
+ get admin.catalog_categories_path(exclude_ids: ignored.id, q: category.name, format: :json)
52
+
53
+ results = JSON.parse(response.body).with_indifferent_access[:results]
54
+ values = results.map { |result| result[:value] }
55
+
56
+ assert_response(:success)
57
+ refute_empty(values)
58
+ assert_includes(values, category.id.to_s)
59
+ refute_includes(values, ignored.id.to_s)
60
+ end
61
+
47
62
  def test_returns_breadcrumb_as_title_with_json_response
48
63
  category = create_category(name: 'Test')
49
64
  create_taxon(
@@ -15,22 +15,31 @@ module Workarea
15
15
  assert_equal(view_model.upcoming_changesets.length, 1)
16
16
  assert_equal(view_model.upcoming_changesets.first.release_id, release.id)
17
17
 
18
- release = create_release(name: 'Bar')
18
+ release = create_release(name: 'Bar', publish_at: 4.days.from_now)
19
19
  release.as_current { @releasable.update_attributes!(name: 'Changed') }
20
20
 
21
21
  view_model = TimelineViewModel.new(@releasable)
22
22
  assert_equal(view_model.upcoming_changesets.length, 2)
23
23
  assert_equal(view_model.upcoming_changesets.second.release_id, release.id)
24
24
 
25
+ release = create_release(name: 'Baz')
26
+ release.as_current { @releasable.update_attributes!(name: 'Changed') }
27
+
28
+ view_model = TimelineViewModel.new(@releasable)
29
+ assert_equal(view_model.upcoming_changesets.length, 2)
30
+
25
31
  release = create_release(name: 'Foo', published_at: 3.days.ago)
26
32
  release.as_current { @releasable.update_attributes!(name: 'Changed') }
27
33
 
28
34
  view_model = TimelineViewModel.new(@releasable)
29
35
  assert_equal(view_model.upcoming_changesets.length, 2)
36
+
37
+ assert_equal('Foo', view_model.upcoming_changesets.first.release.name)
38
+ assert_equal('Bar', view_model.upcoming_changesets.last.release.name)
30
39
  end
31
40
 
32
41
  def test_upcoming_changesets_with_content
33
- release = create_release
42
+ release = create_release(publish_at: 1.day.from_now)
34
43
  content = Content.for(@releasable)
35
44
  release.as_current { content.update_attributes!(browser_title: 'Foo') }
36
45
 
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.18
4
+ version: 3.4.19
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-10-01 00:00:00.000000000 Z
11
+ date: 2019-10-16 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.18
19
+ version: 3.4.19
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.18
26
+ version: 3.4.19
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.18
33
+ version: 3.4.19
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.18
40
+ version: 3.4.19
41
41
  description: Provides site administration functionality for the Workarea Commerce
42
42
  Platform.
43
43
  email: