Skip to content

Commit

Permalink
Get Recline table preview working in IE7. Remove leaflet (used for ma…
Browse files Browse the repository at this point in the history
…pping) fornow as it has errors.
  • Loading branch information
davidread committed Jun 20, 2012
1 parent fd75cf3 commit 97a816a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
35 changes: 28 additions & 7 deletions ckanext/dgu/theme/public/scripts/vendor/recline/recline.js
@@ -1,3 +1,24 @@
//IE7 hack
if (!Array.prototype.map)
{
Array.prototype.map = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();

var res = new Array(len);
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
res[i] = fun.call(thisp, this[i], i, this);
}

return res;
};
}

// adapted from https://github.com/harthur/costco. heather rules

var costco = function() {
Expand Down Expand Up @@ -1072,7 +1093,7 @@ my.Graph = Backbone.View.extend({
addSeries: function (idx) {
var data = _.extend({
seriesIndex: idx,
seriesName: String.fromCharCode(idx + 64 + 1),
seriesName: String.fromCharCode(idx + 64 + 1)
}, this.model.toTemplateJSON());

var htmls = $.mustache(this.templateSeriesEditor, data);
Expand All @@ -1097,7 +1118,7 @@ my.Graph = Backbone.View.extend({

toggleHelp: function() {
this.el.find('.editor-info').toggleClass('editor-hide-info');
},
}
});

})(jQuery, recline.View);
Expand Down Expand Up @@ -2330,21 +2351,21 @@ my.DataExplorer = Backbone.View.extend({
view: new my.Grid({
model: this.model,
state: this.state.get('view-grid')
}),
})
}, {
id: 'graph',
label: 'Graph',
view: new my.Graph({
model: this.model,
state: this.state.get('view-graph')
}),
})
}, {
id: 'map',
label: 'Map',
view: new my.Map({
model: this.model,
state: this.state.get('view-map')
}),
})
}];
}
// these must be called after pageViews are created
Expand Down Expand Up @@ -3216,7 +3237,7 @@ this.recline.Backend = this.recline.Backend || {};
} else if (method === 'delete') {
if (model.__type__ == 'Document') {
var url = this._getESUrl(model.dataset);
return this.delete(model.id, url);
return this.delete_(model.id, url);
}
}
},
Expand Down Expand Up @@ -3249,7 +3270,7 @@ this.recline.Backend = this.recline.Backend || {};
// @param {Object} id id of object to delete
// @param {string} url (optional) url for ElasticSearch endpoint (if not
// provided called this._getESUrl()
delete: function(id, url) {
delete_: function(id, url) {
url = url ? url : this._getESUrl();
url += '/' + id;
return this._makeRequest({
Expand Down
6 changes: 1 addition & 5 deletions ckanext/dgu/theme/templates/package/resource_read.html
Expand Up @@ -19,10 +19,7 @@

<py:def function="optional_head">
<!-- data preview -->
<link rel="stylesheet" href="${h.url_for_static('/scripts/vendor/leaflet/0.3.1/leaflet.css')}" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="${h.url_for_static('/scripts/vendor/leaflet/0.3.1/leaflet.ie.css')}" />
<![endif]-->
<!-- leaflet removed for now -->
<link rel="stylesheet" href="${h.url_for_static('/scripts/vendor/recline/css/data-explorer.css')}" />
<link rel="stylesheet" href="${h.url_for_static('/scripts/vendor/recline/css/graph.css')}" />
<link rel="stylesheet" href="${h.url_for_static('/scripts/vendor/recline/css/map.css')}" />
Expand Down Expand Up @@ -257,7 +254,6 @@ <h3>Additional Information</h3>
<script type="text/javascript" src="${h.url_for_static('/scripts/vendor/jquery.mustache/jquery.mustache.js')}"></script>
<script type="text/javascript" src="${h.url_for_static('/scripts/vendor/flot/0.7/jquery.flot.js')}"></script>
<script type="text/javascript" src="${h.url_for_static('/scripts/vendor/flot/0.7/jquery.flot.js')}"></script>
<script type="text/javascript" src="${h.url_for_static('/scripts/vendor/leaflet/0.3.1/leaflet.js')}"></script>
<script src="${h.url_for_static('/scripts/vendor/recline/recline.js')}"></script>

<script type="text/javascript">
Expand Down

0 comments on commit 97a816a

Please sign in to comment.