Class: PagePresenter
Instance Attribute Summary
Attributes inherited from Presenter
#source
Instance Method Summary
collapse
Methods inherited from Presenter
#initialize
Constructor Details
This class inherits a constructor from Presenter
Instance Method Details
#as_json(options = {}) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'app/presenters/page_presenter.rb', line 55
def as_json(options={})
json = {
'_id' => @source.id,
'url' => "/admin/pages/#{@source.id}"
}
self.class.columns.each do |key, val|
json[key.to_s] = send(key)
end
json
end
|
#available_slices ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/presenters/page_presenter.rb', line 6
def available_slices
slices = {}
ObjectSpace.each_object do |object|
ActiveSupport::Deprecation.silence do
if object.class == Class && object.name =~ /\w+Slice$/
key = object.name.underscore.sub('_slice', '')
slices[key] = key.humanize
end
end
end
slices
end
|
#breadcrumbs ⇒ Object
47
48
49
|
# File 'app/presenters/page_presenter.rb', line 47
def breadcrumbs
[@source] + @source.ancestors
end
|
#bson_id ⇒ Object
2
3
4
|
# File 'app/presenters/page_presenter.rb', line 2
def bson_id
@source.id.to_s
end
|
#children ⇒ Object
51
52
53
|
# File 'app/presenters/page_presenter.rb', line 51
def children
@source.children
end
|
#editing_entry_content_slices?(entries) ⇒ Boolean
23
24
25
|
# File 'app/presenters/page_presenter.rb', line 23
def editing_entry_content_slices?(entries)
set_page? && (! entries.nil?)
end
|
#main_extra_template ⇒ Object
39
40
41
|
# File 'app/presenters/page_presenter.rb', line 39
def main_extra_template
'page_main_extra'
end
|
#main_template ⇒ Object
31
32
33
|
# File 'app/presenters/page_presenter.rb', line 31
def main_template
'page_main'
end
|
43
44
45
|
# File 'app/presenters/page_presenter.rb', line 43
def
'page_meta_extra'
end
|
35
36
37
|
# File 'app/presenters/page_presenter.rb', line 35
def meta_template
'page_meta'
end
|
#name ⇒ Object
19
20
21
|
# File 'app/presenters/page_presenter.rb', line 19
def name
@source.name
end
|
#set_page? ⇒ Boolean
27
28
29
|
# File 'app/presenters/page_presenter.rb', line 27
def set_page?
@source.set_page?
end
|