Class: Voom::Presenters::DSL::Components::List
- Includes:
- Mixins::Append, Mixins::Attaches, Mixins::Content, Mixins::Event
- Defined in:
- lib/voom/presenters/dsl/components/list.rb
Instance Attribute Summary collapse
-
#border ⇒ Object
readonly
Returns the value of attribute border.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#components ⇒ Object
Returns the value of attribute components.
-
#dense ⇒ Object
readonly
Returns the value of attribute dense.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#lines_only ⇒ Object
readonly
Returns the value of attribute lines_only.
-
#selectable ⇒ Object
readonly
Returns the value of attribute selectable.
-
#total_lines ⇒ Object
readonly
Returns the value of attribute total_lines.
Attributes included from Mixins::Event
Attributes inherited from Base
#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type
Instance Method Summary collapse
- #add_select_control!(text) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ List
constructor
A new instance of List.
- #line(text = nil, **attribs, &block) ⇒ Object
- #separator(**attribs, &block) ⇒ Object
Methods included from Mixins::Event
Methods included from Mixins::Attaches
Methods included from Namespace
Methods included from Mixins::Append
Methods included from Mixins::Content
Methods inherited from Base
Methods included from Pluggable
#include_plugins, #plugin, #plugin_module
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ List
Returns a new instance of List.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 14 def initialize(**attribs_, &block) super(type: :list, **attribs_, &block) @color = attribs.delete(:color) { nil } @border = attribs.delete(:border) { nil } @lines_only = attribs.delete(:lines_only) { false } @selectable = attribs.delete(:selectable) { false } @dense = attribs.delete(:dense) { false } @lines = [] @components = [] @total_lines = attribs.delete(:total_lines) || 0 add_select_control!( attribs.fetch(:select_control_label) { 'Select All' } ) end |
Instance Attribute Details
#border ⇒ Object (readonly)
Returns the value of attribute border.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def border @border end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def color @color end |
#components ⇒ Object
Returns the value of attribute components.
12 13 14 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 12 def components @components end |
#dense ⇒ Object (readonly)
Returns the value of attribute dense.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def dense @dense end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def lines @lines end |
#lines_only ⇒ Object (readonly)
Returns the value of attribute lines_only.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def lines_only @lines_only end |
#selectable ⇒ Object (readonly)
Returns the value of attribute selectable.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def selectable @selectable end |
#total_lines ⇒ Object (readonly)
Returns the value of attribute total_lines.
11 12 13 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 11 def total_lines @total_lines end |
Instance Method Details
#add_select_control!(text) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/voom/presenters/dsl/components/list.rb', line 29 def add_select_control!(text) return unless @selectable && !@lines_only @lines << Lists::Header.new(parent: self, total_lines: @total_lines, checkbox: {text: text, dirtyable: false}) end |