Class: Locomotive::EditableElementPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/locomotive/editable_element_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

#block_nameObject



29
30
31
32
33
34
35
# File 'app/presenters/locomotive/editable_element_presenter.rb', line 29

def block_name
  if self.__source.block
    self.labelize(self.__source.block.split('/').last)
  else
    I18n.t('locomotive.pages.form.default_block')
  end
end

#labelObject

other getters / setters ##



21
22
23
# File 'app/presenters/locomotive/editable_element_presenter.rb', line 21

def label
  self.labelize(self.slug)
end

#slugObject

properties ##



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

properties :slug, :block, allow_nil: true

#typeObject



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

def type
  self.__source._type.to_s.demodulize
end