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?, #subscribed_users
Instance Method Details
#additional_changesets_count ⇒ Object
14
15
16
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 14
def additional_changesets_count
[changeset_count - Workarea.config.per_page, 0].max
end
|
#calendar_at ⇒ Object
38
39
40
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 38
def calendar_at
model.publish_at || model.published_at
end
|
#calendar_on ⇒ Object
42
43
44
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 42
def calendar_on
calendar_at&.to_date
end
|
#changeset_count ⇒ Object
10
11
12
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 10
def changeset_count
@changeset_count ||= model.changesets.count
end
|
#changeset_summary ⇒ Object
22
23
24
25
26
27
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 22
def changeset_summary
@changeset_summary ||=
Release::Changeset.summary(model.id).map do |type|
ChangesetSummaryViewModel.new(type)
end
end
|
#changesets_with_releasable ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 29
def changesets_with_releasable
@changesets_with_releasable ||= model
.changesets
.latest
.map { |c| ChangesetViewModel.wrap(c) }
.select { |changeset| changeset.root.present? }
.reject { |changeset| changeset.releasable.blank? }
end
|
#show_changeset_summary? ⇒ Boolean
18
19
20
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 18
def show_changeset_summary?
changeset_count > Workarea.config.per_page
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
|
#undoes ⇒ Object
50
51
52
53
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 50
def undoes
return unless undoes?
@undoes ||= ReleaseViewModel.wrap(model.undoes, options)
end
|
#undos ⇒ Object
46
47
48
|
# File 'app/view_models/workarea/admin/release_view_model.rb', line 46
def undos
@undos ||= ReleaseViewModel.wrap(model.undos, options)
end
|