Class: Alchemy::ElementsBlockHelper::ElementViewHelper

Inherits:
BlockHelper
  • Object
show all
Defined in:
app/helpers/alchemy/elements_block_helper.rb

Overview

Block-level helper class for element views.

Instance Attribute Summary

Attributes inherited from BlockHelper

#helpers, #opts

Instance Method Summary collapse

Methods inherited from BlockHelper

#element, #initialize

Constructor Details

This class inherits a constructor from Alchemy::ElementsBlockHelper::BlockHelper

Instance Method Details

#content(name) ⇒ Object

Returns one of the element’s contents (ie. essence instances).



33
34
35
# File 'app/helpers/alchemy/elements_block_helper.rb', line 33

def content(name)
  element.content_by_name(name)
end

#essence(name) ⇒ Object

Return’s the given content’s essence.



51
52
53
# File 'app/helpers/alchemy/elements_block_helper.rb', line 51

def essence(name)
  content(name).try(:essence)
end

#has?(name) ⇒ Boolean

Returns true if the given content has been filled by the user.

Returns:

  • (Boolean)


45
46
47
# File 'app/helpers/alchemy/elements_block_helper.rb', line 45

def has?(name)
  element.has_ingredient?(name)
end

#ingredient(name) ⇒ Object

Returns the ingredient of one of the element’s contents.



39
40
41
# File 'app/helpers/alchemy/elements_block_helper.rb', line 39

def ingredient(name)
  element.ingredient(name)
end

#render(name, *args) ⇒ Object

Renders one of the element’s contents.



27
28
29
# File 'app/helpers/alchemy/elements_block_helper.rb', line 27

def render(name, *args)
  helpers.render_essence_view_by_name(element, name.to_s, *args)
end