diff --git a/demos/search/app.js b/demos/search/app.js index e9d4536d..df2f9bfc 100644 --- a/demos/search/app.js +++ b/demos/search/app.js @@ -74,6 +74,7 @@ var SearchView = Backbone.View.extend({
\
\
\ +

records found

\
\ \
\ @@ -99,6 +100,8 @@ var SearchView = Backbone.View.extend({ }); this.el.html(html); + this.el.find('.total span').text(this.model.recordCount); + var view = new recline.View.FacetViewer({ model: this.model }); @@ -138,8 +141,9 @@ function setupMoreComplexExample(config) { }, {silent: true} ); - if (dataset.get('url').indexOf('openspending') != -1) { - dataset.queryState.addFacet('dataset'); + if (dataset.get('url') in templates) { + // for gdocs example + dataset.queryState.addFacet('cause'); } dataset.query(); }); @@ -153,6 +157,7 @@ var templates = { {{#data}} \
  • {{key}}: {{value}}
  • \ {{/data}} \ + \
    \ '; var data = _.map(_.keys(record), function(key) { @@ -171,8 +176,9 @@ var templates = { \ \
    \ '; var data = []; @@ -186,6 +192,27 @@ var templates = { amount_formatted: formatAmount(record['amount']), data: data }); + }, + 'https://docs.google.com/spreadsheet/ccc?key=0Aon3JiuouxLUdExXSTl2Y01xZEszOTBFZjVzcGtzVVE': function(record) { + var template = '
    \ +

    \ + {{record.incidentsite}} – {{record.datereported}} – {{record.estimatedspillvolumebbl}} barrels \ +

    \ + \ +
    \ + '; + var data = []; + _.each(_.keys(record), function(key) { + data.push({ key: key, value: record[key] }); + }); + return Mustache.render(template, { + record: record, + data: data + }); } } diff --git a/demos/search/index.html b/demos/search/index.html index d7e3dda7..a26646b6 100644 --- a/demos/search/index.html +++ b/demos/search/index.html @@ -73,6 +73,11 @@ ul.facet-items { list-style-type: none; margin-left: 0; } + +.record ul { + list-style-type: none; + margin-left: 0; +}