Skip to content

Commit

Permalink
Merge pull request #702 from okfn/702-recline-filters
Browse files Browse the repository at this point in the history
Recline datastore backend implementation incomplete (Fixes: #702)
  • Loading branch information
nigelbabu committed Apr 16, 2013
2 parents 08da6c7 + cafdb79 commit 2c42502
Show file tree
Hide file tree
Showing 7 changed files with 336 additions and 168 deletions.
6 changes: 3 additions & 3 deletions ckanext/reclinepreview/theme/public/preview_recline.js
Expand Up @@ -15,7 +15,7 @@ this.ckan.module('reclinepreview', function (jQuery, _) {
jQuery.proxyAll(this, /_on/);
this.el.ready(this._onReady);
// hack to make leaflet use a particular location to look for images
L.Icon.Default.imagePath = this.options.site_url + 'vendor/leaflet/0.4.4/images'
L.Icon.Default.imagePath = this.options.site_url + 'vendor/leaflet/0.4.4/images';
},

_onReady: function() {
Expand Down Expand Up @@ -125,9 +125,9 @@ this.ckan.module('reclinepreview', function (jQuery, _) {

var sidebarViews = [
{
id: 'filterEditor',
id: 'valueFilter',
label: 'Filters',
view: new recline.View.FilterEditor({
view: new recline.View.ValueFilter({
model: dataset
})
}
Expand Down
12 changes: 12 additions & 0 deletions ckanext/reclinepreview/theme/public/vendor/recline/recline.css
Expand Up @@ -395,6 +395,18 @@ div.data-table-cell-content-numeric > a.data-table-cell-edit {
width: 175px;
}

.recline-filter-editor input {
margin-top: 0.5em;
}

.recline-filter-editor .add-filter {
margin-top: 1em;
margin-bottom: 2em;
}

.recline-filter-editor .update-filter {
margin-top: 1em;
}

/**********************************************************
* Fields Widget
Expand Down
Expand Up @@ -55,8 +55,8 @@ my.Dataset = Backbone.Model.extend({
if (this.backend !== recline.Backend.Memory) {
this.backend.fetch(this.toJSON())
.done(handleResults)
.fail(function(arguments) {
dfd.reject(arguments);
.fail(function(args) {
dfd.reject(args);
});
} else {
// special case where we have been given data directly
Expand All @@ -79,8 +79,8 @@ my.Dataset = Backbone.Model.extend({
.done(function() {
dfd.resolve(self);
})
.fail(function(arguments) {
dfd.reject(arguments);
.fail(function(args) {
dfd.reject(args);
});
}

Expand Down Expand Up @@ -198,9 +198,9 @@ my.Dataset = Backbone.Model.extend({
self.trigger('query:done');
dfd.resolve(self.records);
})
.fail(function(arguments) {
self.trigger('query:fail', arguments);
dfd.reject(arguments);
.fail(function(args) {
self.trigger('query:fail', args);
dfd.reject(args);
});
return dfd.promise();
},
Expand Down Expand Up @@ -309,9 +309,11 @@ my.Record = Backbone.Model.extend({
//
// For the provided Field get the corresponding rendered computed data value
// for this record.
//
// NB: if field is undefined a default '' value will be returned
getFieldValue: function(field) {
val = this.getFieldValueUnrendered(field);
if (field.renderer) {
if (field && !_.isUndefined(field.renderer)) {
val = field.renderer(val, field, this.toJSON());
}
return val;
Expand All @@ -321,7 +323,12 @@ my.Record = Backbone.Model.extend({
//
// For the provided Field get the corresponding computed data value
// for this record.
//
// NB: if field is undefined a default '' value will be returned
getFieldValueUnrendered: function(field) {
if (!field) {
return '';
}
var val = this.get(field.id);
if (field.deriver) {
val = field.deriver(val, field, this);
Expand Down Expand Up @@ -443,7 +450,7 @@ my.Field = Backbone.Model.extend({
if (val && typeof val === 'string') {
val = val.replace(/(https?:\/\/[^ ]+)/g, '<a href="$1">$1</a>');
}
return val
return val;
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2c42502

Please sign in to comment.