<commit_before>- content_for(:javascripts) do
  :plain
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  :javascript
    dojo.require("dijit.Dialog");
    dojo.require("dojox.grid.EnhancedGrid");
    dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
    dojo.require("dojox.grid.enhanced.plugins.Filter");
    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dijit.layout.TabContainer");
    dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
    dojo.require ("voeis.Server")
    var projectsDataStore = voeis.Server.DEFAULT.projectsDataStore();
    var projectStore = dojo.store.JsonRest({target: "#{root_url}projects.json?"});
    //var Sitestore = voeis.Server.DEFAULT.projectSitesDataStore('#{@project.id}');
    //var item = projectStore.get('id=#{@project.id}');
    //dojo.addOnLoad(function(){
    //  dijit.byId('split_map').store.add(item.results[0][0]);
    //});
    
    var pmap;
    var pmarkers = [];
    var site_data = [
      #{@sites.map{|site| "        "+site.to_json}.join(",\n")}
    ];
    var site_stats = [
      #{@sites_data.map{|site| "        "+site.to_json}.join(",\n")}
    ];
    for(var i=0;i<site_data.length;i++) {
      site_data[i]['data_vars'] = site_stats[i].vars;
      site_data[i]['data_count'] = site_stats[i].count;
      site_data[i]['data_start'] = site_stats[i].first;
      site_data[i]['data_end'] = site_stats[i].last;
    };
    var psites_json = {
        identifier: 'id',
        label: 'name',
        items: site_data };
    function pmap_init() {
      var map_opts = {
        scaleControl: true, 
        zoomControl: true, 
        mapTypeControl: true, 
        scrollwheel: true, 
        mapTypeId: google.maps.MapTypeId.SATELLITE, 
        center: new google.maps.LatLng(46.739861,-110.786133), 
        zoom: 4};
      pmap = new google.maps.Map(document.getElementById("#{@project.id}"), map_opts);
      var bounds = new google.maps.LatLngBounds();
      for(var i=0;i<site_data.length;i++) {
        var item = site_data[i];
        var stats = site_stats[i];
        var point = new google.maps.LatLng(item.latitude, item.longitude);
        var marker = new google.maps.Marker({map:pmap, position:point});
        var link = '<a href="'+(window.location+'/sites/'+item.id)+'"><strong>'+item.name+'</strong></a>';
        var name = '<strong>'+item.name+'</strong>';
        marker.idx = i;
        marker.info = '<p style="margin:0 15px;">';
        marker.info += link+'<br/>(click for Site details)<br/>';
        marker.info += '&nbsp;&nbsp; code: '+item.code+'<br/>';
        marker.info += '&nbsp;&nbsp; Lat/Long: '+item.latitude+', '+item.longitude;
        marker.info += '<br/>&nbsp;&nbsp; variables: '+stats.vars+' &mdash; ';
        marker.info += 'data collected: '+stats.count+'<br/>';
        marker.info += '&nbsp;&nbsp; starting: '+stats.first+' &mdash; ending: '+stats.last+'<br/>';
        //marker.info += item.code+'<br/>Elevation: '+item.elevation_m+'<br/>'
        //marker.info += item.county+', '+item.state+'</p>';
        marker.info += '</p>';
        marker.window = new google.maps.InfoWindow({content:marker.info});
        marker.pop = function() {
          for(var j=0;j<pmarkers.length;j++) 
            pmarkers[j].window.close();
          this.window.open(pmap,this);
        };<commit_msg>Project Show page: further refinement on mapping markers -- change color on select and nicer text in balloons<commit_after>- content_for(:javascripts) do
  :plain
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  :javascript
    dojo.require("dijit.Dialog");
    dojo.require("dojox.grid.EnhancedGrid");
    dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
    dojo.require("dojox.grid.enhanced.plugins.Filter");
    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dijit.layout.TabContainer");
    dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
    dojo.require ("voeis.Server")
    var projectsDataStore = voeis.Server.DEFAULT.projectsDataStore();
    var projectStore = dojo.store.JsonRest({target: "#{root_url}projects.json?"});
    //var Sitestore = voeis.Server.DEFAULT.projectSitesDataStore('#{@project.id}');
    //var item = projectStore.get('id=#{@project.id}');
    //dojo.addOnLoad(function(){
    //  dijit.byId('split_map').store.add(item.results[0][0]);
    //});
    
    var pmap;
    var pmarkers = [];
    var icon_red = 'http://www.google.com/intl/en_us/mapfiles/ms/icons/red-dot.png';
    var icon_blue = 'http://www.google.com/intl/en_us/mapfiles/ms/icons/blue-dot.png';
    var icon_default = icon_red;
    var icon_pop = icon_blue;
    var site_data = [
      #{@sites.map{|site| "        "+site.to_json}.join(",\n")}
    ];
    var site_stats = [
      #{@sites_data.map{|site| "        "+site.to_json}.join(",\n")}
    ];
    for(var i=0;i<site_data.length;i++) {
      site_data[i]['data_vars'] = site_stats[i].vars;
      site_data[i]['data_count'] = site_stats[i].count;
      site_data[i]['data_start'] = site_stats[i].first;
      site_data[i]['data_end'] = site_stats[i].last;
    };
    var psites_json = {
        identifier: 'id',
        label: 'name',
        items: site_data };
    function pmap_init() {
      var map_opts = {
        scaleControl: true, 
        zoomControl: true, 
        mapTypeControl: true, 
        scrollwheel: true, 
        mapTypeId: google.maps.MapTypeId.SATELLITE, 
        center: new google.maps.LatLng(46.739861,-110.786133), 
        zoom: 4};
      pmap = new google.maps.Map(document.getElementById("#{@project.id}"), map_opts);
      var bounds = new google.maps.LatLngBounds();
      for(var i=0;i<site_data.length;i++) {
        var item = site_data[i];
        var stats = site_stats[i];
        var point = new google.maps.LatLng(item.latitude, item.longitude);
        var marker = new google.maps.Marker({map:pmap, position:point, icon:icon_default});
        var link = '<a href="'+(window.location+'/sites/'+item.id)+'"><strong>'+item.name+'</strong></a>';
        var name = '<strong>'+item.name+'</strong>';
        marker.idx = i;
        marker.info = '<p style="margin:0 15px;">';
        marker.info += link+'<br/>(click for Site details)<br/>';
        marker.info += '&nbsp;&nbsp; <strong>Code:</strong> '+item.code+'<br/>';
        marker.info += '&nbsp;&nbsp; <strong>Lat/Long:</strong> '+item.latitude+', '+item.longitude;
        marker.info += '<br/>&nbsp;&nbsp; <strong>Variables:</strong> '+stats.vars+' &mdash; ';
        marker.info += '<strong>Data collected:</strong> '+stats.count+'<br/>';
        marker.info += '&nbsp;&nbsp; <strong>Starting:</strong> '+stats.first;
        marker.info += ' &mdash; <strong>Ending:</strong> '+stats.last+'<br/>';
        //marker.info += item.code+'<br/>Elevation: '+item.elevation_m+'<br/>'
        //marker.info += item.county+', '+item.state+'</p>';
        marker.info += '</p>';
        marker.window = new google.maps.InfoWindow({content:marker.info});
        marker.pop = function() {
          // this.setIcon(); this.getIcon();
          for(var j=0;j<pmarkers.length;j++) {
            pmarkers[j].window.close();
            pmarkers[j].setIcon(icon_default);
          };
          this.setIcon(icon_pop);
          this.window.open(pmap,this);
        };
{'fraction_non_alphanumeric': 0.19379739978331528, 'fraction_numerical': 0.007042253521126761, 'mean_word_length': 3.0333151283451665, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6625007', 'n_tokens_mistral': 2589, 'n_tokens_neox': 2527, 'n_words': 368}