Class: Workarea::Admin::ReleaseViewModel
- Inherits:
-
ApplicationViewModel
- Object
- ApplicationViewModel
- Workarea::Admin::ReleaseViewModel
show all
- Includes:
- CommentableViewModel
- Defined in:
- app/view_models/workarea/admin/release_view_model.rb
Instance Method Summary
collapse
#comment_count, #comments, #has_comments?, #new_comments_for?
Instance Method Details
#can_undo? ⇒ Boolean
18
19
20
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 18
def can_undo?
!undone? && changesets.any? { |c| c.undo.present? }
end
|
#changesets_with_releasable ⇒ Object
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
|
#content_release? ⇒ Boolean
31
32
33
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 31
def content_release?
model.undo_at.blank?
end
|
#ended_on_date?(date) ⇒ Boolean
26
27
28
29
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 26
def ended_on_date?(date)
return true if content_release?
date == model.undo_at.to_date
end
|
#publish_time ⇒ Object
35
36
37
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 35
def publish_time
model.publish_at || model.published_at
end
|
#published_on_date?(date) ⇒ Boolean
22
23
24
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 22
def published_on_date?(date)
date == publish_time.to_date
end
|
#timeline ⇒ Object
6
7
8
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 6
def timeline
@timeline ||= TimelineViewModel.new(model)
end
|
#undo_time ⇒ Object
39
40
41
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 39
def undo_time
model.undo_at || model.undone_at
end
|