kiss 1.8 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/data/scaffold.tgz +0 -0
- data/lib/kiss/form/field.rb +3 -3
- data/lib/kiss/format.rb +7 -3
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8
|
1
|
+
1.8.1
|
data/data/scaffold.tgz
CHANGED
Binary file
|
data/lib/kiss/form/field.rb
CHANGED
@@ -106,7 +106,7 @@ class Kiss
|
|
106
106
|
def value_string
|
107
107
|
return param if param
|
108
108
|
v = self.value
|
109
|
-
v
|
109
|
+
v /= @_factor if v && @_factor
|
110
110
|
value_to_s(v)
|
111
111
|
end
|
112
112
|
|
@@ -140,10 +140,10 @@ class Kiss
|
|
140
140
|
|
141
141
|
begin
|
142
142
|
p = @_format.validate(param, @_form.context)
|
143
|
-
p *= @_factor if @_factor
|
143
|
+
p *= @_factor if p && @_factor
|
144
144
|
value = p
|
145
145
|
rescue Kiss::Format::ValidateError => e
|
146
|
-
return add_error("#{e.message
|
146
|
+
return add_error("#{label.capitalize} #{e.message}.")
|
147
147
|
end
|
148
148
|
|
149
149
|
if @_min_value_size && value.size < @_min_value_size
|
data/lib/kiss/format.rb
CHANGED
@@ -137,7 +137,7 @@ class Kiss
|
|
137
137
|
value
|
138
138
|
end
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
def value_to_s(value, context = {})
|
142
142
|
convert_value_utc_to_local(value, context).strftime("%m/%d/%Y %I:%M %p").gsub(/0(\d[\:\/])/, '\1')
|
143
143
|
end
|
@@ -155,15 +155,19 @@ class Kiss
|
|
155
155
|
@_input_width = 80
|
156
156
|
|
157
157
|
def self.value_to_s(value, context = {})
|
158
|
-
value.strftime("%m/%d/%Y")
|
158
|
+
convert_value_utc_to_local(value, context).strftime("%m/%d/%Y").gsub(/0(\d[\:\/])/, '\1')
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
162
|
class Time < DateTime
|
163
|
-
@_regexp = /\A\d
|
163
|
+
@_regexp = /\A\d{1,2}(\:\d{2})?\s*[ap]m\Z/i
|
164
164
|
@_error = 'must be a valid time'
|
165
165
|
@_legend = 'h:mm a/pm'
|
166
166
|
@_input_width = 80
|
167
|
+
|
168
|
+
def self.value_to_s(value, context = {})
|
169
|
+
convert_value_utc_to_local(value, context).strftime("%I:%M %p").gsub(/0(\d[\:\/])/, '\1')
|
170
|
+
end
|
167
171
|
end
|
168
172
|
|
169
173
|
class MonthYear < Date
|