2014-09-18 07:24:42 +09:00
|
|
|
// ------------------------------------- Schemas -------------------------------- //
|
2014-06-22 14:53:17 +09:00
|
|
|
|
2014-07-06 14:09:55 +09:00
|
|
|
// array containing properties to be added to the post/settings/comments schema on startup.
|
2014-06-22 14:53:17 +09:00
|
|
|
addToPostSchema = [];
|
2014-07-06 14:09:55 +09:00
|
|
|
addToCommentsSchema = [];
|
|
|
|
addToSettingsSchema = [];
|
2014-06-22 14:53:17 +09:00
|
|
|
|
2014-09-18 07:24:42 +09:00
|
|
|
// ------------------------------------- Navigation -------------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
// array containing nav items; initialize with views menu and admin menu
|
|
|
|
primaryNav = ['viewsMenu', 'adminMenu'];
|
|
|
|
|
|
|
|
secondaryNav = ['userMenu', 'notificationsMenu', 'submitButton'];
|
|
|
|
|
|
|
|
// array containing items in the admin menu
|
|
|
|
adminNav = [];
|
|
|
|
|
2014-06-22 14:53:17 +09:00
|
|
|
// array containing items in the views menu
|
2014-07-22 11:29:01 +09:00
|
|
|
viewNav = [
|
|
|
|
{
|
|
|
|
route: 'posts_top',
|
2014-11-20 14:55:34 +09:00
|
|
|
label: 'top'
|
2014-07-22 11:29:01 +09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
route: 'posts_new',
|
2014-11-20 14:55:34 +09:00
|
|
|
label: 'new'
|
2014-07-22 11:29:01 +09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
route: 'posts_best',
|
2014-11-20 14:55:34 +09:00
|
|
|
label: 'best'
|
2014-07-22 11:29:01 +09:00
|
|
|
},
|
|
|
|
{
|
2014-11-18 09:22:59 +09:00
|
|
|
route: 'posts_digest_default',
|
2014-11-20 14:55:34 +09:00
|
|
|
label: 'digest'
|
2014-09-18 07:24:42 +09:00
|
|
|
}
|
2014-07-22 11:29:01 +09:00
|
|
|
];
|
2014-06-22 14:53:17 +09:00
|
|
|
|
2014-09-18 07:24:42 +09:00
|
|
|
// ------------------------------------- Views -------------------------------- //
|
2014-08-12 16:16:44 +09:00
|
|
|
|
2014-06-23 12:08:01 +09:00
|
|
|
|
2014-06-23 12:28:40 +09:00
|
|
|
// object containing post list view parameters
|
|
|
|
viewParameters = {}
|
|
|
|
|
2014-07-22 11:29:01 +09:00
|
|
|
viewParameters.top = function (terms) {
|
|
|
|
return {
|
|
|
|
options: {sort: {sticky: -1, score: -1}}
|
|
|
|
};
|
2014-06-23 12:28:40 +09:00
|
|
|
}
|
|
|
|
|
2014-07-22 11:29:01 +09:00
|
|
|
viewParameters.new = function (terms) {
|
|
|
|
return {
|
|
|
|
options: {sort: {sticky: -1, postedAt: -1}}
|
|
|
|
};
|
2014-06-23 12:28:40 +09:00
|
|
|
}
|
|
|
|
|
2014-07-22 11:29:01 +09:00
|
|
|
viewParameters.best = function (terms) {
|
|
|
|
return {
|
|
|
|
options: {sort: {sticky: -1, baseScore: -1}}
|
|
|
|
};
|
2014-06-23 12:28:40 +09:00
|
|
|
}
|
|
|
|
|
2014-07-22 11:29:01 +09:00
|
|
|
viewParameters.pending = function (terms) {
|
|
|
|
return {
|
2014-10-06 10:27:28 +09:00
|
|
|
find: {
|
|
|
|
status: 1,
|
|
|
|
postedAt: {$lte: null}
|
|
|
|
},
|
2014-07-22 11:29:01 +09:00
|
|
|
options: {sort: {createdAt: -1}}
|
|
|
|
};
|
2014-06-23 12:28:40 +09:00
|
|
|
}
|
|
|
|
|
2014-07-22 11:29:01 +09:00
|
|
|
viewParameters.digest = function (terms) {
|
|
|
|
return {
|
2014-06-23 12:28:40 +09:00
|
|
|
find: {
|
2014-07-03 14:26:05 +09:00
|
|
|
postedAt: {
|
2014-06-23 12:28:40 +09:00
|
|
|
$gte: terms.after,
|
|
|
|
$lt: terms.before
|
|
|
|
}
|
|
|
|
},
|
|
|
|
options: {
|
2014-09-11 10:34:43 +09:00
|
|
|
sort: {sticky: -1, baseScore: -1, limit: 0}
|
2014-06-23 12:28:40 +09:00
|
|
|
}
|
2014-07-22 11:29:01 +09:00
|
|
|
};
|
2014-07-04 12:44:36 +09:00
|
|
|
}
|
|
|
|
|
2014-08-05 10:16:05 +09:00
|
|
|
|
|
|
|
heroModules = [];
|
|
|
|
|
2014-09-18 07:24:42 +09:00
|
|
|
footerModules = [];
|
|
|
|
|
2014-07-04 12:44:36 +09:00
|
|
|
// array containing post modules
|
2014-07-05 13:32:01 +09:00
|
|
|
modulePositions = [
|
2014-07-07 13:41:25 +09:00
|
|
|
'left-left',
|
|
|
|
'left-center',
|
|
|
|
'left-right',
|
|
|
|
'center-left',
|
|
|
|
'center-center',
|
|
|
|
'center-right',
|
|
|
|
'right-left',
|
|
|
|
'right-center',
|
|
|
|
'right-right'
|
2014-07-05 13:32:01 +09:00
|
|
|
];
|
|
|
|
|
2014-07-04 12:44:36 +09:00
|
|
|
postModules = [
|
|
|
|
{
|
2014-07-04 14:07:50 +09:00
|
|
|
template: 'postUpvote',
|
2014-07-07 14:36:51 +09:00
|
|
|
position: 'left-left'
|
2014-07-04 12:44:36 +09:00
|
|
|
},
|
|
|
|
{
|
2014-07-14 11:08:38 +09:00
|
|
|
template: 'postActions',
|
|
|
|
position: 'left-right'
|
2014-07-04 12:44:36 +09:00
|
|
|
},
|
2014-07-14 10:12:02 +09:00
|
|
|
{
|
2014-07-14 11:08:38 +09:00
|
|
|
template: 'postContent',
|
|
|
|
position: 'center-center'
|
2014-07-14 10:12:02 +09:00
|
|
|
},
|
2014-07-04 12:44:36 +09:00
|
|
|
{
|
2014-07-04 14:07:50 +09:00
|
|
|
template: 'postDiscuss',
|
2014-07-07 14:36:51 +09:00
|
|
|
position: 'right-right'
|
2014-07-04 12:44:36 +09:00
|
|
|
}
|
2014-07-05 11:24:28 +09:00
|
|
|
];
|
|
|
|
|
2014-07-14 10:12:02 +09:00
|
|
|
postHeading = [
|
|
|
|
{
|
|
|
|
template: 'postTitle',
|
|
|
|
order: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
template: 'postDomain',
|
|
|
|
order: 5
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
postMeta = [
|
|
|
|
{
|
2014-09-12 18:53:49 +09:00
|
|
|
template: 'postInfo',
|
2014-07-14 10:12:02 +09:00
|
|
|
order: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
template: 'postCommentsLink',
|
|
|
|
order: 3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
template: 'postAdmin',
|
|
|
|
order: 5
|
|
|
|
}
|
|
|
|
]
|
2014-07-05 18:06:28 +09:00
|
|
|
// ------------------------------ Callbacks ------------------------------ //
|
|
|
|
|
2014-08-01 09:07:58 +09:00
|
|
|
postSubmitRenderedCallbacks = [];
|
2014-07-05 18:06:28 +09:00
|
|
|
postSubmitClientCallbacks = [];
|
2014-09-20 09:53:58 +09:00
|
|
|
postSubmitMethodCallbacks = [];
|
2014-09-20 10:42:42 +09:00
|
|
|
postAfterSubmitMethodCallbacks = [];
|
2014-07-05 18:06:28 +09:00
|
|
|
|
2014-08-01 09:07:58 +09:00
|
|
|
postEditRenderedCallbacks = [];
|
2014-07-05 18:06:28 +09:00
|
|
|
postEditClientCallbacks = [];
|
2014-09-20 09:53:58 +09:00
|
|
|
postEditMethodCallbacks = []; // not used yet
|
2014-09-20 10:42:42 +09:00
|
|
|
postAfterMethodCallbacks = []; // not used yet
|
2014-07-05 18:06:28 +09:00
|
|
|
|
2014-09-20 09:53:58 +09:00
|
|
|
commentSubmitRenderedCallbacks = [];
|
|
|
|
commentSubmitClientCallbacks = [];
|
|
|
|
commentSubmitMethodCallbacks = [];
|
2014-09-20 10:42:42 +09:00
|
|
|
commentAfterSubmitMethodCallbacks = [];
|
2014-07-05 18:06:28 +09:00
|
|
|
|
2014-09-20 09:53:58 +09:00
|
|
|
commentEditRenderedCallbacks = [];
|
|
|
|
commentEditClientCallbacks = [];
|
|
|
|
commentEditMethodCallbacks = []; // not used yet
|
2014-09-20 10:42:42 +09:00
|
|
|
commentAfterEditMethodCallbacks = []; // not used yet
|
2014-07-05 18:06:28 +09:00
|
|
|
|
|
|
|
// ------------------------------ Dynamic Templates ------------------------------ //
|
|
|
|
|
2014-07-05 11:24:28 +09:00
|
|
|
|
|
|
|
templates = {}
|
|
|
|
|
|
|
|
getTemplate = function (name) {
|
|
|
|
// if template has been overwritten, return this; else return template name
|
|
|
|
return !!templates[name] ? templates[name] : name;
|
|
|
|
}
|
|
|
|
|
2014-08-15 12:30:51 +09:00
|
|
|
// ------------------------------ Theme Settings ------------------------------ //
|
|
|
|
|
|
|
|
themeSettings = {
|
|
|
|
'useDropdowns': true // whether or not to use dropdown menus in a theme
|
2014-09-18 07:24:42 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
// ------------------------------ Subscriptions ------------------------------ //
|
|
|
|
|
|
|
|
// array containing subscriptions to be preloaded
|
|
|
|
preloadSubscriptions = [];
|