Class: Forms::FileInput

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

Overview

A model-bound <input type="file">, delegating to DaisyUI::FileInput.

Constant Summary

Constants included from PhlexForms::DelegatedField

PhlexForms::DelegatedField::IGNORED_MODIFIERS

Instance Method Summary collapse

Constructor Details

#initialize(*modifiers, name: nil, id: nil, multiple: false, accept: nil, error: false, disabled: false, required: false, full_width: true, **attributes) ⇒ FileInput

Returns a new instance of FileInput.



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

def initialize(*modifiers, name: nil, id: nil, multiple: false, accept: nil,
               error: false, disabled: false, required: false, full_width: true, **attributes)
  @modifiers = normalize_modifiers(modifiers)
  @name = name
  @id = id
  @multiple = multiple
  @accept = accept
  @error = error
  @disabled = disabled
  @required = required
  @full_width = full_width
  @attributes = attributes
  super()
end

Instance Method Details

#view_templateObject



23
24
25
26
27
# File 'lib/forms/file_input.rb', line 23

def view_template
  attrs = binding_attributes(accept: @accept)
  attrs[:multiple] = true if @multiple
  render DaisyUI::FileInput.new(*daisy_modifiers, **attrs)
end