Changeset 176:4e7ecb7437a4

Show
Ignore:
Timestamp:
08/30/08 12:33:19 (2 years ago)
Author:
rgrp
Branch:
default
convert_revision:
svn:10edda23-d834-0410-9182-b00384516d49/trunk@188
Message:

[js/views][s]: (bugfix) fix mapview to work with factlets which do not have a location attribute and (concomitantly) draw these kind of factlets on other views (such as timeline).

  • Details: Currently moovc.BaseView? was written so that only factlets with a location attribute were sent to drawFactlets. This meant factlets without location were not showing up on timeline. Removing this restriction directly broke mapview as it required location attribute.
  • Fixed these issues by adding check in mapview, modifying moovc to send all factlet data to drawFactlets.
  • Tests: added new factlet data (no location) to domain_data.js to test this.
Location:
microfacts/public
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • microfacts/public/behaviour/app/views/mapview.js

    r169 r176  
    7373        }; 
    7474        this.factletsData.each( function(factletData, index) { 
    75             var featureGeoJson = { 
    76                 "type": "Feature", 
    77                 "geometry": factletData.location, 
    78                 "properties": {"factlet": factletData} 
    79             }; 
    80             featureCollection.features.push(featureGeoJson); 
     75            if (factletData.location) { 
     76                var featureGeoJson = { 
     77                    "type": "Feature", 
     78                    "geometry": factletData.location, 
     79                    "properties": {"factlet": factletData} 
     80                }; 
     81                featureCollection.features.push(featureGeoJson); 
     82            } 
    8183        }, this); 
    8284        return featureCollection; 
  • microfacts/public/behaviour/lib/moovc.js

    r174 r176  
    33 
    44    log: function(message) { 
    5         console.log(message); 
     5    //    console.log(message); 
    66    }, 
    77 
     
    3838        }, this); 
    3939        var factletsData = []; 
    40         // what is this doing in here? 
    41         // why test for existence of location? May have date but not location 
    42         this.factlets.each(function (factletObject) { 
    43             if (factletObject.data.location) { 
    44                 factletsData.push(factletObject.data); 
    45             } 
     40        var factletsData = this.factlets.map(function(item) { 
     41            return item.data; 
    4642        }); 
    47         // this.log("Factlet data:"); 
    48         // this.log(factletsData); 
    4943        this.drawFactlets(factletsData); 
    5044    }, 
  • microfacts/public/test/spec/domain_data.js

    r169 r176  
    1717        }, 
    1818        'start': "1870-01-01 00:00:00" 
     19    }, 
     20    // factlet without location 
     21    { 
     22        'id': 103, 
     23        'title': 'Third Factlet', 
     24        'start': "1879-01-01 00:00:00" 
    1925    } 
    2026]; 
     
    2228var factletObjects = [ 
    2329    { 
     30        'id'  : factletsData[0]['id'], 
    2431        'data': factletsData[0] 
    2532    }, 
    2633    { 
     34        'id'  : factletsData[1]['id'], 
    2735        'data': factletsData[1] 
     36    }, 
     37    { 
     38        'id'  : factletsData[2]['id'], 
     39        'data': factletsData[2] 
    2840    } 
    2941];