Pages (terms/tos/privacy), comments improvements, etc
This commit is contained in:
parent
cd16f45d8e
commit
952431d296
34 changed files with 435 additions and 97 deletions
|
|
@ -14,6 +14,7 @@ const firesCommonSchema = {
|
|||
|
||||
owner: { type: String, optional: true },
|
||||
dateformat: { type: String, optional: true },
|
||||
ourversion: { type: String, optional: true },
|
||||
|
||||
// NASA types
|
||||
address: { type: String, optional: true }, // reverse geo
|
||||
|
|
|
|||
6
imports/api/Common/dates.js
Normal file
6
imports/api/Common/dates.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import moment from 'moment-timezone';
|
||||
|
||||
export const momentTz = date => moment.tz(date, moment.tz.guess());
|
||||
export const dateLongFormat = date => momentTz(date).format('LLLL (z)');
|
||||
export const dateParseShortFormat = date => moment(date, 'YYYY-MM-DD').format('LL');
|
||||
export const dateFromNow = date => momentTz(date).fromNow();
|
||||
|
|
@ -30,6 +30,7 @@ Notifications.schema = new SimpleSchema({
|
|||
emailNotified: { type: Boolean, optional: true },
|
||||
emailNotifiedAt: { type: Date, optional: true },
|
||||
when: Date,
|
||||
sealed: String,
|
||||
createdAt: defaultCreatedAt,
|
||||
updatedAt: defaultUpdateAt
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,35 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import i18n from 'i18next';
|
||||
import fs from 'fs';
|
||||
import getPrivateFile from '../../../modules/server/get-private-file';
|
||||
import parseMarkdown from '../../../modules/parse-markdown';
|
||||
|
||||
const as = f => `assets/app/${f}`;
|
||||
|
||||
const getFallback = (lang) => {
|
||||
if (lang === 'ast' || lang === 'gl' || lang === 'eu' || lang === 'ca') {
|
||||
return 'es';
|
||||
}
|
||||
return 'en';
|
||||
};
|
||||
|
||||
Meteor.methods({
|
||||
'utility.getPage': function utilityGetPage(fileName) {
|
||||
'utility.getPage': function utilityGetPage(fileName, lang) {
|
||||
check(fileName, String);
|
||||
return parseMarkdown(getPrivateFile(`pages/${fileName}.md`));
|
||||
check(lang, String);
|
||||
const base = `pages/${fileName}`;
|
||||
const fallback = getFallback(lang);
|
||||
let file = `${base}-${lang}.md`;
|
||||
if (!fs.existsSync(as(file))) {
|
||||
console.log(`Page '${fileName}' not found for '${lang}' lang`);
|
||||
file = `${base}-${fallback}.md`;
|
||||
if (!fs.existsSync(as(file))) {
|
||||
console.log(`Page '${fileName}' not found for '${fallback}' lang`);
|
||||
file = `${base}.md`;
|
||||
}
|
||||
}
|
||||
return parseMarkdown(getPrivateFile(file));
|
||||
},
|
||||
'utility.saveMissingI18n': function saveMissing(key, value) {
|
||||
check(key, String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue