workarea-admin 3.5.0.beta.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/workarea/admin/config.js.erb +12 -4
  3. data/app/assets/javascripts/workarea/admin/modules/impersonation_notification.js +1 -3
  4. data/app/assets/javascripts/workarea/admin/modules/selects.js +11 -1
  5. data/app/assets/javascripts/workarea/admin/modules/timeline_report_chart.js +69 -5
  6. data/app/assets/javascripts/workarea/admin/modules/toggle_elements.js +2 -2
  7. data/app/assets/javascripts/workarea/admin/modules/tooltips.js +18 -3
  8. data/app/assets/javascripts/workarea/admin/templates/chart_legend.jst.ejs +2 -1
  9. data/app/assets/stylesheets/workarea/admin/application.scss.erb +1 -0
  10. data/app/assets/stylesheets/workarea/admin/components/_button.scss +7 -0
  11. data/app/assets/stylesheets/workarea/admin/components/_chart_legend.scss +18 -1
  12. data/app/assets/stylesheets/workarea/admin/components/_timeline_report.scss +30 -0
  13. data/app/assets/stylesheets/workarea/admin/settings/_grid.scss +1 -0
  14. data/app/controllers/workarea/admin/content_assets_controller.rb +1 -3
  15. data/app/controllers/workarea/admin/custom_events_controller.rb +41 -0
  16. data/app/controllers/workarea/admin/data_file_imports_controller.rb +1 -1
  17. data/app/controllers/workarea/admin/guest_browsings_controller.rb +1 -2
  18. data/app/controllers/workarea/admin/segmentables_controller.rb +12 -0
  19. data/app/helpers/workarea/admin/activities_helper.rb +1 -1
  20. data/app/helpers/workarea/admin/application_helper.rb +15 -0
  21. data/app/helpers/workarea/admin/facets_helper.rb +3 -0
  22. data/app/helpers/workarea/admin/icons_helper.rb +12 -3
  23. data/app/helpers/workarea/admin/segments_helper.rb +12 -1
  24. data/app/view_models/workarea/admin/alerts_view_model.rb +12 -1
  25. data/app/view_models/workarea/admin/reports/timeline_view_model.rb +77 -13
  26. data/app/view_models/workarea/admin/segment_view_model.rb +15 -0
  27. data/app/views/layouts/workarea/admin/application.html.haml +8 -2
  28. data/app/views/workarea/admin/activities/_create.html.haml +1 -1
  29. data/app/views/workarea/admin/activities/_destroy.html.haml +1 -1
  30. data/app/views/workarea/admin/activities/_update.html.haml +1 -1
  31. data/app/views/workarea/admin/catalog_categories/_cards.html.haml +1 -1
  32. data/app/views/workarea/admin/catalog_categories/index.html.haml +1 -1
  33. data/app/views/workarea/admin/catalog_products/_cards.html.haml +1 -1
  34. data/app/views/workarea/admin/catalog_products/index.html.haml +1 -1
  35. data/app/views/workarea/admin/content/_card.html.haml +3 -0
  36. data/app/views/workarea/admin/content/_edit.html.haml +11 -3
  37. data/app/views/workarea/admin/content/_form.html.haml +8 -1
  38. data/app/views/workarea/admin/content_assets/edit.html.haml +6 -1
  39. data/app/views/workarea/admin/content_assets/new.html.haml +6 -1
  40. data/app/views/workarea/admin/content_blocks/_asset.html.haml +3 -2
  41. data/app/views/workarea/admin/content_pages/_cards.html.haml +1 -1
  42. data/app/views/workarea/admin/content_pages/index.html.haml +1 -1
  43. data/app/views/workarea/admin/data_file_imports/new.html.haml +1 -1
  44. data/app/views/workarea/admin/insights/_cold_searches.html.haml +1 -1
  45. data/app/views/workarea/admin/insights/_hot_searches.html.haml +1 -1
  46. data/app/views/workarea/admin/insights/_searches_to_improve.html.haml +1 -1
  47. data/app/views/workarea/admin/insights/_star_searches.html.haml +1 -1
  48. data/app/views/workarea/admin/insights/_trending_searches.html.haml +1 -1
  49. data/app/views/workarea/admin/navigation_menus/index.html.haml +1 -1
  50. data/app/views/workarea/admin/pricing_discounts/_cards.html.haml +3 -1
  51. data/app/views/workarea/admin/pricing_discounts/edit.html.haml +16 -5
  52. data/app/views/workarea/admin/pricing_discounts/index.html.haml +1 -1
  53. data/app/views/workarea/admin/releases/edit.html.haml +1 -1
  54. data/app/views/workarea/admin/releases/index.html.haml +25 -0
  55. data/app/views/workarea/admin/releases/list.html.haml +2 -2
  56. data/app/views/workarea/admin/reports/timeline.html.haml +89 -1
  57. data/app/views/workarea/admin/search_customizations/_cards.html.haml +1 -1
  58. data/app/views/workarea/admin/search_customizations/index.html.haml +1 -1
  59. data/app/views/workarea/admin/segment_rules/fields/_last_order.html.haml +2 -1
  60. data/app/views/workarea/admin/segment_rules/fields/_revenue.html.haml +2 -3
  61. data/app/views/workarea/admin/segment_rules/fields/_traffic_referrer.html.haml +12 -6
  62. data/app/views/workarea/admin/segment_rules/summaries/_last_order.html.haml +4 -1
  63. data/app/views/workarea/admin/segment_rules/summaries/_traffic_referrer.html.haml +2 -10
  64. data/app/views/workarea/admin/segmentables/index.html.haml +46 -0
  65. data/app/views/workarea/admin/segments/_cards.html.haml +21 -0
  66. data/app/views/workarea/admin/segments/_publish.html.haml +2 -2
  67. data/app/views/workarea/admin/shared/_active_field.html.haml +5 -0
  68. data/app/views/workarea/admin/status_report_mailer/report.html.haml +5 -0
  69. data/app/views/workarea/admin/toolbar/show.html.haml +1 -0
  70. data/app/views/workarea/admin/users/index.html.haml +1 -0
  71. data/config/locales/en.yml +74 -17
  72. data/config/routes.rb +3 -0
  73. data/test/helpers/workarea/admin/application_helper_test.rb +24 -0
  74. data/test/helpers/workarea/admin/facets_helper_test.rb +28 -0
  75. data/test/integration/workarea/admin/assets_integration_test.rb +4 -2
  76. data/test/integration/workarea/admin/custom_events_integration_test.rb +54 -0
  77. data/test/integration/workarea/admin/data_file_imports_integration_test.rb +8 -0
  78. data/test/integration/workarea/admin/fulfillment_skus_integration_test.rb +2 -2
  79. data/test/system/workarea/admin/alerts_system_test.rb +7 -3
  80. data/test/system/workarea/admin/content_system_test.rb +46 -0
  81. data/test/system/workarea/admin/guest_browsing_system_test.rb +1 -1
  82. data/test/system/workarea/admin/orders_system_test.rb +3 -3
  83. data/test/system/workarea/admin/payment_transactions_system_test.rb +3 -3
  84. data/test/system/workarea/admin/reports_system_test.rb +50 -1
  85. data/test/system/workarea/admin/segments_system_test.rb +32 -4
  86. data/test/view_models/workarea/admin/reports/timeline_view_model_test.rb +32 -1
  87. metadata +14 -8
@@ -74,6 +74,27 @@
74
74
  = link_to insights_segment_path(model), class: 'card__button' do
75
75
  %span.button.button--small= t('workarea.admin.segments.cards.insights.button')
76
76
 
77
+ .grid__cell
78
+ .card{ class: card_classes(:segmentables, local_assigns[:active]) }
79
+ = link_to segment_segmentables_path(model), class: 'card__header' do
80
+ %span.card__header-text= t('workarea.admin.segments.cards.segmentables.header')
81
+ = inline_svg 'workarea/admin/icons/attributes.svg', class: 'card__icon'
82
+
83
+ - if local_assigns[:active].blank?
84
+ .card__body
85
+ = t('workarea.admin.segments.cards.segmentables.content_html', count: model.segmentables_count)
86
+
87
+ .section
88
+ %ul
89
+ - model.segmentables.take(5).each do |model|
90
+ %li= link_to model.name, model
91
+ - if model.segmentables_count > 5
92
+ %li.align-center
93
+ = link_to t('workarea.admin.cards.more', amount: model.segmentables_count - 5), segment_segmentables_path(model)
94
+
95
+ = link_to segment_segmentables_path(model), class: 'card__button' do
96
+ %span.button.button--small= t('workarea.admin.segments.cards.segmentables.button')
97
+
77
98
  .grid__cell
78
99
  = render 'workarea/admin/timeline/card', timeline: model.timeline, active: local_assigns[:active]
79
100
 
@@ -1,10 +1,10 @@
1
1
  .section.align-center
2
- %h4.link{ data: { toggle_element: '#segments-table' } }= t('workarea.admin.segments.publish.title')
2
+ %h4.link{ id: 'publish-segments', data: { toggle_element: '#segments-table' } }= t('workarea.admin.segments.publish.title')
3
3
 
4
4
  #segments-table.hidden
5
5
  %p= t('workarea.admin.segments.publish.description')
6
6
 
7
7
  .property
8
8
  = label_tag 'active_segment_ids', t('workarea.admin.shared.active_field.only_for'), class: 'property__name'
9
- = select_tag 'active_segment_ids', options_from_collection_for_select(segments, :id, :name, model.active_segment_ids), multiple: true, data: { select: { placeholder: t('workarea.admin.shared.active_field.select_segments'), allowClear: true, dropdownParent: '#active-by-segment' } }
9
+ = select_tag 'active_segment_ids', options_from_collection_for_select(segments, :id, :name, model.active_segment_ids), multiple: true, data: { select: { placeholder: t('workarea.admin.shared.active_field.select_segments'), allowClear: true } }
10
10
  %span.property__note= t('workarea.admin.shared.active_field.only_these_segments')
@@ -5,6 +5,11 @@
5
5
  .active-field__segments-message
6
6
  - haml_tag_if model.segments.present?, :strong do
7
7
  = t('workarea.admin.shared.active_field.by_segment', name: model.segments.map(&:name).first, count: model.segments.size, more_count: model.segments.size - 1)
8
+ - if model.segmented? && model.segments.blank?
9
+ = link_to '#missing-segments-tooltip', data: { tooltip: '' } do
10
+ = inline_svg('workarea/admin/icons/alert.svg', class: 'svg-icon svg-icon--small svg-icon--red')
11
+ #missing-segments-tooltip.tooltip-content
12
+ %p= t('workarea.admin.shared.active_field.no_segments')
8
13
 
9
14
  #active-by-segment.tooltip-content
10
15
  %h3
@@ -78,6 +78,11 @@
78
78
  = link_to catalog_products_url(issues: [t('workarea.alerts.issues.inconsistent_variant_details')]) do
79
79
  = @alerts.products_inconsistent_variant_details
80
80
  = t('workarea.admin.status_report_mailer.alerts.products_with_inconsistent_variant_details')
81
+ - if @alerts.show_missing_segments?
82
+ %li
83
+ = link_to search_url(active_by_segment: @alerts.missing_segments) do
84
+ = @alerts.missing_segments.length
85
+ = t('workarea.admin.status_report_mailer.alerts.segmented_resoures_missing_segments')
81
86
  - if @alerts.empty_upcoming_releases.any?
82
87
  %li
83
88
  = link_to releases_url do
@@ -68,6 +68,7 @@
68
68
  .header__user-menu
69
69
  .header__user-menu-cell
70
70
  = form_tag guest_browsing_path, method: 'delete', data: { disable_delete_confirmation: '' } do
71
+ = hidden_field_tag :return_to, root_path
71
72
  = button_tag t('workarea.admin.toolbar.stop_guest_browsing'), class: 'text-button text-button--destroy'
72
73
  - elsif impersonating?
73
74
  .header__action
@@ -86,6 +86,7 @@
86
86
  - if admin_browsing_as_guest?
87
87
  .grid__cell
88
88
  = form_tag guest_browsing_path, method: 'delete', data: { disable_delete_confirmation: '' } do
89
+ = hidden_field_tag :return_to, users_path
89
90
  = button_tag t('workarea.admin.users.index.stop_guest_browsing'), class: 'workflow-bar__button workflow-bar__button--delete'
90
91
  - else
91
92
  .grid__cell= link_to t('workarea.admin.users.index.browse_as_guest'), guest_browsing_path, class: 'workflow-bar__button', data: { method: :post }
@@ -7,6 +7,7 @@ en:
7
7
  delete: Delete
8
8
  delete_confirmation: Are you sure you want to delete?
9
9
  impersonation_confirmation: You are currently impersonating %{name}. Would you like to continue as this user?
10
+ guest_browsing_confirmation: You are currently browsing as a guest. Would you like to continue guest browsing?
10
11
  drag: Drag
11
12
  edit: Edit
12
13
  remove: Remove
@@ -65,9 +66,9 @@ en:
65
66
  fulfillment_sku_create_html: created %{name}
66
67
  fulfillment_sku_destroy_html: removed %{name}
67
68
  fulfillment_sku_update_html: updated %{fields} on %{name}
68
- generic_create_html: created %{model} %{id}
69
- generic_update_html: updated %{model} %{id}
70
- generic_destroy_html: removed %{model} %{id}
69
+ generic_create_html: created %{model}
70
+ generic_update_html: updated %{model}
71
+ generic_destroy_html: removed %{model}
71
72
  help_article_create_html: created the %{name} help article
72
73
  help_article_destroy_html: removed the %{name} help article
73
74
  help_article_update_html: updated %{fields} on the %{name} help article
@@ -169,7 +170,7 @@ en:
169
170
  confirm: Confirm and delete
170
171
  confirmation: Are you sure you want to delete %{count}, including the ones below?
171
172
  flash_messages:
172
- created: Your deletion request is being processed and will complete shortly.
173
+ created: Your deletion is being processed.
173
174
  generic_name: Item
174
175
  bulk_action_product_edits:
175
176
  details:
@@ -738,7 +739,7 @@ en:
738
739
  button: View Original
739
740
  title: Original
740
741
  edit:
741
- alt_text_note: Used as default Alt text in Content
742
+ alt_text_note: Used as default alt text in content blocks
742
743
  file_label: Choose File
743
744
  name_label: Name
744
745
  page_title: Attributes for %{asset}
@@ -746,6 +747,20 @@ en:
746
747
  save_asset: Save Asset
747
748
  tags_label: Tags
748
749
  tags_note: 'Comma separated: just, like, this'
750
+ tags_tooltip_html: |
751
+ <p>Use the following tags to set an asset as a favicon or Open Graph image for your site:</p>
752
+
753
+ <ul>
754
+ <li><code>favicon</code> - The default favicon</li>
755
+ <li><code>favicon-WxH</code>, e.g. "favicon-32x32" - The favicon for the given size</li>
756
+ <li><code>og-default</code> - The default Open Graph image</li>
757
+ </ul>
758
+
759
+ <p>
760
+ The default favicon is used when a device does not request a specific size or when the requested size is not available.
761
+ <br/>
762
+ The default Open Graph image is used when sharing a content page that does not specify an Open Graph image.
763
+ </p>
749
764
  type_label: Type
750
765
  flash_messages:
751
766
  created: Asset has been created.
@@ -765,7 +780,7 @@ en:
765
780
  page_title: Choose an Asset
766
781
  title: Select Asset
767
782
  new:
768
- alt_text_note: Used as default Alt text in Content
783
+ alt_text_note: Used as default alt text in content blocks
769
784
  create_asset: Create Asset
770
785
  create_asset_disabled_text: Creating Asset...
771
786
  file_label: Choose File
@@ -782,7 +797,8 @@ en:
782
797
  clear_asset: Clear asset
783
798
  name_missing: "(none)"
784
799
  select_an_asset: Select an asset
785
- alt_text_note: Leave alt text blank to default to the asset's alt text
800
+ alt_text_note_html: "Default alt text: <strong>%{text}</strong>"
801
+ no_default_alt_text: "No default alt text"
786
802
  category:
787
803
  select_placeholder: Choose a category...
788
804
  flash_messages:
@@ -1588,6 +1604,7 @@ en:
1588
1604
  allow_sale_items: Allow Sale Items
1589
1605
  alt_text: Alt Text
1590
1606
  amount: Amount
1607
+ auto_deactivate: Auto Deactivate
1591
1608
  aov: AOV
1592
1609
  automate_metadata: Automate Metadata
1593
1610
  available: Available Units
@@ -2369,13 +2386,18 @@ en:
2369
2386
  missing_images: "%{product} missing images"
2370
2387
  missing_prices: "%{product} missing prices"
2371
2388
  missing_variants: "%{product} missing variants"
2389
+ missing_segments:
2390
+ one: "1 segmented thing with no matching segments"
2391
+ other: "%{count} segmented things with no matching segments"
2372
2392
  low_inventory: "%{product} with low inventory"
2373
2393
  variants_missing_details: "%{product} with variants missing details"
2374
2394
  inconsistent_variant_details: "%{product} with inconsistent variant details"
2375
2395
  product: product
2376
2396
  publishes_on_and_has_no_changes: "%{release_name} publishes on %{release_publish_date} and has no changes"
2377
2397
  variant: variant
2398
+ workarea_version_outdated: A newer version of Workarea is available! Contact your implementer about upgrading.
2378
2399
  avatar_title: Avatar for %{name}
2400
+ browse_storefront_as_guest: Browse the Storefront as a Guest
2379
2401
  close_primary_menu: Close Primary Menu
2380
2402
  current_page: Current Page
2381
2403
  help: Help
@@ -2867,6 +2889,7 @@ en:
2867
2889
  list_help: You can allow more than one user tag for this discount by separating them with commas, e.g. vip, employee.
2868
2890
  edit:
2869
2891
  page_title: Attributes for %{name}
2892
+ 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}.
2870
2893
  flash_messages:
2871
2894
  removed: These changes have been removed
2872
2895
  saved: Your changes have been saved
@@ -3339,14 +3362,22 @@ en:
3339
3362
  title: Searches
3340
3363
  unknown: Unknown
3341
3364
  timeline:
3365
+ add_custom: Add Custom
3366
+ add_custom_event: Add Custom Event
3342
3367
  chart_title: Timeline Report
3368
+ custom_events: Custom Events
3369
+ customers: Customers
3343
3370
  date: Date
3344
- title: Timeline
3345
- revenue: Revenue
3371
+ events: Events
3372
+ no_events: There are no events for this date range.
3373
+ no_planned_changes: There are no changes planned for this release
3346
3374
  orders: Orders
3347
- units_sold: Units Sold
3348
- customers: Customers
3349
3375
  releases: Releases
3376
+ revenue: Revenue
3377
+ title: Timeline
3378
+ units_sold: Units Sold
3379
+ update_event: Update Event
3380
+ view_release: View Release
3350
3381
  summary:
3351
3382
  intro_html:
3352
3383
  one: Over the last <strong>3 Months</strong> there has been <strong>%{count} Release</strong> with
@@ -3355,6 +3386,10 @@ en:
3355
3386
  orders_html: <strong>%{orders}</strong> orders
3356
3387
  units_sold_html: <strong>%{units_sold}</strong> units sold
3357
3388
  customers_html: <strong>%{customers}</strong> new customers
3389
+ flash_messages:
3390
+ created: Custom Event created successfully
3391
+ success: Custom Event updated successfully
3392
+ error: Custom Event failed to save
3358
3393
  reports_mailer:
3359
3394
  export:
3360
3395
  subject: Here's your %{name} export
@@ -3489,7 +3524,7 @@ en:
3489
3524
  sort_by: Sort by
3490
3525
  title: Search results
3491
3526
  segment_rules:
3492
- unknown: Unknown
3527
+ select_a_medium: Select a medium
3493
3528
  email: Email
3494
3529
  social: Social
3495
3530
  search: Search
@@ -3520,8 +3555,9 @@ en:
3520
3555
  geolocation:
3521
3556
  note: You can enter countries, regions, states, or postal codes here.
3522
3557
  traffic_referrer:
3523
- source_notes: You can use a regular expression here.
3524
- source_notes_html: You can use a regular expression syntax in this field. For instance <code>twitter|facebook</code> will match either Twitter or Facebook. Matches are case-insensitive. Learn more about regular expressions <a href="https://en.wikipedia.org/wiki/Regular_expression" target="_blank" rel="noopener">here</a>.
3558
+ note_html: Any selections made below will cause a match.
3559
+ url_notes: You can use a regular expression here.
3560
+ url_notes_html: You can use a regular expression syntax in this field. For instance <code>twitter|facebook</code> will match either Twitter or Facebook. Matches are case-insensitive. Learn more about regular expressions <a href="https://en.wikipedia.org/wiki/Regular_expression" target="_blank" rel="noopener">here</a>.
3525
3561
  flash_messages:
3526
3562
  destroyed: Your rule has been removed.
3527
3563
  error: There was a problem saving your rule.
@@ -3532,6 +3568,9 @@ en:
3532
3568
  no_edit: Why can't I edit these?
3533
3569
  no_edit_description_html: Changing the rules for a segment changes who's in that segment, and invalidates all data and insights collected for those people. Try %{link} instead.
3534
3570
  creating_a_new_segment: creating a new segment
3571
+ last_order:
3572
+ not_ordered: Not ordered
3573
+ ordered: Ordered
3535
3574
  platform:
3536
3575
  android: Android
3537
3576
  blackberry: BlackBerry
@@ -3545,9 +3584,12 @@ en:
3545
3584
  geolocation:
3546
3585
  description_html: "Browsing from <strong>%{locations}</strong>"
3547
3586
  last_order:
3548
- description_html:
3549
- one: Ordered within <strong>1</strong> day ago
3550
- other: Ordered within <string>%{count}</strong> days ago
3587
+ within_description_html:
3588
+ one: Ordered within the last <strong>1</strong> day
3589
+ other: Ordered within the last <string>%{count}</strong> days
3590
+ not_within_description_html:
3591
+ one: Not ordered within the last <strong>1</strong> day
3592
+ other: Not ordered within the last <string>%{count}</strong> days
3551
3593
  logged_in:
3552
3594
  logged_in_html: "The visitor is <strong>logged in</strong>."
3553
3595
  logged_out_html: "The visitor is <strong>not logged in</strong>."
@@ -3566,6 +3608,11 @@ en:
3566
3608
  other: "Has visited <strong>%{count}</strong> times"
3567
3609
  tags:
3568
3610
  description_html: "Tagged with any of <strong>%{tags}</strong>"
3611
+ segmentables:
3612
+ index:
3613
+ title: Content Active for "%{name}"
3614
+ no_content: There's no content setup specifically for this segment.
3615
+ no_content_instructions_html: Throughout the admin, you can setup personalized experiences for this segment. Anywhere you see an <strong>Active</strong> field, you can click the "by segment" link next set active only for a selection of segments. For content blocks, you can do this in the "Display" tab on the right in the block editing screen.
3569
3616
  segments:
3570
3617
  cards:
3571
3618
  attributes:
@@ -3574,6 +3621,13 @@ en:
3574
3621
  rules:
3575
3622
  header: Rules
3576
3623
  button: View Rules
3624
+ segmentables:
3625
+ button: View
3626
+ content_html:
3627
+ zero: There's <strong>no content</strong> setup specifically for this segment.
3628
+ one: "There's <strong>1</strong> piece of content setup specifically for this segment:"
3629
+ other: "There are <strong>%{count}</strong> pieces of content setup specifically for this segment:"
3630
+ header: Content
3577
3631
  insights:
3578
3632
  header: Insights
3579
3633
  button: View Insights
@@ -3601,6 +3655,7 @@ en:
3601
3655
  orders: Orders
3602
3656
  revenue: Revenue
3603
3657
  average_order_value: Average Order Value
3658
+ missing: Missing Segment %{id}...
3604
3659
  publish:
3605
3660
  title: Publish by segment?
3606
3661
  description: You can control which segments this publishes for below. If you leave these blank, it will show for everyone.
@@ -3621,6 +3676,7 @@ en:
3621
3676
  one: "only for %{name}"
3622
3677
  other: "only for %{name} and %{more_count} more..."
3623
3678
  description_html: 'If you select segments here this will only show for visitors in one of those segments.'
3679
+ no_segments: Set up for segmentation, but no current segments found. This won't display in the storefront.
3624
3680
  only_for: Only for
3625
3681
  select_segments: Select segments...
3626
3682
  only_these_segments: Only these segments will see this.
@@ -3774,6 +3830,7 @@ en:
3774
3830
  products_with_low_inventory: Products with low inventory
3775
3831
  products_with_variants_missing_details: Products with variants missing details
3776
3832
  products_with_inconsistent_variant_details: Products with inconsistent variant details
3833
+ segmented_resoures_missing_segments: Segmented resources with no matching segments
3777
3834
  title: Alerts
3778
3835
  upcoming_empty_releases: Upcoming empty releases
3779
3836
  orders:
data/config/routes.rb CHANGED
@@ -148,6 +148,8 @@ Workarea::Admin::Engine.routes.draw do
148
148
  get :searches
149
149
  get :timeline
150
150
 
151
+ resources :custom_events, only: [:create, :update, :destroy]
152
+
151
153
  post :export
152
154
  get '/:id/download', action: :download, as: :download
153
155
  end
@@ -366,6 +368,7 @@ Workarea::Admin::Engine.routes.draw do
366
368
 
367
369
  resources :segments, except: [:new, :create] do
368
370
  resources :rules, except: [:show, :new, :edit], controller: 'segment_rules'
371
+ resources :segmentables, only: [:index]
369
372
 
370
373
  member do
371
374
  get :insights
@@ -78,6 +78,30 @@ 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_workarea_release_notes_url
83
+ result = workarea_release_notes_url('3.5.0')
84
+ assert_equal(
85
+ 'https://developer.workarea.com/release-notes/workarea-3-5-0.html',
86
+ result
87
+ )
88
+ end
89
+
90
+ def test_duration_in_words
91
+ assert_equal(
92
+ t('workarea.duration.days', count: 2),
93
+ duration_in_words(2.days)
94
+ )
95
+
96
+ assert_equal(
97
+ [
98
+ t('workarea.duration.years', count: 1),
99
+ t('workarea.duration.months', count: 2),
100
+ t('workarea.duration.days', count: 12),
101
+ ].to_sentence,
102
+ duration_in_words(2.months + 1.years + 12.days)
103
+ )
104
+ end
81
105
  end
82
106
  end
83
107
  end
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class FacetsHelperTest < ViewTest
6
+ def test_facet_value_display_name
7
+ facet = Workarea::Search::Facet.new(nil, 'tags')
8
+ assert_equal('bar_baz', facet_value_display_name(facet, 'bar_baz'))
9
+
10
+ facet = Workarea::Search::Facet.new(nil, 'colors')
11
+ assert_equal('Bar Baz', facet_value_display_name(facet, 'bar_baz'))
12
+
13
+ facet = Workarea::Search::Facet.new(nil, 'upcoming_changes')
14
+ release = create_release(name: 'Foo Release')
15
+ assert_equal('Foo Release', facet_value_display_name(facet, release.id))
16
+ assert_nil(facet_value_display_name(facet, 'bar_baz'))
17
+
18
+ facet = Workarea::Search::Facet.new(nil, 'active_by_segment')
19
+ segment = create_segment(name: 'Foo Segment')
20
+ assert_equal('Foo Segment', facet_value_display_name(facet, segment.id))
21
+ assert_equal(
22
+ t('workarea.admin.segments.missing', id: 'bar'),
23
+ facet_value_display_name(facet, 'bar')
24
+ )
25
+ end
26
+ end
27
+ end
28
+ 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
@@ -0,0 +1,54 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class CustomEventsIntegrationTest < Workarea::IntegrationTest
6
+ include Admin::IntegrationTest
7
+
8
+ def test_creation
9
+ freeze_time
10
+
11
+ assert_difference 'Workarea::Reports::CustomEvent.count', 1 do
12
+ post admin.report_custom_events_path,
13
+ params: {
14
+ custom_event: {
15
+ name: 'Foo',
16
+ occurred_at: 1.week.ago
17
+ }
18
+ }
19
+ end
20
+
21
+ custom_event = Workarea::Reports::CustomEvent.first
22
+ assert_equal('Foo', custom_event.name)
23
+ assert_equal(1.week.ago, custom_event.occurred_at)
24
+ end
25
+
26
+ def test_updating
27
+ event = Workarea::Reports::CustomEvent.create!(
28
+ name: 'Foo',
29
+ occurred_at: 1.week.ago
30
+ )
31
+
32
+ patch admin.report_custom_event_path(id: event.id),
33
+ params: {
34
+ custom_event: {
35
+ name: 'Bar'
36
+ }
37
+ }
38
+
39
+ assert_equal('Bar', Workarea::Reports::CustomEvent.first.name)
40
+ end
41
+
42
+ def test_deletion
43
+ event = Workarea::Reports::CustomEvent.create!(
44
+ name: 'Foo',
45
+ occurred_at: 1.week.ago
46
+ )
47
+
48
+ delete admin.report_custom_event_path(id: event.id)
49
+
50
+ assert_equal(0, Workarea::Reports::CustomEvent.count)
51
+ end
52
+ end
53
+ end
54
+ end