Class: Workarea::Admin::SegmentViewModel
- Inherits:
-
ApplicationViewModel
- Object
- ApplicationViewModel
- Workarea::Admin::SegmentViewModel
show all
- Includes:
- CommentableViewModel
- Defined in:
- app/view_models/workarea/admin/segment_view_model.rb
Instance Method Summary
collapse
#comment_count, #comments, #has_comments?, #new_comments_for?, #subscribed_users
Instance Method Details
#insights ⇒ Object
14
15
16
|
# File 'app/view_models/workarea/admin/segment_view_model.rb', line 14
def insights
@insights ||= Insights::SegmentViewModel.wrap(model, options)
end
|
#life_cycle? ⇒ Boolean
10
11
12
|
# File 'app/view_models/workarea/admin/segment_view_model.rb', line 10
def life_cycle?
model.is_a?(Segment::LifeCycle)
end
|
#segmentables ⇒ Object
22
23
24
|
# File 'app/view_models/workarea/admin/segment_view_model.rb', line 22
def segmentables
segmentables_search.results
end
|
#segmentables_count ⇒ Object
18
19
20
|
# File 'app/view_models/workarea/admin/segment_view_model.rb', line 18
def segmentables_count
segmentables_search.total
end
|
#segmentables_search ⇒ Object
26
27
28
29
30
31
|
# File 'app/view_models/workarea/admin/segment_view_model.rb', line 26
def segmentables_search
@segmentables_search ||= begin
query = Search::AdminSearch.new(active_by_segment: [model.id])
SearchViewModel.new(query, options)
end
end
|
#timeline ⇒ Object
6
7
8
|
# File 'app/view_models/workarea/admin/segment_view_model.rb', line 6
def timeline
@timeline ||= TimelineViewModel.new(model)
end
|