Class: Workarea::Admin::ReleaseViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Includes:
CommentableViewModel
Defined in:
app/view_models/workarea/admin/release_view_model.rb

Instance Method Summary collapse

Methods included from CommentableViewModel

#comment_count, #comments, #has_comments?, #new_comments_for?, #subscribed_users

Instance Method Details

#calendar_atObject



18
19
20
# File 'app/view_models/workarea/admin/release_view_model.rb', line 18

def calendar_at
  model.publish_at || model.published_at
end

#calendar_onObject



22
23
24
# File 'app/view_models/workarea/admin/release_view_model.rb', line 22

def calendar_on
  calendar_at&.to_date
end

#changesets_with_releasableObject



10
11
12
13
14
15
16
# File 'app/view_models/workarea/admin/release_view_model.rb', line 10

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

#timelineObject



6
7
8
# File 'app/view_models/workarea/admin/release_view_model.rb', line 6

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

#undoObject



26
27
28
29
# File 'app/view_models/workarea/admin/release_view_model.rb', line 26

def undo
  return unless undo?
  @undo ||= ReleaseViewModel.wrap(model.undo, options)
end

#undoesObject



31
32
33
34
# File 'app/view_models/workarea/admin/release_view_model.rb', line 31

def undoes
  return unless undoes?
  @undoes ||= ReleaseViewModel.wrap(model.undoes, options)
end