@@ -135,7 +135,9 @@ module.exports = {
135
135
type : "input" ,
136
136
inputType : "range" ,
137
137
label : "Range" ,
138
- model : "age" ,
138
+ model : "rank" ,
139
+ min : 0 ,
140
+ max : 10 ,
139
141
styleClasses : "half-width"
140
142
} ,
141
143
{
@@ -265,11 +267,63 @@ module.exports = {
265
267
rows : 4 ,
266
268
validator : validators . string
267
269
} ,
270
+ {
271
+ type : "text" ,
272
+ label : "Field with buttons" ,
273
+ model : "address.geo" ,
274
+ disabled : false ,
275
+ get ( model ) {
276
+ if ( model && model . address && model . address . geo )
277
+ return model . address . geo . latitude + ", " + model . address . geo . longitude ;
278
+ } ,
279
+ set ( model , val ) {
280
+ let values = val . split ( "," ) ;
281
+ if ( ! model . address )
282
+ model . address = { } ;
283
+ if ( ! model . address . geo )
284
+ model . address . geo = { } ;
285
+ if ( values . length > 0 && values [ 0 ] . trim ( ) != "" )
286
+ model . address . geo . latitude = parseFloat ( values [ 0 ] . trim ( ) ) ;
287
+ else
288
+ model . address . geo . latitude = 0
289
+ if ( values . length > 1 && values [ 1 ] . trim ( ) != "" )
290
+ model . address . geo . longitude = parseFloat ( values [ 1 ] . trim ( ) ) ;
291
+ else
292
+ model . address . geo . longitude = 0
293
+ } ,
294
+ buttons : [ {
295
+ classes : "btn-location" ,
296
+ label : "Current location" ,
297
+ onclick : function ( model ) {
298
+ if ( navigator . geolocation ) {
299
+ navigator . geolocation . getCurrentPosition ( ( pos ) => {
300
+ if ( ! model . address )
301
+ model . address = { } ;
302
+ if ( ! model . address . geo )
303
+ model . address . geo = { } ;
304
+ model . address . geo . latitude = pos . coords . latitude . toFixed ( 5 ) ;
305
+ model . address . geo . longitude = pos . coords . longitude . toFixed ( 5 ) ;
306
+ } ) ;
307
+ } else {
308
+ alert ( "Geolocation is not supported by this browser." ) ;
309
+ }
310
+ }
311
+ } , {
312
+ classes : "btn-clear" ,
313
+ label : "Clear" ,
314
+ onclick : function ( model ) {
315
+ model . address . geo = {
316
+ latitude : 0 ,
317
+ longitude : 0
318
+ } ;
319
+ }
320
+ } ]
321
+ } ,
268
322
{
269
323
type : "staticMap" ,
270
324
label : "Map" ,
271
325
model : "address.geo" ,
272
- visible : true ,
326
+ visible : false ,
273
327
staticMapOptions : {
274
328
lat : "latitude" ,
275
329
lng : "longitude" ,
@@ -496,7 +550,7 @@ module.exports = {
496
550
format : "YYYY-MM-DD"
497
551
} ,
498
552
onChanged ( model , newVal , oldVal , field ) {
499
- model . age = moment ( ) . year ( ) - moment ( newVal ) . year ( ) ;
553
+ // model.age = moment().year() - moment(newVal).year();
500
554
}
501
555
} ,
502
556
{
0 commit comments