Class: Locomotive::ContentEntryPresenter

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

Instance Attribute Summary

Attributes inherited from BasePresenter

#__ability, #__depth

Instance Method Summary collapse

Methods inherited from BasePresenter

#_id, #ability?, #after_initialize, #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

#_labelObject

properties ##



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

properties  :_label, only_getter: true

#as_json_for_html_viewObject



51
52
53
54
# File 'app/presenters/locomotive/content_entry_presenter.rb', line 51

def as_json_for_html_view
  self.__options[:html_view] = true
  as_json_without_custom_fields.merge(self.custom_fields_to_hash)
end

#as_json_with_custom_fieldsObject

other methods ##



45
46
47
# File 'app/presenters/locomotive/content_entry_presenter.rb', line 45

def as_json_with_custom_fields
  as_json_without_custom_fields.merge(self.custom_fields_to_hash)
end

#content_type_slugObject



35
36
37
# File 'app/presenters/locomotive/content_entry_presenter.rb', line 35

def content_type_slug
  self.__source.content_type.slug
end

#errorsObject

other getters / setters ##



31
32
33
# File 'app/presenters/locomotive/content_entry_presenter.rb', line 31

def errors
  super
end

#safe_attributesObject



39
40
41
# File 'app/presenters/locomotive/content_entry_presenter.rb', line 39

def safe_attributes
  self.__source.custom_fields_safe_setters + %w(_slug _visible seo_title meta_keywords meta_description)
end

#set_attributesObject

callbacks ##



27
# File 'app/presenters/locomotive/content_entry_presenter.rb', line 27

set_callback :set_attributes, :after, :set_dynamic_attributes