Class: Ezframe::TextType
Direct Known Subclasses
BirthdayType, DateType, DatetimeType, EmailType, IntType, JpnameType, KatakanaType, PasswordType, TelType, TextareaType, TimeType, UrlType, ZipcodeType
Instance Attribute Summary
Attributes inherited from TypeBase
#attribute, #error, #parent
Instance Method Summary
collapse
Methods inherited from TypeBase
#db_value, get_class, #initialize, #key, #label, #make_error_box, #multi_inputs?, #no_edit?, #no_view?, #type, type_name, #use_view_format, #validate, #value, #view
Instance Method Details
141
142
143
|
# File 'lib/ezframe/column_type.rb', line 141
def db_type
return "text"
end
|
131
132
133
134
135
136
137
138
139
|
# File 'lib/ezframe/column_type.rb', line 131
def form(opts = {})
return nil if no_edit? && !opts[:force]
key = self.key
key ="#{key}#{opts[:key_suffix]}" if opts[:key_suffix]
h = Ht.input(type: "text", name: key, label: @attribute[:label], value: @value || "")
h[:class] = @attribute[:class] if @attribute[:class]
h[:after] = make_error_box(key)
return h
end
|
#normalize(val) ⇒ Object
118
119
120
121
122
123
124
125
|
# File 'lib/ezframe/column_type.rb', line 118
def normalize(val)
return nil unless val
val = val.dup.to_s
val.gsub!(/ /, " ")
val.strip!
return val
end
|
#value=(val) ⇒ Object
127
128
129
|
# File 'lib/ezframe/column_type.rb', line 127
def value=(val)
@value = normalize(val)
end
|