Class: Locomotive::SitePresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/locomotive/site_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#__ability, #__depth

Instance Method Summary collapse

Methods inherited from BasePresenter

#_id, #ability?, #after_initialize, #errors, #formatted_time, getters_or_setters_to_hash, getters_to_hash, #html_view?, #include_errors?, setters_to_hash, #site, #true

Methods included from Presentable

#after_initialize, #as_json, #attributes=, #getters, #initialize, #property_options, #setters

Instance Method Details

#as_json_for_html_viewObject

custom as_json ##



43
44
45
# File 'app/presenters/locomotive/site_presenter.rb', line 43

def as_json_for_html_view
  self.as_json(self.getters - %w(memberships))
end

#domain_nameObject

other getters / setters ##



25
26
27
# File 'app/presenters/locomotive/site_presenter.rb', line 25

def domain_name
  Locomotive.config.domain
end

#membershipsObject



37
38
39
# File 'app/presenters/locomotive/site_presenter.rb', line 37

def memberships
  self.__source.memberships.map { |membership| membership.as_json(self.__options) }
end

#nameObject

properties ##



6
# File 'app/presenters/locomotive/site_presenter.rb', line 6

property    :name

#timezoneObject



29
30
31
# File 'app/presenters/locomotive/site_presenter.rb', line 29

def timezone
  self.__source.timezone_name
end

#timezone=(timezone) ⇒ Object



33
34
35
# File 'app/presenters/locomotive/site_presenter.rb', line 33

def timezone=(timezone)
  self.__source.timezone_name = timezone
end