2014-09-17 21:11:59 +02:00
|
|
|
settingsSchemaObject = {
|
2014-07-06 14:09:55 +09:00
|
|
|
title: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'general'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
siteUrl: {
|
|
|
|
type: String,
|
2014-07-18 09:21:45 +09:00
|
|
|
optional: true,
|
2014-09-28 16:31:12 +09:00
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'general',
|
|
|
|
instructions: 'Your site\'s URL (with trailing "/"). Will default to Meteor.absoluteUrl()'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
tagline: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'general'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2014-12-17 09:49:56 +09:00
|
|
|
description: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'general',
|
|
|
|
rows: 5,
|
|
|
|
instructions: 'A short description used for SEO purposes.'
|
|
|
|
}
|
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
requireViewInvite: {
|
|
|
|
type: Boolean,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-10-06 11:10:50 +09:00
|
|
|
group: 'invites',
|
|
|
|
leftLabel: 'Require View Invite'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
requirePostInvite: {
|
|
|
|
type: Boolean,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-10-06 11:10:50 +09:00
|
|
|
group: 'invites',
|
|
|
|
leftLabel: 'Require Post Invite'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
requirePostsApproval: {
|
|
|
|
type: Boolean,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 15:40:09 +09:00
|
|
|
group: 'general',
|
2014-10-06 11:10:50 +09:00
|
|
|
instructions: "Posts must be approved by admin",
|
|
|
|
leftLabel: "Require Posts Approval"
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
defaultEmail: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'email',
|
2014-12-04 13:36:06 +09:00
|
|
|
instructions: 'The address all outgoing emails will be sent from.',
|
|
|
|
private: true
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-09-20 11:55:00 +02:00
|
|
|
},
|
2015-01-02 16:05:28 +09:00
|
|
|
mailUrl: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'email',
|
|
|
|
instructions: 'MAIL_URL environment variable (requires restart).',
|
|
|
|
private: true
|
|
|
|
}
|
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
scoreUpdateInterval: {
|
|
|
|
type: Number,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
2014-09-29 10:15:21 +09:00
|
|
|
defaultValue: 30,
|
2014-09-28 16:31:12 +09:00
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'scoring',
|
2014-12-04 13:36:06 +09:00
|
|
|
instructions: 'How often to recalculate scores, in seconds (default to 30)',
|
|
|
|
private: true
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-09-20 11:55:00 +02:00
|
|
|
},
|
2014-08-28 10:16:17 +09:00
|
|
|
defaultView: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-28 16:31:12 +09:00
|
|
|
group: 'posts',
|
2014-09-29 15:40:09 +09:00
|
|
|
instructions: 'The view used for the front page',
|
2015-01-05 10:06:30 +09:00
|
|
|
options: _.map(viewsMenu, function (view) {
|
2014-08-28 10:16:17 +09:00
|
|
|
return {
|
|
|
|
value: camelCaseify(view.label),
|
|
|
|
label: view.label
|
2014-09-20 11:55:00 +02:00
|
|
|
};
|
2014-08-28 10:16:17 +09:00
|
|
|
})
|
2014-09-16 15:18:27 -04:00
|
|
|
}
|
2014-08-28 10:16:17 +09:00
|
|
|
},
|
2015-01-19 11:40:27 +09:00
|
|
|
postsLayout: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'posts',
|
|
|
|
instructions: 'The layout used for post lists',
|
|
|
|
options: [
|
|
|
|
{value: 'posts-list', label: 'List'},
|
|
|
|
{value: 'posts-grid', label: 'Grid'}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
postInterval: {
|
|
|
|
type: Number,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
2014-09-29 10:15:21 +09:00
|
|
|
defaultValue: 30,
|
2014-09-28 16:31:12 +09:00
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'posts',
|
|
|
|
instructions: 'Minimum time between posts, in seconds (defaults to 30)'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
commentInterval: {
|
|
|
|
type: Number,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
2014-09-29 10:15:21 +09:00
|
|
|
defaultValue: 15,
|
2014-09-28 16:31:12 +09:00
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'comments',
|
|
|
|
instructions: 'Minimum time between comments, in seconds (defaults to 15)'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
maxPostsPerDay: {
|
|
|
|
type: Number,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
2014-09-29 10:15:21 +09:00
|
|
|
defaultValue: 30,
|
2014-09-28 16:31:12 +09:00
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'posts',
|
|
|
|
instructions: 'Maximum number of posts a user can post in a day (default to 30).'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
startInvitesCount: {
|
|
|
|
type: Number,
|
|
|
|
defaultValue: 3,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'invites'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
postsPerPage: {
|
|
|
|
type: Number,
|
|
|
|
defaultValue: 10,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'posts'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
logoUrl: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'logo'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
logoHeight: {
|
2014-09-28 16:31:12 +09:00
|
|
|
type: Number,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'logo'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
logoWidth: {
|
2014-09-28 16:31:12 +09:00
|
|
|
type: Number,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'logo'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2015-02-14 19:03:22 +09:00
|
|
|
faviconUrl: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'logo'
|
|
|
|
}
|
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
language: {
|
2014-09-28 16:31:12 +09:00
|
|
|
type: String,
|
|
|
|
defaultValue: 'en',
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 15:40:09 +09:00
|
|
|
group: 'general',
|
2014-11-21 15:13:56 +09:00
|
|
|
instructions: 'The app\'s language. Defaults to English.',
|
|
|
|
options: function () {
|
2015-02-03 10:51:50 +09:00
|
|
|
var languages = _.map(TAPi18n.getLanguages(), function (item, key) {
|
2014-11-21 15:13:56 +09:00
|
|
|
return {
|
|
|
|
value: key,
|
2015-02-03 10:51:50 +09:00
|
|
|
label: item.name
|
2014-11-21 15:13:56 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return languages
|
|
|
|
}
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2014-07-11 10:54:07 +09:00
|
|
|
backgroundCSS: {
|
2014-07-06 14:09:55 +09:00
|
|
|
type: String,
|
2014-07-11 10:54:07 +09:00
|
|
|
optional: true,
|
2014-09-28 16:31:12 +09:00
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'extras',
|
2014-09-29 15:40:09 +09:00
|
|
|
instructions: 'CSS code for the <body>\'s "background" property',
|
|
|
|
rows: 5
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2014-08-21 15:30:05 +09:00
|
|
|
// secondaryColor: {
|
|
|
|
// type: String,
|
|
|
|
// optional: true
|
|
|
|
// },
|
|
|
|
buttonColor: {
|
2014-07-06 14:09:55 +09:00
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-10-08 18:38:01 +09:00
|
|
|
group: 'colors',
|
|
|
|
// type: 'color'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2014-08-21 15:30:05 +09:00
|
|
|
buttonTextColor: {
|
2014-07-06 14:09:55 +09:00
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-10-08 18:38:01 +09:00
|
|
|
group: 'colors',
|
|
|
|
// type: 'color'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-09-20 11:55:00 +02:00
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
headerColor: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-10-08 18:38:01 +09:00
|
|
|
group: 'colors',
|
|
|
|
// type: 'color'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2015-02-13 11:37:09 +09:00
|
|
|
fontUrl: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'fonts',
|
2015-02-13 11:56:24 +09:00
|
|
|
instructions: '@import URL (e.g. https://fonts.googleapis.com/css?family=Source+Sans+Pro)'
|
2015-02-13 11:37:09 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
fontFamily: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'fonts',
|
2015-02-13 11:56:24 +09:00
|
|
|
instructions: 'font-family (e.g. "Source Sans Pro", sans-serif)'
|
2015-02-13 11:37:09 +09:00
|
|
|
}
|
|
|
|
},
|
2014-08-21 15:30:05 +09:00
|
|
|
headerTextColor: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2015-02-13 11:37:09 +09:00
|
|
|
group: 'colors'
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-09-20 11:55:00 +02:00
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
twitterAccount: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'integrations'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
googleAnalyticsId: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'integrations'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
mixpanelId: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'integrations'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
clickyId: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'integrations'
|
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
footerCode: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'extras',
|
2015-01-12 12:02:48 +09:00
|
|
|
instructions: 'Footer content (accepts Markdown).',
|
2014-09-29 15:40:09 +09:00
|
|
|
rows: 5
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
|
|
|
extraCode: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'extras',
|
2014-09-29 15:40:09 +09:00
|
|
|
instructions: 'Any extra HTML code you want to include on every page.',
|
|
|
|
rows: 5
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-07-06 14:09:55 +09:00
|
|
|
},
|
2014-08-02 16:27:12 +09:00
|
|
|
emailFooter: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'email',
|
2014-09-29 15:40:09 +09:00
|
|
|
instructions: 'Content that will appear at the bottom of outgoing emails (accepts HTML).',
|
2014-12-04 13:36:06 +09:00
|
|
|
rows: 5,
|
|
|
|
private: true
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-08-02 16:27:12 +09:00
|
|
|
},
|
2014-07-06 14:09:55 +09:00
|
|
|
notes: {
|
|
|
|
type: String,
|
2014-09-28 16:31:12 +09:00
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2014-09-29 10:15:21 +09:00
|
|
|
group: 'extras',
|
2014-09-29 15:40:09 +09:00
|
|
|
instructions: 'You can store any notes or extra information here.',
|
2014-12-04 13:36:06 +09:00
|
|
|
rows: 5,
|
|
|
|
private: true
|
2014-09-28 16:31:12 +09:00
|
|
|
}
|
2014-09-20 11:55:00 +02:00
|
|
|
},
|
2014-12-13 14:02:45 +09:00
|
|
|
debug: {
|
|
|
|
type: Boolean,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'debug',
|
|
|
|
instructions: 'Enable debug mode for more details console logs'
|
|
|
|
}
|
2015-02-14 10:55:04 +09:00
|
|
|
},
|
|
|
|
authMethods: {
|
|
|
|
type: [String],
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'auth',
|
|
|
|
editable: true,
|
|
|
|
noselect: true,
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
value: 'email',
|
|
|
|
label: 'Email/Password'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'twitter',
|
|
|
|
label: 'Twitter'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'facebook',
|
|
|
|
label: 'Facebook'
|
|
|
|
}
|
|
|
|
],
|
|
|
|
instructions: 'Authentication methods (default to email only)'
|
|
|
|
}
|
2014-12-13 14:02:45 +09:00
|
|
|
}
|
2014-09-17 21:11:59 +02:00
|
|
|
};
|
2014-07-06 14:09:55 +09:00
|
|
|
|
|
|
|
// add any extra properties to settingsSchemaObject (provided by packages for example)
|
|
|
|
_.each(addToSettingsSchema, function(item){
|
|
|
|
settingsSchemaObject[item.propertyName] = item.propertySchema;
|
|
|
|
});
|
|
|
|
|
2014-09-17 19:54:18 +02:00
|
|
|
Settings = new Meteor.Collection("settings");
|
2014-09-17 21:13:20 +02:00
|
|
|
SettingsSchema = new SimpleSchema(settingsSchemaObject);
|
2014-09-17 20:10:43 +02:00
|
|
|
Settings.attachSchema(SettingsSchema);
|
2013-07-04 12:51:26 +09:00
|
|
|
|
2014-09-29 15:40:09 +09:00
|
|
|
// use custom template for checkboxes - not working yet
|
|
|
|
// if(Meteor.isClient){
|
|
|
|
// AutoForm.setDefaultTemplateForType('afCheckbox', 'settings');
|
|
|
|
// }
|
|
|
|
|
2013-07-04 12:51:26 +09:00
|
|
|
Settings.allow({
|
2014-06-22 10:58:02 +09:00
|
|
|
insert: isAdminById,
|
|
|
|
update: isAdminById,
|
|
|
|
remove: isAdminById
|
2013-07-04 12:51:26 +09:00
|
|
|
});
|
|
|
|
|
2014-09-20 11:55:00 +02:00
|
|
|
if (Meteor.isClient){
|
|
|
|
var query = Settings.find();
|
|
|
|
var handle = query.observeChanges({
|
|
|
|
added: function (id, fields) {
|
|
|
|
if (fields.language)
|
2014-11-21 12:50:26 +09:00
|
|
|
setLanguage(fields.language)
|
2014-09-20 11:55:00 +02:00
|
|
|
},
|
|
|
|
changed: function (id, fields) {
|
|
|
|
if (fields.language)
|
2014-11-21 12:50:26 +09:00
|
|
|
setLanguage(fields.language)
|
2014-09-20 11:55:00 +02:00
|
|
|
}
|
|
|
|
});
|
2014-12-13 12:01:41 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
Meteor.startup(function () {
|
2014-12-13 14:02:45 +09:00
|
|
|
// override Meteor.absoluteUrl() with URL provided in settings
|
2014-12-13 12:01:41 +09:00
|
|
|
Meteor.absoluteUrl.defaultOptions.rootUrl = getSetting('siteUrl', Meteor.absoluteUrl());
|
2014-12-13 14:02:45 +09:00
|
|
|
debug = getSetting('debug', false);
|
2014-12-13 12:01:41 +09:00
|
|
|
});
|