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).



35
36
37
# File 'app/helpers/alchemy/elements_block_helper.rb', line 35

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

#essence(name) ⇒ Object

Return’s the given content’s essence.



53
54
55
# File 'app/helpers/alchemy/elements_block_helper.rb', line 53

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)


47
48
49
# File 'app/helpers/alchemy/elements_block_helper.rb', line 47

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

#ingredient(name) ⇒ Object

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



41
42
43
# File 'app/helpers/alchemy/elements_block_helper.rb', line 41

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

#render(name, *args) ⇒ Object

Renders one of the element’s contents.



29
30
31
# File 'app/helpers/alchemy/elements_block_helper.rb', line 29

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