Skip to content

Instantly share code, notes, and snippets.

@geoffreysmith
Created May 7, 2015 19:19
Show Gist options
  • Save geoffreysmith/43ff607f870249760702 to your computer and use it in GitHub Desktop.
Save geoffreysmith/43ff607f870249760702 to your computer and use it in GitHub Desktop.
var superGet = self.get;
self.get = function (req, userCriteria, optionsArg, callback) {
var options = {};
var filterCriteria = {};
// "Why copy the object like this?" If we don't, we're modifying the
// object that was passed to us, which could lead to side effects
_.merge(options, optionsArg || {});
_.merge(filterCriteria, userCriteria || {});
// need a sort helper key on these fields to normalize the first and last names
// and handle upper/lower case letters. Adding this helper key normalizes the data.
// options.sort = { lastname: 1, firstname: 1 };
options.sort = {title: 1};
return superGet.call(self, req, filterCriteria, options, callback);
};
apos.addLocal('aposMainNav', function () {
var test = app.request;
self.get(test, {}, {}, function (data) {
return self.render('mainnav', data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment