[build][m]: regular build of docs and js files.

This commit is contained in:
Rufus Pollock
2012-08-15 12:52:02 +01:00
parent e9ac15629d
commit cc5bb0e343
24 changed files with 1202 additions and 913 deletions

19
dist/recline.css vendored
View File

@@ -17,7 +17,24 @@
margin: auto;
}
/**********************************************************
.flotr-mouse-value {
background-color: #FEE !important;
color: #000000 !important;
opacity: 0.8 !important;
border: 1px solid #fdd !important;
}
.flotr-legend {
border: none !important;
}
.flotr-legend-bg {
display: none;
}
.flotr-legend-color-box {
padding: 5px;
}/**********************************************************
* (Data) Grid
*********************************************************/

View File

@@ -495,10 +495,17 @@ my.Query = Backbone.Model.extend({
_filterTemplates: {
term: {
type: 'term',
// TODO do we need this attribute here?
field: '',
term: ''
},
range: {
type: 'range',
start: '',
stop: ''
},
geo_distance: {
type: 'geo_distance',
distance: 10,
unit: 'km',
point: {
@@ -516,7 +523,8 @@ my.Query = Backbone.Model.extend({
// crude deep copy
var ourfilter = JSON.parse(JSON.stringify(filter));
// not full specified so use template and over-write
if (_.keys(filter).length <= 2) {
// 3 as for 'type', 'field' and 'fieldType'
if (_.keys(filter).length <= 3) {
ourfilter = _.extend(this._filterTemplates[filter.type], ourfilter);
}
var filters = this.get('filters');
@@ -670,8 +678,10 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {};
var numRows = queryObj.size || this.data.length;
var start = queryObj.from || 0;
var results = this.data;
results = this._applyFilters(results, queryObj);
results = this._applyFreeTextQuery(results, queryObj);
// not complete sorting!
_.each(queryObj.sort, function(sortObj) {
var fieldName = _.keys(sortObj)[0];
@@ -695,15 +705,51 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {};
// in place filtering
this._applyFilters = function(results, queryObj) {
_.each(queryObj.filters, function(filter) {
// if a term filter ...
if (filter.type === 'term') {
results = _.filter(results, function(doc) {
return (doc[filter.field] == filter.term);
});
}
var filters = queryObj.filters;
// register filters
var filterFunctions = {
term : term,
range : range,
geo_distance : geo_distance
};
var dataParsers = {
number : function (e) { return parseFloat(e, 10); },
string : function (e) { return e.toString() },
date : function (e) { return new Date(e).valueOf() }
};
// filter records
return _.filter(results, function (record) {
var passes = _.map(filters, function (filter) {
return filterFunctions[filter.type](record, filter);
});
// return only these records that pass all filters
return _.all(passes, _.identity);
});
return results;
// filters definitions
function term(record, filter) {
var parse = dataParsers[filter.fieldType];
var value = parse(record[filter.field]);
var term = parse(filter.term);
return (value === term);
}
function range(record, filter) {
var parse = dataParsers[filter.fieldType];
var value = parse(record[filter.field]);
var start = parse(filter.start);
var stop = parse(filter.stop);
return (value >= start && value <= stop);
}
function geo_distance() {
// TODO code here
}
};
// we OR across fields but AND across terms in query string

774
dist/recline.js vendored

File diff suppressed because it is too large Load Diff