workarea-admin 3.5.0.beta.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,12 @@
1
+ module Workarea
2
+ module Admin
3
+ class SegmentablesController < Admin::ApplicationController
4
+ required_permissions :people
5
+
6
+ def index
7
+ @segment = Admin::SegmentViewModel.new(Segment.find(params[:segment_id]))
8
+ @search = @segment.segmentables_search
9
+ end
10
+ end
11
+ end
12
+ end
@@ -56,7 +56,7 @@ module Workarea
56
56
  end
57
57
 
58
58
  def activity_model_name(entry)
59
- entry.audited_type.gsub(/Workarea::/, '').gsub(/::/, ' ')
59
+ entry.audited_type.gsub(/Workarea::/, '').gsub(/::/, ' ').titleize
60
60
  end
61
61
 
62
62
  def link_to_restore_for(entry)
@@ -160,6 +160,21 @@ module Workarea
160
160
  def s3?
161
161
  Configuration::S3.configured?
162
162
  end
163
+
164
+ def workarea_release_notes_url(version)
165
+ version_path = "workarea-#{version.gsub('.', '-')}.html"
166
+ "https://developer.workarea.com/release-notes/#{version_path}"
167
+ end
168
+
169
+ def duration_in_words(duration)
170
+ parts = duration.parts
171
+ return t('workarea.duration.seconds', count: 0) if parts.empty?
172
+
173
+ parts
174
+ .sort_by { |unit, _ | ActiveSupport::Duration::PARTS.index(unit) }
175
+ .map { |unit, val| t("workarea.duration.#{unit}", count: val) }
176
+ .to_sentence
177
+ end
163
178
  end
164
179
  end
165
180
  end
@@ -6,6 +6,9 @@ module Workarea
6
6
  value
7
7
  elsif facet.system_name == 'upcoming_changes'
8
8
  Release.where(id: value).pluck(:name).first
9
+ elsif facet.system_name == 'active_by_segment'
10
+ Segment.where(id: value).pluck(:name).first ||
11
+ t('workarea.admin.segments.missing', id: value[0..4])
9
12
  else
10
13
  value.titleize
11
14
  end
@@ -107,14 +107,23 @@ module Workarea
107
107
  )
108
108
  end
109
109
 
110
- def segments_icon_for(model)
111
- return unless model.active_segment_ids.present?
110
+ def segments_icons_for(model)
111
+ return unless model.segmented?
112
112
 
113
- inline_svg(
113
+ result = inline_svg(
114
114
  'workarea/admin/icons/user.svg',
115
115
  title: t('workarea.admin.insights.icons.segments'),
116
116
  class: 'svg-icon svg-icon--small svg-icon--link-color'
117
117
  )
118
+
119
+ if model.segments.blank?
120
+ result += inline_svg(
121
+ 'workarea/admin/icons/alert.svg',
122
+ class: 'svg-icon svg-icon--small svg-icon--red'
123
+ )
124
+ end
125
+
126
+ result
118
127
  end
119
128
  end
120
129
  end
@@ -10,13 +10,17 @@ module Workarea
10
10
 
11
11
  def traffic_referrer_medium_options
12
12
  {
13
- t('workarea.admin.segment_rules.unknown') => 'unknown',
13
+ t('workarea.admin.segment_rules.select_a_medium') => nil,
14
14
  t('workarea.admin.segment_rules.email') => 'email',
15
15
  t('workarea.admin.segment_rules.social') => 'social',
16
16
  t('workarea.admin.segment_rules.search') => 'search'
17
17
  }
18
18
  end
19
19
 
20
+ def traffic_referrer_source_options
21
+ Workarea.referrer_parser.sources
22
+ end
23
+
20
24
  def segments
21
25
  @segments ||= Segment.all
22
26
  end
@@ -63,6 +67,13 @@ module Workarea
63
67
  t('workarea.admin.segment_rules.platform.windows') => 'windows'
64
68
  }
65
69
  end
70
+
71
+ def last_order_options
72
+ {
73
+ t('workarea.admin.segment_rules.last_order.ordered') => true,
74
+ t('workarea.admin.segment_rules.last_order.not_ordered') => false
75
+ }
76
+ end
66
77
  end
67
78
  end
68
79
  end
@@ -11,12 +11,14 @@ module Workarea
11
11
  :show_products_missing_categories?,
12
12
  :show_products_low_inventory?,
13
13
  :show_products_variants_missing_details?,
14
- :show_products_inconsistent_variant_details?
14
+ :show_products_inconsistent_variant_details?,
15
+ :show_missing_segments?
15
16
  ]
16
17
 
17
18
  result = 0
18
19
  predicate_alerts.each { |m| result += 1 if send(m) }
19
20
  result += empty_upcoming_releases.length
21
+ result += 1 if workarea_version_outdated?
20
22
  result
21
23
  end
22
24
 
@@ -55,6 +57,15 @@ module Workarea
55
57
  def show_products_inconsistent_variant_details?
56
58
  products_inconsistent_variant_details > 0
57
59
  end
60
+
61
+ def workarea_version_outdated?
62
+ latest_workarea_version.present? &&
63
+ Gem::Version.new(latest_workarea_version) > Gem::Version.new(Workarea::VERSION::STRING)
64
+ end
65
+
66
+ def show_missing_segments?
67
+ missing_segments.length > 0
68
+ end
58
69
  end
59
70
  end
60
71
  end
@@ -4,13 +4,47 @@ module Workarea
4
4
  class TimelineViewModel < ApplicationViewModel
5
5
  include GroupByTime
6
6
 
7
+ class Event
8
+ def self.build(releases, custom_events)
9
+ result = Hash.new { |h, k| h[k] = [] }
10
+
11
+ releases.each do |release|
12
+ result[release.published_at.to_date] << new(
13
+ Workarea::Admin::ReleaseViewModel.wrap(release),
14
+ type: 'release',
15
+ occurred_at: release.published_at
16
+ )
17
+ end
18
+
19
+ custom_events.each do |event|
20
+ result[event.occurred_at.to_date] << new(
21
+ event,
22
+ type: 'custom_event',
23
+ occurred_at: event.occurred_at
24
+ )
25
+ end
26
+
27
+ result.sort.to_h
28
+ end
29
+
30
+ delegate_missing_to :@model
31
+ attr_reader :model, :type, :occurred_at
32
+
33
+ def initialize(model, type:, occurred_at:)
34
+ @model = model
35
+ @type = type
36
+ @occurred_at = occurred_at
37
+ end
38
+ end
39
+
7
40
  def summary
8
41
  {
9
- revenue: summarize(data_for('revenue')),
10
- orders: summarize(data_for('orders')),
11
- units_sold: summarize(data_for('units_sold')),
12
- customers: summarize(data_for('customers')),
13
- releases: summarize(release_data)
42
+ revenue: summarize(graph_data_for('revenue')),
43
+ orders: summarize(graph_data_for('orders')),
44
+ units_sold: summarize(graph_data_for('units_sold')),
45
+ customers: summarize(graph_data_for('customers')),
46
+ releases: summarize(graph_data_for('releases')),
47
+ custom_events: summarize(graph_data_for('custom_events'))
14
48
  }
15
49
  end
16
50
 
@@ -18,15 +52,30 @@ module Workarea
18
52
  {
19
53
  labels: grouped_data.keys.reverse,
20
54
  datasets: {
21
- revenue: transform(data_for('revenue')),
22
- orders: transform(data_for('orders')),
23
- units_sold: transform(data_for('units_sold')),
24
- customers: transform(data_for('customers')),
25
- releases: transform(release_data)
55
+ # Note: Order is important. Chart.js layers chart data from the
56
+ # top down.
57
+ releases: transform(graph_data_for('releases')),
58
+ custom_events: transform(graph_data_for('custom_events')),
59
+ revenue: transform(graph_data_for('revenue')),
60
+ orders: transform(graph_data_for('orders')),
61
+ units_sold: transform(graph_data_for('units_sold')),
62
+ customers: transform(graph_data_for('customers'))
26
63
  }
27
64
  }
28
65
  end
29
66
 
67
+ def events
68
+ @events ||= begin
69
+ Event
70
+ .build(releases, custom_events)
71
+ .each_with_object({}) do |(date, events), group|
72
+ group[date] = events.sort_by(&:occurred_at)
73
+ end
74
+ end
75
+ end
76
+
77
+ private
78
+
30
79
  def releases
31
80
  @releases ||= Release.published_between(
32
81
  starts_at: starts_at,
@@ -34,7 +83,12 @@ module Workarea
34
83
  ).to_a
35
84
  end
36
85
 
37
- private
86
+ def custom_events
87
+ @custom_events ||= Workarea::Reports::CustomEvent.occurred_between(
88
+ starts_at: starts_at.to_date,
89
+ ends_at: ends_at.to_date
90
+ ).to_a
91
+ end
38
92
 
39
93
  def date_range
40
94
  starts_at.to_date..ends_at.to_date
@@ -46,19 +100,29 @@ module Workarea
46
100
  end
47
101
  end
48
102
 
49
- def data_for(type)
103
+ def graph_data_for(type)
104
+ return release_graph_data if type == 'releases'
105
+ return custom_event_graph_data if type == 'custom_events'
106
+
50
107
  grouped_data.transform_values do |values|
51
108
  (values || []).map { |v| v[type] }
52
109
  end
53
110
  end
54
111
 
55
- def release_data
112
+ def release_graph_data
56
113
  date_range.each_with_object({}) do |date, group|
57
114
  data = releases.select { |r| r.published_at.to_date == date }
58
115
  group[date] = [data.count]
59
116
  end
60
117
  end
61
118
 
119
+ def custom_event_graph_data
120
+ date_range.each_with_object({}) do |date, group|
121
+ data = custom_events.select { |r| r.occurred_at.to_date == date }
122
+ group[date] = [data.count]
123
+ end
124
+ end
125
+
62
126
  def transform(data)
63
127
  data.map { |k, v| Hash[x: k.to_time, y: v.first] }.reverse
64
128
  end
@@ -14,6 +14,21 @@ module Workarea
14
14
  def insights
15
15
  @insights ||= Insights::SegmentViewModel.wrap(model, options)
16
16
  end
17
+
18
+ def segmentables_count
19
+ segmentables_search.total
20
+ end
21
+
22
+ def segmentables
23
+ segmentables_search.results
24
+ end
25
+
26
+ def segmentables_search
27
+ @segmentables_search ||= begin
28
+ query = Search::AdminSearch.new(active_by_segment: [model.id])
29
+ SearchViewModel.new(query, options)
30
+ end
31
+ end
17
32
  end
18
33
  end
19
34
  end
@@ -71,6 +71,7 @@
71
71
  %span.menu__heading= t('workarea.admin.layout.handy_links')
72
72
  %li.menu__item= link_to t('workarea.admin.layout.visit_storefront'), storefront.root_path, class: 'menu__link'
73
73
  %li.menu__item= link_to t('workarea.admin.layout.your_account_on_the_storefront'), storefront.users_account_path, class: 'menu__link'
74
+ %li.menu__item= link_to t('workarea.admin.layout.browse_storefront_as_guest'), guest_browsing_path, class: 'menu__link', data: { method: :post }
74
75
  %li.menu__item= link_to t('workarea.admin.layout.edit_the_home_page'), edit_content_path(current_system_page_content_for(:home_page)), class: 'menu__link'
75
76
  %li.menu__item.menu__item--heading
76
77
  %span.menu__heading= t('workarea.admin.layout.most_visited')
@@ -117,8 +118,12 @@
117
118
  %li.menu__item= link_to t('workarea.admin.layout.alert.variants_missing_details', product: "#{pluralize(@alerts.products_variants_missing_details, t('workarea.admin.layout.alert.product'))}"), catalog_products_path(issues: [t('workarea.alerts.issues.variants_missing_details')]), class: 'menu__link'
118
119
  - if @alerts.show_products_inconsistent_variant_details?
119
120
  %li.menu__item= link_to t('workarea.admin.layout.alert.inconsistent_variant_details', product: "#{pluralize(@alerts.products_inconsistent_variant_details, t('workarea.admin.layout.alert.product'))}"), catalog_products_path(issues: [t('workarea.alerts.issues.inconsistent_variant_details')]), class: 'menu__link'
121
+ - if @alerts.show_missing_segments?
122
+ %li.menu__item= link_to t('workarea.admin.layout.alert.missing_segments', count: @alerts.missing_segments.length), search_path(active_by_segment: @alerts.missing_segments), class: 'menu__link'
120
123
  - @alerts.empty_upcoming_releases.each do |release|
121
124
  %li.menu__item= link_to t('workarea.admin.layout.alert.publishes_on_and_has_no_changes', release_name: release.name, release_publish_date: release.publish_at.to_date.to_s(:long)), release_path(release) , class: 'menu__link'
125
+ - if @alerts.workarea_version_outdated?
126
+ %li.menu__item= link_to t('workarea.admin.layout.alert.workarea_version_outdated'), workarea_release_notes_url(@alerts.latest_workarea_version), class: 'menu__link'
122
127
 
123
128
  .header__action
124
129
  %button#help_menu{ type: 'button', class: 'header__action-link', data: { tooltip: { menu: true, content_id: '#help', interactive: true, arrow: false, distance: 0, multiple: false, trigger: 'hover' }.to_json, turbolinks: false } }
@@ -133,7 +138,8 @@
133
138
  .header__action
134
139
  .header__user-menu
135
140
  .header__user-menu-cell
136
- = form_tag guest_browsing_path, method: 'delete', data: { disable_delete_confirmation: '' } do
141
+ = form_tag guest_browsing_path, method: 'delete', data: { disable_delete_confirmation: '', impersonation_notification: t('workarea.admin.actions.guest_browsing_confirmation') } do
142
+ = hidden_field_tag :return_to, request.path
137
143
  = button_tag t('workarea.admin.toolbar.stop_guest_browsing'), class: 'text-button text-button--destroy'
138
144
  - elsif impersonating?
139
145
  .header__action
@@ -143,7 +149,7 @@
143
149
  %strong
144
150
  = link_to current_impersonation.email, user_path(current_impersonation)
145
151
  %br
146
- = form_tag impersonations_path, method: 'delete', data: { disable_delete_confirmation: '', impersonation_notification: current_impersonation.name } do
152
+ = form_tag impersonations_path, method: 'delete', data: { disable_delete_confirmation: '', impersonation_notification: t('workarea.admin.actions.impersonation_confirmation', name: current_impersonation.name) } do
147
153
  = button_tag t('workarea.admin.toolbar.stop_impersonation'), class: 'text-button text-button--destroy'
148
154
  - else
149
155
  .header__action
@@ -6,4 +6,4 @@
6
6
  %h3.activity__name= link_to_modifier(entry)
7
7
  %p.activity__time= activity_time(entry.created_at)
8
8
  .activity__message
9
- = t('workarea.admin.activities.generic_create_html', model: activity_model_name(entry), id: entry.audited_id)
9
+ = t('workarea.admin.activities.generic_create_html', model: activity_model_name(entry))
@@ -6,4 +6,4 @@
6
6
  %h3.activity__name= link_to_modifier(entry)
7
7
  %p.activity__time= activity_time(entry.created_at)
8
8
  .activity__message
9
- = t('workarea.admin.activities.generic_destroy_html', model: activity_model_name(entry), id: entry.audited_id)
9
+ = t('workarea.admin.activities.generic_destroy_html', model: activity_model_name(entry))
@@ -6,4 +6,4 @@
6
6
  %h3.activity__name= link_to_modifier(entry)
7
7
  %p.activity__time= activity_time(entry.created_at)
8
8
  .activity__message
9
- = t('workarea.admin.activities.generic_update_html', model: activity_model_name(entry), id: entry.audited_id)
9
+ = t('workarea.admin.activities.generic_update_html', model: activity_model_name(entry))
@@ -11,7 +11,7 @@
11
11
  %li
12
12
  %strong= t('workarea.admin.fields.active')
13
13
  = check_box_tag 'category', 'active', model.active, disabled: true
14
- = inline_svg('workarea/admin/icons/user.svg', class: 'svg-icon svg-icon--small svg-icon--blue') if model.active? && model.segments.any?
14
+ = segments_icons_for(model)
15
15
  %li
16
16
  %strong #{t('workarea.admin.fields.client_id')}:
17
17
  = model.client_id.presence || t('workarea.admin.cards.attributes.no_value')
@@ -63,7 +63,7 @@
63
63
  = upcoming_changesets_icon_for(result)
64
64
  = comments_icon_for(result)
65
65
  = top_icon_for(result)
66
- = segments_icon_for(result)
66
+ = segments_icons_for(result)
67
67
  %td
68
68
  - if result.breadcrumbs.blank?
69
69
  %em= t('workarea.admin.fields.no_taxonomy')
@@ -14,7 +14,7 @@
14
14
  %li
15
15
  %strong= t('workarea.admin.fields.active')
16
16
  = check_box_tag 'product', 'active', model.active?, disabled: true
17
- = inline_svg('workarea/admin/icons/user.svg', class: 'svg-icon svg-icon--small svg-icon--blue') if model.active? && model.segments.any?
17
+ = segments_icons_for(model)
18
18
  %li
19
19
  %strong= t('workarea.admin.fields.template')
20
20
  = model.template.try(:titleize)
@@ -73,7 +73,7 @@
73
73
  = comments_icon_for(result)
74
74
  = top_icon_for(result)
75
75
  = trending_icon_for(result)
76
- = segments_icon_for(result)
76
+ = segments_icons_for(result)
77
77
  %td.align-center= result.id
78
78
  %td= result.template.humanize
79
79
  %td.align-center
@@ -15,6 +15,9 @@
15
15
  %li.content-block-list__item
16
16
  = content_block_icon(block.icon, title: block.name, class: 'content-block-list__icon')
17
17
  %span.content-block-list__name= block.name
18
+ - if block.segments.any?
19
+ %span.content-block-list__segments
20
+ = inline_svg('workarea/admin/icons/user.svg', class: 'svg-icon svg-icon--small svg-icon--blue')
18
21
 
19
22
  - if content.blocks.length > 5
20
23
  %li.content-block-list__item.align-center
@@ -75,8 +75,16 @@
75
75
  = content_block_icon(block.icon, title: block.name, class: 'content-block-list__icon')
76
76
  %span.content-block-list__name= block.name
77
77
 
78
- - if block.segments.any?
78
+ - if block.segmented?
79
79
  = link_to "##{dom_id(block, :segments_tooltip)}", data: { tooltip: { interactive: true } }, class: 'content-block-list__segments' do
80
- = inline_svg('workarea/admin/icons/user.svg', class: 'svg-icon svg-icon--small svg-icon--blue')
80
+ - if block.segments.any?
81
+ = inline_svg('workarea/admin/icons/user.svg', class: 'svg-icon svg-icon--small svg-icon--blue')
82
+ - else
83
+ = inline_svg('workarea/admin/icons/alert.svg', class: 'svg-icon svg-icon--small svg-icon--red')
84
+
81
85
  .tooltip-content{ id: dom_id(block, :segments_tooltip) }
82
- %span= t('workarea.admin.content.edit.active_for_html', segments: block.segments.map(&:name).to_sentence)
86
+ %span
87
+ - if block.segments.any?
88
+ = t('workarea.admin.content.edit.active_for_html', segments: block.segments.map(&:name).to_sentence)
89
+ - else
90
+ = t('workarea.admin.shared.active_field.no_segments')
@@ -28,7 +28,14 @@
28
28
  .tabs__panel
29
29
  %h2.tabs__heading= t('workarea.admin.content.form.display')
30
30
  .section
31
- %span.heading.heading--4= t('workarea.admin.content.form.segments')
31
+ %span.heading.heading--4
32
+ = t('workarea.admin.content.form.segments')
33
+ - if block.segmented? && block.segments.blank?
34
+ = link_to '#missing-segments-tooltip', data: { tooltip: '' } do
35
+ = inline_svg('workarea/admin/icons/alert.svg', class: 'svg-icon svg-icon--small svg-icon--red')
36
+ #missing-segments-tooltip.tooltip-content
37
+ %p= t('workarea.admin.shared.active_field.no_segments')
38
+
32
39
  .property
33
40
  = label_tag 'block_active_segment_ids', t('workarea.admin.content.form.exclusive_segments'), class: 'property__name'
34
41
  = select_tag 'block[active_segment_ids]', options_from_collection_for_select(segments, :id, :name, block.active_segment_ids), multiple: true, data: { select: { placeholder: t('workarea.admin.shared.active_field.select_segments'), allowClear: true } }, id: nil