Class: Voom::Presenters::DSL::Components::Slider

Inherits:
Input show all
Defined in:
lib/voom/presenters/dsl/components/slider.rb

Instance Attribute Summary collapse

Attributes inherited from Input

#dirtyable, #disabled, #name

Attributes inherited from EventBase

#event_parent_id

Attributes included from Mixins::Event

#events

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from Input

#validation_error

Methods included from Mixins::Tooltips

#tooltip

Methods included from Mixins::Event

#event

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ Slider

Returns a new instance of Slider.



12
13
14
15
16
17
18
19
20
21
# File 'lib/voom/presenters/dsl/components/slider.rb', line 12

def initialize(**attribs_, &block)
  super(type: :slider, **attribs_, &block)
  @value_min = attribs.delete(:value_min){0}
  @value_max = attribs.delete(:value_max){100}
  @step = attribs.delete(:step){nil}
  @discrete = attribs.delete(:discrete){true}
  @show_tracker_marks = attribs.delete(:show_tracker_marks){false}
  @show_tracker_marks = false unless discrete
  expand!
end

Instance Attribute Details

#discreteObject (readonly)

Returns the value of attribute discrete.



6
7
8
# File 'lib/voom/presenters/dsl/components/slider.rb', line 6

def discrete
  @discrete
end

#show_tracker_marksObject (readonly)

Returns the value of attribute show_tracker_marks.



6
7
8
# File 'lib/voom/presenters/dsl/components/slider.rb', line 6

def show_tracker_marks
  @show_tracker_marks
end

#stepObject (readonly)

Returns the value of attribute step.



6
7
8
# File 'lib/voom/presenters/dsl/components/slider.rb', line 6

def step
  @step
end

#value_maxObject (readonly)

Returns the value of attribute value_max.



6
7
8
# File 'lib/voom/presenters/dsl/components/slider.rb', line 6

def value_max
  @value_max
end

#value_minObject (readonly)

Returns the value of attribute value_min.



6
7
8
# File 'lib/voom/presenters/dsl/components/slider.rb', line 6

def value_min
  @value_min
end

Instance Method Details

#label(text = nil) ⇒ Object



23
24
25
26
# File 'lib/voom/presenters/dsl/components/slider.rb', line 23

def label(text=nil)
  return @label if locked?
  @label = text
end

#value(value = nil) ⇒ Object



28
29
30
31
# File 'lib/voom/presenters/dsl/components/slider.rb', line 28

def value(value=nil)
  return @value if locked?
  @value = value
end