Class: Storefront::Form::String
- Inherits:
-
Input
show all
- Defined in:
- lib/storefront/components/form/inputs/string.rb
Overview
email attributes: autocomplete, autofocus, list, maxlength, multiple, pattern, placeholder, readonly, required, size password attributes: autocomplete, autofocus, maxlength, pattern, placeholder, readonly, required, size text, search, url, tel attributes: autocomplete, autofocus, list, maxlength, pattern, placeholder, readonly, required, size
Constant Summary
Helpers::ContentHelper::SCOPES, Helpers::ContentHelper::SCOPES_WITH_NAMESPACE, Helpers::ContentHelper::SCOPES_WITH_NAMESPACE_AND_NESTED_MODEL, Helpers::ContentHelper::SCOPES_WITH_NESTED_MODEL
Instance Attribute Summary
#options, #template
Instance Method Summary
collapse
Methods inherited from Input
find, #initialize, registry, #render, resolves?
Methods inherited from Base
#initialize
#aria, #clone_attributes, #dom, #index_class, #merge_class, #merge_class!, #page, #resource_to_title, #title_widget, #title_widget_options
#encoded_contents, #font_face_data_uri, #html5_time, #read_binary_file, #read_image_size, #rendered_text, #sanitize, #t?
#component_name, #extract_classes!, #extract_options!, #initialize, #inside?, #pointer, #render, #render_with_pointer, #to_s
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Storefront::Components::Base
Instance Method Details
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/storefront/components/form/inputs/string.rb', line 62
def autocomplete_input
=begin
default = options[:default]
#attribute = "#{attribute}".gsub(/_id$/, "")
if default.present?
name = default.name rescue ""
else
name = (object.send("#{attribute}".gsub(/_id$/, "")).name || "") rescue ""
end
options[:value] ||= default_id_for(default || object.send("#{attribute}".gsub(/_id$/, "")))
value = User.find_by_id(options[:value])
name = value.name if value
value = value.id if value
result = input(attribute, :as => :hidden, :input_html => {:class => "hidden-autocomplete", :value => value})
options[:input_html] ||= {}
options[:input_html].merge!(:class => "autocomplete-two", :value => name)
result += input("#{attribute}".gsub(/_id$/, ""), options)
result
=end
end
|
58
59
60
|
# File 'lib/storefront/components/form/inputs/string.rb', line 58
def color_input
end
|
46
47
48
|
# File 'lib/storefront/components/form/inputs/string.rb', line 46
def date_input
simple_input :string, :class => "date", "data-type" => "date"
end
|
18
19
20
|
# File 'lib/storefront/components/form/inputs/string.rb', line 18
def email_input
simple_input :email
end
|
42
43
44
|
# File 'lib/storefront/components/form/inputs/string.rb', line 42
def fax_input
simple_input :tel, :class => "phone fax"
end
|
50
51
52
|
# File 'lib/storefront/components/form/inputs/string.rb', line 50
def money_input
simple_input :string, :class => "money", "data-type" => "money"
end
|
26
27
28
|
# File 'lib/storefront/components/form/inputs/string.rb', line 26
def number_input
simple_input :string, :class => "numeric", "data-type" => "numeric"
end
|
30
31
32
|
# File 'lib/storefront/components/form/inputs/string.rb', line 30
def numeric_input
simple_input :string, :class => "numeric", "data-type" => "numeric"
end
|
14
15
16
|
# File 'lib/storefront/components/form/inputs/string.rb', line 14
def password_input
simple_input :password
end
|
54
55
56
|
# File 'lib/storefront/components/form/inputs/string.rb', line 54
def percent_input
simple_input :string, :class => "percent", "data-type" => "percent"
end
|
38
39
40
|
# File 'lib/storefront/components/form/inputs/string.rb', line 38
def phone_input
simple_input :tel, :class => "phone"
end
|
34
35
36
|
# File 'lib/storefront/components/form/inputs/string.rb', line 34
def search_input
simple_input :search, :class => "search", "data-type" => "search"
end
|
autofocus, pattern, placeholder, title, size, data-validate, data-validate-match, data-validate-unique
10
11
12
|
# File 'lib/storefront/components/form/inputs/string.rb', line 10
def string_input
simple_input :string
end
|
22
23
24
|
# File 'lib/storefront/components/form/inputs/string.rb', line 22
def url_input
simple_input :url
end
|