@@ -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
{
@@ -272,11 +274,63 @@ module.exports = {
272
274
rows : 4 ,
273
275
validator : validators . string
274
276
} ,
277
+ {
278
+ type : "text" ,
279
+ label : "Field with buttons" ,
280
+ model : "address.geo" ,
281
+ disabled : false ,
282
+ get ( model ) {
283
+ if ( model && model . address && model . address . geo )
284
+ return model . address . geo . latitude + ", " + model . address . geo . longitude ;
285
+ } ,
286
+ set ( model , val ) {
287
+ let values = val . split ( "," ) ;
288
+ if ( ! model . address )
289
+ model . address = { } ;
290
+ if ( ! model . address . geo )
291
+ model . address . geo = { } ;
292
+ if ( values . length > 0 && values [ 0 ] . trim ( ) != "" )
293
+ model . address . geo . latitude = parseFloat ( values [ 0 ] . trim ( ) ) ;
294
+ else
295
+ model . address . geo . latitude = 0
296
+ if ( values . length > 1 && values [ 1 ] . trim ( ) != "" )
297
+ model . address . geo . longitude = parseFloat ( values [ 1 ] . trim ( ) ) ;
298
+ else
299
+ model . address . geo . longitude = 0
300
+ } ,
301
+ buttons : [ {
302
+ classes : "btn-location" ,
303
+ label : "Current location" ,
304
+ onclick : function ( model ) {
305
+ if ( navigator . geolocation ) {
306
+ navigator . geolocation . getCurrentPosition ( ( pos ) => {
307
+ if ( ! model . address )
308
+ model . address = { } ;
309
+ if ( ! model . address . geo )
310
+ model . address . geo = { } ;
311
+ model . address . geo . latitude = pos . coords . latitude . toFixed ( 5 ) ;
312
+ model . address . geo . longitude = pos . coords . longitude . toFixed ( 5 ) ;
313
+ } ) ;
314
+ } else {
315
+ alert ( "Geolocation is not supported by this browser." ) ;
316
+ }
317
+ }
318
+ } , {
319
+ classes : "btn-clear" ,
320
+ label : "Clear" ,
321
+ onclick : function ( model ) {
322
+ model . address . geo = {
323
+ latitude : 0 ,
324
+ longitude : 0
325
+ } ;
326
+ }
327
+ } ]
328
+ } ,
275
329
{
276
330
type : "staticMap" ,
277
331
label : "Map" ,
278
332
model : "address.geo" ,
279
- visible : true ,
333
+ visible : false ,
280
334
staticMapOptions : {
281
335
lat : "latitude" ,
282
336
lng : "longitude" ,
@@ -503,7 +557,7 @@ module.exports = {
503
557
format : "YYYY-MM-DD"
504
558
} ,
505
559
onChanged ( model , newVal , oldVal , field ) {
506
- model . age = moment ( ) . year ( ) - moment ( newVal ) . year ( ) ;
560
+ // model.age = moment().year() - moment(newVal).year();
507
561
}
508
562
} ,
509
563
{
0 commit comments