Class: Ferro::Combo::PullDown

Inherits:
BaseElement show all
Defined in:
opal/opal-ferro/elements/ferro_combos.js.rb

Overview

Creates a simple pull-down menu. Specify option :title to set the menu title text. Specify option :items as an Array of Ferro classes. Each class should be something clickable, for instance a FormBlock. These classes will be instanciated by this element.

Constant Summary

Constants included from Elementary

Elementary::RESERVED_NAMES

Instance Attribute Summary

Attributes inherited from BaseElement

#children, #domtype, #element, #parent, #sym

Instance Method Summary collapse

Methods inherited from BaseElement

#add_state, #add_states, #classify_state, #component, #dom_id, #factory, #get_text, #html, #initialize, #option_replace, #remove_attribute, #root, #router, #set_attribute, #set_text, #state_active?, #toggle_state, #update_state, #value, #value=

Methods included from Elementary

#_stylize, #add_child, #after_create, #before_create, #create, #creation, #destroy, #each_child, #forget_children, #method_missing, #remove_child, #style, #symbolize

Constructor Details

This class inherits a constructor from Ferro::BaseElement

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ferro::Elementary

Instance Method Details

#_after_createObject

Internal method.



89
90
91
92
# File 'opal/opal-ferro/elements/ferro_combos.js.rb', line 89

def _after_create
  add_state :pull_down_open
  super
end

#_before_createObject

Internal method.



82
83
84
85
86
# File 'opal/opal-ferro/elements/ferro_combos.js.rb', line 82

def _before_create
  @title_text = option_replace :title, '='
  @items      = option_replace :items, []
  super
end

#cascadeObject

Internal method.



95
96
97
98
# File 'opal/opal-ferro/elements/ferro_combos.js.rb', line 95

def cascade
  add_child :title, PullDownTitle, { content: @title_text }
  add_child :items, PullDownItems, { items:   @items }
end