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.27 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.26 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.25 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.23 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.22 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.21 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.20 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.19 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.18 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.17 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.16 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.15 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.14 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.13 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.12 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.11 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.10 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.9 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.8 app/view_models/workarea/admin/segment_view_model.rb
workarea-admin-3.5.7 app/view_models/workarea/admin/segment_view_model.rb