Class: Forms::Range

Inherits:
Phlex::HTML
  • Object
show all
Includes:
PhlexForms::DelegatedField
Defined in:
lib/forms/range.rb

Overview

A model-bound range slider, delegating to DaisyUI::Range.

Constant Summary

Constants included from PhlexForms::DelegatedField

PhlexForms::DelegatedField::IGNORED_MODIFIERS

Instance Method Summary collapse

Constructor Details

#initialize(*modifiers, name: nil, id: nil, value: nil, min: 0, max: 100, step: 1, error: false, disabled: false, full_width: true, **attributes) ⇒ Range

Returns a new instance of Range.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/forms/range.rb', line 8

def initialize(*modifiers, name: nil, id: nil, value: nil, min: 0, max: 100,
               step: 1, error: false, disabled: false, full_width: true, **attributes)
  @modifiers = normalize_modifiers(modifiers)
  @name = name
  @id = id
  @value = value
  @min = min
  @max = max
  @step = step
  @error = error
  @disabled = disabled
  @required = false
  @full_width = full_width
  @attributes = attributes
  super()
end

Instance Method Details

#view_templateObject



25
26
27
28
29
30
31
# File 'lib/forms/range.rb', line 25

def view_template
  render DaisyUI::Range.new(
    *daisy_modifiers,
    value: @value, min: @min, max: @max, step: @step,
    **binding_attributes
  )
end