Sha256: 3e7268366b7a6146cafa9bd77ff7c56c522fb58cfe45c65a5bad90c1b8712ebe

Contents?: true

Size: 1.05 KB

Versions: 34

Compression:

Stored size: 1.05 KB

Contents

module Workarea
  module Admin
    class ReleaseViewModel < ApplicationViewModel
      include CommentableViewModel

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

      def changesets_with_releasable
        @changesets_with_releasable ||= model
                          .changesets
                          .map { |c| ChangesetViewModel.wrap(c) }
                          .select { |changeset| changeset.root.present? }
                          .reject { |changeset| changeset.releasable.blank? }
      end

      def can_undo?
        !undone? && changesets.any? { |c| c.undo.present? }
      end

      def published_on_date?(date)
        date == publish_time.to_date
      end

      def ended_on_date?(date)
        return true if content_release?
        date == model.undo_at.to_date
      end

      def content_release?
        model.undo_at.blank?
      end

      def publish_time
        model.publish_at || model.published_at
      end

      def undo_time
        model.undo_at || model.undone_at
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-admin-3.4.45 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.44 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.43 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.42 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.41 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.40 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.39 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.38 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.37 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.36 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.35 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.34 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.33 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.32 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.31 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.30 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.29 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.28 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.27 app/view_models/workarea/admin/release_view_model.rb
workarea-admin-3.4.26 app/view_models/workarea/admin/release_view_model.rb