Class: Terrazzo::Page::Show

Inherits:
Base
  • Object
show all
Defined in:
lib/terrazzo/page/show.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#dashboard, #resource_class

Instance Method Summary collapse

Constructor Details

#initialize(dashboard, resource, has_many_params: {}) ⇒ Show

Returns a new instance of Show.



6
7
8
9
10
# File 'lib/terrazzo/page/show.rb', line 6

def initialize(dashboard, resource, has_many_params: {})
  super(dashboard, resource.class)
  @resource = resource
  @has_many_params = has_many_params || {}
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/terrazzo/page/show.rb', line 4

def resource
  @resource
end

Instance Method Details

#attributesObject



21
22
23
24
25
26
# File 'lib/terrazzo/page/show.rb', line 21

def attributes
  attrs = dashboard.show_page_attributes
  dashboard.flatten_attributes(attrs).map do |attr|
    build_field(attr, :show)
  end
end

#grouped_attributesObject



16
17
18
19
# File 'lib/terrazzo/page/show.rb', line 16

def grouped_attributes
  attrs = dashboard.show_page_attributes
  normalize_groups(attrs, :show)
end

#page_titleObject



12
13
14
# File 'lib/terrazzo/page/show.rb', line 12

def page_title
  dashboard.display_resource(resource)
end