mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 09:31:43 -05:00
consistency on posts parameters callback: posts.parameters
This commit is contained in:
parent
9fb82628d2
commit
4ccbf6148b
5 changed files with 9 additions and 13 deletions
|
@ -528,7 +528,7 @@ function addSearchQueryParameter (parameters, terms) {
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
Telescope.callbacks.add("postsParameters", addSearchQueryParameter);
|
Telescope.callbacks.add("posts.parameters", addSearchQueryParameter);
|
||||||
```
|
```
|
||||||
|
|
||||||
The callback takes two arguments: the current MongoDB `parameters` (an object with a `selector` and `options` properties), and the `terms` extracted from the URL.
|
The callback takes two arguments: the current MongoDB `parameters` (an object with a `selector` and `options` properties), and the `terms` extracted from the URL.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Telescope from 'meteor/nova:lib';
|
import Telescope from 'meteor/nova:lib';
|
||||||
import Categories from "./collection.js";
|
import Categories from "./collection.js";
|
||||||
|
|
||||||
// Category Parameter
|
// Category Posts Parameters
|
||||||
// Add a "categories" property to terms which can be used to filter *all* existing Posts views.
|
// Add a "categories" property to terms which can be used to filter *all* existing Posts views.
|
||||||
function addCategoryParameter (parameters, terms) {
|
function addCategoryParameter (parameters, terms) {
|
||||||
|
|
||||||
|
@ -32,4 +32,4 @@ function addCategoryParameter (parameters, terms) {
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
Telescope.callbacks.add("postsParameters", addCategoryParameter);
|
Telescope.callbacks.add("posts.parameters", addCategoryParameter);
|
|
@ -20,8 +20,4 @@ Package.onUse(function (api) {
|
||||||
'lib/custom_fields.js'
|
'lib/custom_fields.js'
|
||||||
], ['client', 'server']);
|
], ['client', 'server']);
|
||||||
|
|
||||||
api.addFiles([
|
|
||||||
'lib/server/notifications-server.js'
|
|
||||||
], ['server']);
|
|
||||||
|
|
||||||
});
|
});
|
|
@ -30,8 +30,8 @@ Posts.parameters.get = function (terms) {
|
||||||
options: {}
|
options: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// iterate over postsParameters callbacks
|
// iterate over posts.parameters callbacks
|
||||||
parameters = Telescope.callbacks.run("postsParameters", parameters, _.clone(terms));
|
parameters = Telescope.callbacks.run("posts.parameters", parameters, _.clone(terms));
|
||||||
|
|
||||||
// if sort options are not provided, default to "createdAt" sort
|
// if sort options are not provided, default to "createdAt" sort
|
||||||
if (_.isEmpty(parameters.options.sort)) {
|
if (_.isEmpty(parameters.options.sort)) {
|
||||||
|
@ -62,7 +62,7 @@ function addViewParameter (parameters, terms) {
|
||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
Telescope.callbacks.add("postsParameters", addViewParameter);
|
Telescope.callbacks.add("posts.parameters", addViewParameter);
|
||||||
|
|
||||||
// View Parameter
|
// View Parameter
|
||||||
// Add "after" and "before" properties to terms which can be used to limit posts in time.
|
// Add "after" and "before" properties to terms which can be used to limit posts in time.
|
||||||
|
@ -138,7 +138,7 @@ function addTimeParameter (parameters, terms) {
|
||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
Telescope.callbacks.add("postsParameters", addTimeParameter);
|
Telescope.callbacks.add("posts.parameters", addTimeParameter);
|
||||||
|
|
||||||
// limit the number of items that can be requested at once
|
// limit the number of items that can be requested at once
|
||||||
function limitPosts (parameters, terms) {
|
function limitPosts (parameters, terms) {
|
||||||
|
@ -172,4 +172,4 @@ function limitPosts (parameters, terms) {
|
||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
Telescope.callbacks.add("postsParameters", limitPosts);
|
Telescope.callbacks.add("posts.parameters", limitPosts);
|
||||||
|
|
|
@ -21,4 +21,4 @@ function addSearchQueryParameter (parameters, terms) {
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
Telescope.callbacks.add("postsParameters", addSearchQueryParameter);
|
Telescope.callbacks.add("posts.parameters", addSearchQueryParameter);
|
Loading…
Add table
Reference in a new issue