mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 20:16:39 -04:00
33 lines
830 B
JavaScript
33 lines
830 B
JavaScript
![]() |
/**
|
||
|
* Comment views are filters used for subscribing to and viewing comments
|
||
|
* @namespace Comments.views
|
||
|
*/
|
||
|
Comments.views = {};
|
||
|
|
||
|
/**
|
||
|
* Add a module to a comment view
|
||
|
* @param {string} viewName - The name of the view
|
||
|
* @param {function} [viewFunction] - The function used to calculate query terms. Takes terms and baseParameters arguments
|
||
|
*/
|
||
|
Comments.views.register = function (viewName, viewFunction) {
|
||
|
Comments.views[viewName] = viewFunction;
|
||
|
};
|
||
|
|
||
|
// will be common to all other view unless specific properties are overwritten
|
||
|
Comments.views.baseParameters = {
|
||
|
options: {
|
||
|
limit: 10
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Comments.views.register("postComments", function (terms) {
|
||
|
return {
|
||
|
find: {postId: terms.postId}
|
||
|
};
|
||
|
});
|
||
|
|
||
|
Comments.views.register("userComments", function (terms) {
|
||
|
return {
|
||
|
find: {userId: terms.userId}
|
||
|
};
|
||
|
});
|