Skip to content
This repository
Browse code

Built for deployment

  • Loading branch information...
commit 01beb1917c16a21533db876a3e18499248eada6f 1 parent 0929123
Samuel Luescher samluescher authored
2  public-build/main.js
1 addition, 1 deletion not shown
8 public-build/styles/data-info.css
@@ -8,18 +8,14 @@
8 8 .data-info .legend .unit, .data-info h5 {
9 9 font-weight: bold;
10 10 }
11   -.data-info .updated {
12   - display: inline-block;
13   - float: right;
14   - color: #666;
15   -}
16 11 .data-info .meta {
17 12 font-size: 11px;
18 13 padding: .2em .75em .4em .75em;
19 14 color: #eee;
20 15 }
21   -.data-info .meta.source {
  16 +.data-info .meta.source, .data-info .meta.source a {
22 17 color: #aaa;
  18 + line-height: 1.5em;
23 19 }
24 20 .data-legend .histogram {
25 21 display: none;
8 public-build/styles/main.css
@@ -2115,18 +2115,14 @@ label[for=step] {
2115 2115 .data-info .legend .unit, .data-info h5 {
2116 2116 font-weight: bold;
2117 2117 }
2118   -.data-info .updated {
2119   - display: inline-block;
2120   - float: right;
2121   - color: #666;
2122   -}
2123 2118 .data-info .meta {
2124 2119 font-size: 11px;
2125 2120 padding: .2em .75em .4em .75em;
2126 2121 color: #eee;
2127 2122 }
2128   -.data-info .meta.source {
  2123 +.data-info .meta.source, .data-info .meta.source a {
2129 2124 color: #aaa;
  2125 + line-height: 1.5em;
2130 2126 }
2131 2127 .data-legend .histogram {
2132 2128 display: none;
2  public-build/views/data-view-base.js
... ... @@ -1 +1 @@
1   -define(["jquery","underscore","backbone","config","utils","d3","lib/color-gradient/color-gradient"],function(e,n,r,i,s,o,u){var a=r.View.extend({tagName:"div",className:"data-inspector",events:{"click .visibility":"visibilityChanged"},initialize:function(e){this.vent=e.vent,this.title=e.mapLayer.pointCollection.title,this.collection=e.collection,this.mapLayer=e.mapLayer,this.colors=[],this.colorType=null,this.featureType=null,this.visible=!0,this.collection.bind("add",this.addOne,this),this.collection.bind("reset",this.addAll,this),n.bindAll(this,"setStateType"),this.vent.bind("setStateType",this.setStateType),n.bindAll(this,"toggleValFormatter"),this.vent.bind("toggleValFormatter",this.toggleValFormatter),n.bindAll(this,"toggleLayerVisibility"),e.vent.bind("toggleLayerVisibility",this.toggleLayerVisibility)},setStateType:function(e,t){if(!t||t!=this.mapLayer.pointCollection._id)return;this.updateStatus();switch(this.mapLayer.pointCollection.status){case DataStatus.COMPLETE:this.showLegend(!0)}if(this.spinner)switch(e){default:this.spinner.stop().fadeIn(0);break;case"complete":this.spinner.stop().fadeOut(300)}},updateStatus:function(){var e="",t="",n=this.mapLayer.pointCollection.progress;switch(this.mapLayer.pointCollection.status){case DataStatus.COMPLETE:if(this.mapLayer.sessionOptions.visible)if(this.collection.fetched){e=__("%(number)i of %(total)i",{number:formatLargeNumber(this.collection.originalCount),total:formatLargeNumber(this.collection.fullCount)}),this.mapLayer.pointCollection.sync&&(e+=' <span class="updated micro">'+__("updated %(date)s",{date:(new Date(this.mapLayer.pointCollection.reduce?this.mapLayer.pointCollection.updatedAt<this.mapLayer.pointCollection.lastReducedAt||!this.mapLayer.pointCollection.lastReducedAt?this.mapLayer.pointCollection.updatedAt:this.mapLayer.pointCollection.lastReducedAt:this.mapLayer.pointCollection.updatedAt)).format(locale.formats.DATE_SHORT)})+"</span>");var r=this.collection.url();e+=' <a target="_blank" class="download-collection '+this.mapLayer.pointCollection._id+'" href="'+r+'"><span class="icon icon-white icon-download half-opacity"></span></a>'}else e="loading…";else e="";break;case DataStatus.IMPORTING:e=__(n?"importing… %(count)s":"importing…",{count:formatLargeNumber(this.mapLayer.pointCollection.progress)});break;case DataStatus.UNREDUCED:case DataStatus.UNREDUCED_INC:e=__("queued for crunching…");break;case DataStatus.REDUCING:if(this.mapLayer.pointCollection.numBusy){var i=Math.floor(n/this.mapLayer.pointCollection.numBusy*100);e=__(n?"crunching… %(percent)s%":"crunching…",{percent:i}),this.$(".progress .bar").css("width",i+"%"),this.$(".progress").show()}else e=__("crunching…",{})}var s=this.$(".status"),o=s.text();e==""?s.hide("fast"):s.show("fast"),s.html(e+(e==""&&o!=""?"&nbsp;":""))},updateToggleState:function(e){var t=this;e==undefined&&(e=t.$(".collapse").is(".in")),e?(t.$(".icon.in-out").removeClass("out"),t.$(".icon.in-out").addClass("in")):(t.$(".icon.in-out").addClass("out"),t.$(".icon.in-out").removeClass("in"))},render:function(){var t=this;e(this.el).html(this.template()),this.$(".status").hide(),e(this.el).addClass(this.mapLayer.pointCollection._id),this.title!=""?dataTitle=this.title:dataTitle="Untitled Data";var n=this.$(".state-indicator");return n.length&&(this.spinner=n.html((new Spinner({radius:4,length:0,width:4,color:"#eee",lines:7,speed:1.5})).spin().el).hide()),this.updateStatus(),this.$(".title").html(dataTitle),this.$(".accordion-toggle").attr("href","#collapse-"+this.className+"-"+this.mapLayer.pointCollection._id),this.$(".collapse").attr("id","collapse-"+this.className+"-"+this.mapLayer.pointCollection._id),this.$(".collapse").on("show",function(e){t.updateToggleState(!0),t.visible||(console.log("set to visible"),t.visible=!0,t.visibilityChanged())}),this.$(".collapse").on("hide",function(){t.updateToggleState(!1)}),app.isMapAdmin()||this.$(".admin-control").remove(),this.setParameters(),this},initHistogram:function(){var t=this,n=t.$(".histogram");n.show();if(!n.length)return;if(!this.histogramData){e.ajax({type:"GET",url:"/api/histogram/"+this.mapLayer.pointCollection._id,success:function(e){t.histogramData=e,t.initHistogram()},error:function(){console.error("failed to fetch histogram")}});return}var r=this.histogramData,i=r.length,s=t.mapLayer.pointCollection.maxVal,a=t.mapLayer.pointCollection.minVal,f=n.innerHeight(),l=n.innerWidth(),c=r[0].y,h=r[0].y,p=[],d=[];for(var v=1;v<i;v++)c=Math.max(c,r[v].y),h=Math.min(h,r[v].y);var m=h!=0?h:1,g=m/c,y;t.mapLayer.options.cropDistribution&&(y=1/f*CROP_DISTRIBUTION_RATIO);var b,w=!y||g>y?c:m*1/y,d=[],E=new u(this.colors),S;for(var v=0;v<i;v++)(b==null||r[v].val<b)&&d.push(r[v].y);n.html("");var x=o.select(n[0]).append("svg").attr("class","chart").attr("width",l).attr("height",f),T=o.scale.linear().domain([h,w]).range([0,f]).clamp(!0),N=l/d.length,C=d.length-1;x.selectAll("rect").data(d).enter().append("rect").attr("x",function(e,t){return t*N}).attr("y",function(e,t){return f-T(e)}).attr("height",T).attr("width",N).style("fill",function(e,t){return E.colorAt(t/C)}),n.append('<span class="graph-max-y">'+w+"</span>")},setParameters:function(){var e=this,t=this.mapLayer.options;this.colors=app.getMapLayer(this.mapLayer._id).getNormalizedColors(),this.colorType=t.colorType,this.featureType=t.featureType,this.visible=t.visible;for(var n in t){var r=this.$("[name="+n+"]");r.length&&(r.val(t[n]),r.change(function(){}))}switch(this.mapLayer.pointCollection.status){case DataStatus.COMPLETE:case DataStatus.UNREDUCED_INC:this.updateLegend(!0);break;default:this.hideLegend()}},showLegend:function(){this.$(".legend").show()},hideLegend:function(){this.$(".legend").hide()},updateLegend:function(n){var r=this;this.visible?(e(this.el).addClass("visible"),e(this.el).removeClass("hidden")):(e(this.el).removeClass("visible"),e(this.el).addClass("hidden")),this.mapLayer.options.description?(this.$(".description").show(),this.$(".description").html(this.mapLayer.options.description)):this.$(".description").hide(),this.mapLayer.pointCollection.source?(this.$(".source").show(),this.$(".source").html(__("Source: %(source)s",this.mapLayer.pointCollection))):this.$(".source").hide();switch(this.colorType){case ColorType.SOLID:this.$(".legend-button").css("background-color",this.colors[0].color);break;case ColorType.PALETTE:case ColorType.LINEAR_GRADIENT:this.$(".legend-button").css("background-color",this.colors[0].color)}for(t in FeatureType)FeatureType[t]==this.featureType?this.$(".legend-button").addClass(FeatureType[t]):this.$(".legend-button").removeClass(FeatureType[t]);var i=this.mapLayer.sessionOptions.valFormatter,s=i.unit,o=function(t){return function(n){return r.vent.trigger("toggleValFormatter",r.mapLayer,t),r.$(".unit-item").removeClass("active"),e(n.currentTarget).addClass("active"),!1}};if(s){var u=[],a=this.mapLayer.sessionOptions.valFormatters,f=this.$(".legend .unit ul");f.html("");for(var l=0;l<a.length;l++){var c=a[l],h='<li class="unit-item'+(a.length>1&&c==i?" active":"")+'">'+(a.length>1?'<a href="#" class="unit-toggle">':"<span>")+c.unit+(a.length>1?"</a>":"</span>")+"</li>",h=e(h);a.length>1&&h.on("click",o(c)),f.append(h)}this.$(".legend .unit").show()}else this.$(".legend .unit").hide();if(n&&this.$(".color-bar").length){this.mapLayer.options.histogram&&this.initHistogram();var p=[];for(var l=0;l<this.colors.length;l++){var d=this.colors[l].color,v=multRGB(d,.85);p.push('<li style="width: '+Math.round(100/this.colors.length*100)/100+'%;">'+'<div class="segment" style="background: '+d+"; background: linear-gradient(top, "+d+" 40%, "+v+" 80%)"+"; background: -webkit-gradient(linear, left top, left bottom, color-stop(.4, "+d+"), color-stop(.8, "+v+"))"+'">'+"</div>"+"</li>")}this.$(".color-bar").html(p.join("")),this.setColorBarLabels()}},toggleValFormatter:function(e,t){if(e!=this.mapLayer)return;this.setColorBarLabels()},setColorBarLabels:function(){var t=this.colors.length>1&&(this.colorType==ColorType.LINEAR_GRADIENT||this.colorType==ColorType.PALETTE),n=this.$(".color-bar .segment"),r=this.mapLayer.sessionOptions.valFormatter,i=!1;for(var s=0;s<this.colors.length;s++){var o;this.colors[s].title?o=this.colors[s].title:(i=!0,t?(o=r.format(this.mapLayer.pointCollection.minVal+this.colors[s].position*(this.mapLayer.pointCollection.maxVal-this.mapLayer.pointCollection.minVal)),s==this.colors.length-1&&this.colors[s].position<1&&(o+="+")):o=r.format(this.mapLayer.pointCollection.minVal)+"–"+r.format(this.mapLayer.pointCollection.maxVal),s==0&&(o=UnitFormat.LEGEND.format({value:o,unit:this.mapLayer.pointCollection.unit}))),e(n[s]).text(o)}i?this.$(".legend .unit").show():this.$(".legend .unit").hide()},addOne:function(e){var t=this},addAll:function(){this.updateStatus()},toggleLayerVisibility:function(t,n,r){var i=this;if(t!=this.mapLayer.pointCollection._id)return;this.visible=n,this.$(".visibility").each(function(){var t=e(this).val();t=Number(t)!=0,t==i.visible?e(this).addClass("active"):e(this).removeClass("active")}),i.visible?(this.$(".icon.visibility.toggle").addClass("icon-eye-open"),this.$(".icon.visibility.toggle").removeClass("icon-eye-close"),e(this.el).show()):(this.$(".icon.visibility.toggle").removeClass("icon-eye-open"),this.$(".icon.visibility.toggle").addClass("icon-eye-close"),r&&e(this.el).hide()),this.updateStatus(),this.updateToggleState()},visibilityChanged:function(t){var n=this;if(t)if(!e(t.currentTarget).hasClass("toggle")){var r=e(t.currentTarget).val();r=Number(r)!=0;if(r==this.visible)return;this.visible=r}else this.visible=!this.visible;this.vent.trigger("toggleLayerVisibility",this.mapLayer.pointCollection._id,this.visible),this.updateLegend(),t&&t.preventDefault()}});return a});
  1 +define(["jquery","underscore","backbone","config","utils","d3","lib/color-gradient/color-gradient"],function(e,n,r,i,s,o,u){var a=r.View.extend({tagName:"div",className:"data-inspector",events:{"click .visibility":"visibilityChanged"},initialize:function(e){this.vent=e.vent,this.title=e.mapLayer.pointCollection.title,this.collection=e.collection,this.mapLayer=e.mapLayer,this.colors=[],this.colorType=null,this.featureType=null,this.visible=!0,this.collection.bind("add",this.addOne,this),this.collection.bind("reset",this.addAll,this),n.bindAll(this,"setStateType"),this.vent.bind("setStateType",this.setStateType),n.bindAll(this,"toggleValFormatter"),this.vent.bind("toggleValFormatter",this.toggleValFormatter),n.bindAll(this,"toggleLayerVisibility"),e.vent.bind("toggleLayerVisibility",this.toggleLayerVisibility)},setStateType:function(e,t){if(!t||t!=this.mapLayer.pointCollection._id)return;this.updateStatus();switch(this.mapLayer.pointCollection.status){case DataStatus.COMPLETE:this.showLegend(!0)}if(this.spinner)switch(e){default:this.spinner.stop().fadeIn(0);break;case"complete":this.spinner.stop().fadeOut(300)}},updateStatus:function(){var e="",t="",n=this.mapLayer.pointCollection.progress;switch(this.mapLayer.pointCollection.status){case DataStatus.COMPLETE:if(this.mapLayer.sessionOptions.visible)if(this.collection.fetched){e=__("%(number)i of %(total)i",{number:formatLargeNumber(this.collection.originalCount),total:formatLargeNumber(this.collection.fullCount)});var r=this.collection.url();e+=' <a target="_blank" class="download-collection '+this.mapLayer.pointCollection._id+'" href="'+r+'"><span class="icon icon-white icon-download half-opacity"></span></a>'}else e="loading…";else e="";break;case DataStatus.IMPORTING:e=__(n?"importing… %(count)s":"importing…",{count:formatLargeNumber(this.mapLayer.pointCollection.progress)});break;case DataStatus.UNREDUCED:case DataStatus.UNREDUCED_INC:e=__("queued for crunching…");break;case DataStatus.REDUCING:if(this.mapLayer.pointCollection.numBusy){var i=Math.floor(n/this.mapLayer.pointCollection.numBusy*100);e=__(n?"crunching… %(percent)s%":"crunching…",{percent:i}),this.$(".progress .bar").css("width",i+"%"),this.$(".progress").show()}else e=__("crunching…",{})}var s=this.$(".status"),o=s.text();e==""?s.hide("fast"):s.show("fast"),s.html(e+(e==""&&o!=""?"&nbsp;":""))},updateToggleState:function(e){var t=this;e==undefined&&(e=t.$(".collapse").is(".in")),e?(t.$(".icon.in-out").removeClass("out"),t.$(".icon.in-out").addClass("in")):(t.$(".icon.in-out").addClass("out"),t.$(".icon.in-out").removeClass("in"))},render:function(){var t=this;e(this.el).html(this.template()),this.$(".status").hide(),e(this.el).addClass(this.mapLayer.pointCollection._id),this.title!=""?dataTitle=this.title:dataTitle="Untitled Data";var n=this.$(".state-indicator");return n.length&&(this.spinner=n.html((new Spinner({radius:4,length:0,width:4,color:"#eee",lines:7,speed:1.5})).spin().el).hide()),this.updateStatus(),this.$(".title").html(dataTitle),this.$(".accordion-toggle").attr("href","#collapse-"+this.className+"-"+this.mapLayer.pointCollection._id),this.$(".collapse").attr("id","collapse-"+this.className+"-"+this.mapLayer.pointCollection._id),this.$(".collapse").on("show",function(e){t.updateToggleState(!0),t.visible||(console.log("set to visible"),t.visible=!0,t.visibilityChanged())}),this.$(".collapse").on("hide",function(){t.updateToggleState(!1)}),app.isMapAdmin()||this.$(".admin-control").remove(),this.setParameters(),this},initHistogram:function(){var t=this,n=t.$(".histogram");n.show();if(!n.length)return;if(!this.histogramData){e.ajax({type:"GET",url:"/api/histogram/"+this.mapLayer.pointCollection._id,success:function(e){t.histogramData=e,t.initHistogram()},error:function(){console.error("failed to fetch histogram")}});return}var r=this.histogramData,i=r.length,s=t.mapLayer.pointCollection.maxVal,a=t.mapLayer.pointCollection.minVal,f=n.innerHeight(),l=n.innerWidth(),c=r[0].y,h=r[0].y,p=[],d=[];for(var v=1;v<i;v++)c=Math.max(c,r[v].y),h=Math.min(h,r[v].y);var m=h!=0?h:1,g=m/c,y;t.mapLayer.options.cropDistribution&&(y=1/f*CROP_DISTRIBUTION_RATIO);var b,w=!y||g>y?c:m*1/y,d=[],E=new u(this.colors),S;for(var v=0;v<i;v++)(b==null||r[v].val<b)&&d.push(r[v].y);n.html("");var x=o.select(n[0]).append("svg").attr("class","chart").attr("width",l).attr("height",f),T=o.scale.linear().domain([h,w]).range([0,f]).clamp(!0),N=l/d.length,C=d.length-1;x.selectAll("rect").data(d).enter().append("rect").attr("x",function(e,t){return t*N}).attr("y",function(e,t){return f-T(e)}).attr("height",T).attr("width",N).style("fill",function(e,t){return E.colorAt(t/C)}),n.append('<span class="graph-max-y">'+w+"</span>")},setParameters:function(){var e=this,t=this.mapLayer.options;this.colors=app.getMapLayer(this.mapLayer._id).getNormalizedColors(),this.colorType=t.colorType,this.featureType=t.featureType,this.visible=t.visible;for(var n in t){var r=this.$("[name="+n+"]");r.length&&(r.val(t[n]),r.change(function(){}))}switch(this.mapLayer.pointCollection.status){case DataStatus.COMPLETE:case DataStatus.UNREDUCED_INC:this.updateLegend(!0);break;default:this.hideLegend()}},showLegend:function(){this.$(".legend").show()},hideLegend:function(){this.$(".legend").hide()},updateLegend:function(n){var r=this;this.visible?(e(this.el).addClass("visible"),e(this.el).removeClass("hidden")):(e(this.el).removeClass("visible"),e(this.el).addClass("hidden")),this.mapLayer.options.description?(this.$(".description").show(),this.$(".description").html(this.mapLayer.options.description)):this.$(".description").hide();if(this.mapLayer.pointCollection.source||this.mapLayer.pointCollection.sync){this.$(".source").show();var i;sourceLink=this.mapLayer.pointCollection.sourceUrl&&this.mapLayer.pointCollection.sourceUrl!=""?'<a href="%(sourceUrl)s">%(source)s</a>'.format(this.mapLayer.pointCollection):this.mapLayer.pointCollection.source,this.mapLayer.pointCollection.source&&(i=__("Source: %(source)s",{source:sourceLink})),this.mapLayer.pointCollection.sync&&(i+=' <span class="updated micro">('+__("updated %(date)s",{date:(new Date(this.mapLayer.pointCollection.reduce?this.mapLayer.pointCollection.updatedAt<this.mapLayer.pointCollection.lastReducedAt||!this.mapLayer.pointCollection.lastReducedAt?this.mapLayer.pointCollection.updatedAt:this.mapLayer.pointCollection.lastReducedAt:this.mapLayer.pointCollection.updatedAt)).format(locale.formats.DATE_SHORT)})+")</span>"),this.$(".source").html(i)}else this.$(".source").hide();switch(this.colorType){case ColorType.SOLID:this.$(".legend-button").css("background-color",this.colors[0].color);break;case ColorType.PALETTE:case ColorType.LINEAR_GRADIENT:this.$(".legend-button").css("background-color",this.colors[0].color)}for(t in FeatureType)FeatureType[t]==this.featureType?this.$(".legend-button").addClass(FeatureType[t]):this.$(".legend-button").removeClass(FeatureType[t]);var s=this.mapLayer.sessionOptions.valFormatter,o=s.unit,u=function(t){return function(n){return r.vent.trigger("toggleValFormatter",r.mapLayer,t),r.$(".unit-item").removeClass("active"),e(n.currentTarget).addClass("active"),!1}};if(o){var a=[],f=this.mapLayer.sessionOptions.valFormatters,l=this.$(".legend .unit ul");l.html("");for(var c=0;c<f.length;c++){var h=f[c],p='<li class="unit-item'+(f.length>1&&h==s?" active":"")+'">'+(f.length>1?'<a href="#" class="unit-toggle">':"<span>")+h.unit+(f.length>1?"</a>":"</span>")+"</li>",p=e(p);f.length>1&&p.on("click",u(h)),l.append(p)}this.$(".legend .unit").show()}else this.$(".legend .unit").hide();if(n&&this.$(".color-bar").length){this.mapLayer.options.histogram&&this.initHistogram();var d=[];for(var c=0;c<this.colors.length;c++){var v=this.colors[c].color,m=multRGB(v,.85);d.push('<li style="width: '+Math.round(100/this.colors.length*100)/100+'%;">'+'<div class="segment" style="background: '+v+"; background: linear-gradient(top, "+v+" 40%, "+m+" 80%)"+"; background: -webkit-gradient(linear, left top, left bottom, color-stop(.4, "+v+"), color-stop(.8, "+m+"))"+'">'+"</div>"+"</li>")}this.$(".color-bar").html(d.join("")),this.setColorBarLabels()}},toggleValFormatter:function(e,t){if(e!=this.mapLayer)return;this.setColorBarLabels()},setColorBarLabels:function(){var t=this.colors.length>1&&(this.colorType==ColorType.LINEAR_GRADIENT||this.colorType==ColorType.PALETTE),n=this.$(".color-bar .segment"),r=this.mapLayer.sessionOptions.valFormatter,i=!1;for(var s=0;s<this.colors.length;s++){var o;this.colors[s].title?o=this.colors[s].title:(i=!0,t?(o=r.format(this.mapLayer.pointCollection.minVal+this.colors[s].position*(this.mapLayer.pointCollection.maxVal-this.mapLayer.pointCollection.minVal)),s==this.colors.length-1&&this.colors[s].position<1&&(o+="+")):o=r.format(this.mapLayer.pointCollection.minVal)+"–"+r.format(this.mapLayer.pointCollection.maxVal),s==0&&(o=UnitFormat.LEGEND.format({value:o,unit:this.mapLayer.pointCollection.unit}))),e(n[s]).text(o)}i?this.$(".legend .unit").show():this.$(".legend .unit").hide()},addOne:function(e){var t=this},addAll:function(){this.updateStatus()},toggleLayerVisibility:function(t,n,r){var i=this;if(t!=this.mapLayer.pointCollection._id)return;this.visible=n,this.$(".visibility").each(function(){var t=e(this).val();t=Number(t)!=0,t==i.visible?e(this).addClass("active"):e(this).removeClass("active")}),i.visible?(this.$(".icon.visibility.toggle").addClass("icon-eye-open"),this.$(".icon.visibility.toggle").removeClass("icon-eye-close"),e(this.el).show()):(this.$(".icon.visibility.toggle").removeClass("icon-eye-open"),this.$(".icon.visibility.toggle").addClass("icon-eye-close"),r&&e(this.el).hide()),this.updateStatus(),this.updateToggleState()},visibilityChanged:function(t){var n=this;if(t)if(!e(t.currentTarget).hasClass("toggle")){var r=e(t.currentTarget).val();r=Number(r)!=0;if(r==this.visible)return;this.visible=r}else this.visible=!this.visible;this.vent.trigger("toggleLayerVisibility",this.mapLayer.pointCollection._id,this.visible),this.updateLegend(),t&&t.preventDefault()}});return a});
9 public/styles/data-info.css
@@ -11,20 +11,15 @@
11 11 font-weight: bold;
12 12 }
13 13
14   -.data-info .updated {
15   - display: inline-block;
16   - float: right;
17   - color: #666;
18   -}
19   -
20 14 .data-info .meta {
21 15 font-size: 11px;
22 16 padding: .2em .75em .4em .75em;
23 17 color: #eee;
24 18 }
25 19
26   -.data-info .meta.source {
  20 +.data-info .meta.source, .data-info .meta.source a {
27 21 color: #aaa;
  22 + line-height: 1.5em;
28 23 }
29 24
30 25 .data-legend .histogram {
30 public/views/data-view-base.js
@@ -77,16 +77,6 @@ define([
77 77 number: formatLargeNumber(this.collection.originalCount),
78 78 total: formatLargeNumber(this.collection.fullCount)
79 79 });
80   - if (this.mapLayer.pointCollection.sync) {
81   - status += ' <span class="updated micro">' + __('updated %(date)s', {
82   - date: new Date(
83   - this.mapLayer.pointCollection.reduce ?
84   - (this.mapLayer.pointCollection.updatedAt < this.mapLayer.pointCollection.lastReducedAt || !this.mapLayer.pointCollection.lastReducedAt ?
85   - this.mapLayer.pointCollection.updatedAt : this.mapLayer.pointCollection.lastReducedAt)
86   - : this.mapLayer.pointCollection.updatedAt)
87   - .format(locale.formats.DATE_SHORT)
88   - }) + '</span>';
89   - }
90 80 var url = this.collection.url();
91 81 status += ' <a target="_blank" class="download-collection ' + this.mapLayer.pointCollection._id +'" href="'
92 82 + url + '"><span class="icon icon-white icon-download half-opacity"></span></a>';
@@ -390,9 +380,25 @@ define([
390 380 this.$('.description').hide();
391 381 }
392 382
393   - if (this.mapLayer.pointCollection.source) {
  383 + if (this.mapLayer.pointCollection.source || this.mapLayer.pointCollection.sync) {
394 384 this.$('.source').show();
395   - this.$('.source').html(__('Source: %(source)s', this.mapLayer.pointCollection));
  385 + var source
  386 + sourceLink = this.mapLayer.pointCollection.sourceUrl && this.mapLayer.pointCollection.sourceUrl != '' ?
  387 + '<a href="%(sourceUrl)s">%(source)s</a>'.format(this.mapLayer.pointCollection) : this.mapLayer.pointCollection.source;
  388 + if (this.mapLayer.pointCollection.source) {
  389 + source = __('Source: %(source)s', {source: sourceLink});
  390 + }
  391 + if (this.mapLayer.pointCollection.sync) {
  392 + source += ' <span class="updated micro">(' + __('updated %(date)s', {
  393 + date: new Date(
  394 + this.mapLayer.pointCollection.reduce ?
  395 + (this.mapLayer.pointCollection.updatedAt < this.mapLayer.pointCollection.lastReducedAt || !this.mapLayer.pointCollection.lastReducedAt ?
  396 + this.mapLayer.pointCollection.updatedAt : this.mapLayer.pointCollection.lastReducedAt)
  397 + : this.mapLayer.pointCollection.updatedAt)
  398 + .format(locale.formats.DATE_SHORT)
  399 + }) + ')</span>';
  400 + }
  401 + this.$('.source').html(source);
396 402 } else {
397 403 this.$('.source').hide();
398 404 }

0 comments on commit 01beb19

Please sign in to comment.
Something went wrong with that request. Please try again.