Sha256: 90e29fa82f75e243122818a08068356e75807523a98f7a46266a61c6792b0671

Contents?: true

Size: 743 Bytes

Versions: 27

Compression:

Stored size: 743 Bytes

Contents

module Workarea
  module Admin
    class SegmentViewModel < ApplicationViewModel
      include CommentableViewModel

      def timeline
        @timeline ||= TimelineViewModel.new(model)
      end

      def life_cycle?
        model.is_a?(Segment::LifeCycle)
      end

      def insights
        @insights ||= Insights::SegmentViewModel.wrap(model, options)
      end

      def segmentables_count
        segmentables_search.total
      end

      def segmentables
        segmentables_search.results
      end

      def segmentables_search
        @segmentables_search ||= begin
          query = Search::AdminSearch.new(active_by_segment: [model.id])
          SearchViewModel.new(query, options)
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-admin-3.5.6 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.5 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.4 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.3 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.2 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.1 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.0 app/view_models/workarea/admin/segment_view_model.rb