summaryrefslogtreecommitdiff
path: root/app/node_modules
diff options
context:
space:
mode:
authortwo hustlers proj <jules+okfprojz@okfoc.us>2015-05-27 13:26:30 -0400
committertwo hustlers proj <jules+okfprojz@okfoc.us>2015-05-27 13:26:30 -0400
commitfca99b7846b78393a87c2aa7b91571cbf02530e3 (patch)
treeb041b2c284b2b3233fdeae28e2fbebdae9c2aef6 /app/node_modules
parent1dfbf71af1776bbb913a65d6d9a0c5e6b0fadd46 (diff)
parentfb5c451361916593edf39ed5f3614984dc29a36d (diff)
Merge branch 'twohustlers' of github.com:okfocus/okcms into twohustlers
Diffstat (limited to 'app/node_modules')
-rw-r--r--app/node_modules/okquery/index.js15
-rw-r--r--app/node_modules/okschema/index.js4
2 files changed, 14 insertions, 5 deletions
diff --git a/app/node_modules/okquery/index.js b/app/node_modules/okquery/index.js
index 519bc08..4051f95 100644
--- a/app/node_modules/okquery/index.js
+++ b/app/node_modules/okquery/index.js
@@ -21,6 +21,10 @@ function OKQuery(options) {
if (isobject(query))
query = cloneDeep(query);
+ // Queries are ordered by index by default
+ var sortField = options.sortBy || '__index';
+ var descending = options.descending || false;
+
Object.defineProperty(this, 'resource', {
value: resource,
writable: false,
@@ -40,7 +44,9 @@ function OKQuery(options) {
});
this.get = createQuery(resource, query, {
- default: options.default
+ default: options.default,
+ sortField: sortField,
+ descending : descending
});
}
@@ -53,7 +59,7 @@ function createQuery(resource, query, options) {
} else if (isDynamic(query)) {
query = queryDynamic(resource);
} else if (isSet(query)) {
- query = queryAll(resource);
+ query = queryAll(resource, options.sortField, options.descending);
} else {
query = querySingle(resource, query);
}
@@ -100,10 +106,9 @@ function queryDynamic(resource) {
};
}
-function queryAll(resource) {
+function queryAll(resource, sortField, descending) {
return function() {
- // Always return sorted results
- return resource.sortBy('__index');
+ return resource.sortBy(sortField, descending);
};
}
diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js
index c5a56c4..0079f51 100644
--- a/app/node_modules/okschema/index.js
+++ b/app/node_modules/okschema/index.js
@@ -61,6 +61,10 @@ var types = {
'meta': {
parent: 'string',
assertValid: function(spec, value) {}
+ },
+ 'tag-list': {
+ parent: 'string',
+ assertValid: function(spec, value) {}
}
}