Class: Aurita::GUI::File_Field

Inherits:
Form_Field show all
Defined in:
lib/aurita-gui/form/file_field.rb

Overview

Usage:

Like Input_Field, but skipping attribute @value, as file input fields do not support default values (for good reason).

i = File_Field.new(:name => :the_file, 
                   :label => 'Choose file')

Instance Attribute Summary

Attributes inherited from Form_Field

#form, #label, #type, #value

Attributes inherited from Element

#attrib, #content, #parent, #tag, #type

Instance Method Summary collapse

Methods inherited from Form_Field

#disable!, #editable!, #enable!, #readonly!, #readonly?, #readonly_element, #to_s

Methods inherited from Element

#+, #[], #[]=, #clear_floating, #dom_id, #dom_id=, #each, #empty?, #id, #id=, #length, #method_missing, #string, #to_ary

Constructor Details

#initialize(params) ⇒ File_Field

Returns a new instance of File_Field.



17
18
19
20
21
22
# File 'lib/aurita-gui/form/file_field.rb', line 17

def initialize(params)
  params[:tag]  = :input
  params[:type] = :file unless params[:type]
  params.delete(:value)
  super(params)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element

Instance Method Details

#elementObject



23
24
25
# File 'lib/aurita-gui/form/file_field.rb', line 23

def element
  HTML.input(@attrib)
end