~camptocamp/c2c-geoengine-addons/trunk

« back to all changes in this revision

Viewing changes to base_geoengine/static/src/js/geoengine.js

  • Committer: Guewen Baconnier @ Camptocamp
  • Date: 2012-10-02 15:18:54 UTC
  • mfrom: (68.1.10 geoengine)
  • Revision ID: guewen.baconnier@camptocamp.com-20121002151854-8x8grgs7n1blke15
[FIX] minor style changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
566
566
        },
567
567
        set_value: function(value) {
568
568
            this._super.apply(this, arguments);
569
 
            var self = this;
570
569
            var $input = this.$element.find('input');
571
570
 
572
571
            if (value) {
584
583
                var json = this.make_GeoJSON(coords);
585
584
                this.value = JSON.stringify(json);
586
585
            } else {
587
 
                this.value = false
 
586
                this.value = false;
588
587
            }
589
588
 
590
589
            this._super();
594
593
            try {
595
594
                // get coords to check if floats
596
595
                var coords = this.get_coords();
597
 
                // dumbly parse a json text made from a json
598
 
                // in order to test the whole process
599
 
                // var json = this.make_GeoJSON(coords);
600
 
                // var str_json = JSON.stringify(json)
601
 
                // var geo_point = JSON.parse(str_json);
602
596
 
603
597
                // make sure the two coordinates are set or None
604
598
                this.invalid = (this.required &&
605
 
                  (coords[0] === 0 ||
606
 
                   coords[1] === 0 )
607
 
                  || coords[0] === false && coords[1] !== false
608
 
                  || coords[1] === false && coords[0] !== false);
 
599
                  (coords[0] === 0 || coords[1] === 0 ) ||
 
600
                   coords[0] === false && coords[1] !== false ||
 
601
                   coords[0] !== false && coords[1] === false);
609
602
            } catch(e) {
610
603
                this.invalid = true;
611
604
            }
618
611
 
619
612
        set_value: function (value) {
620
613
            this._super.apply(this, arguments);
621
 
            var show_value = ''
 
614
            var show_value = '';
622
615
            if (value) {
623
616
                var geo_obj = JSON.parse(value);
624
617
                show_value = "(" + geo_obj.coordinates[0] + ", " + geo_obj.coordinates[1] + ")";