Commit 5cb01249d51e2923e71e481f858b5f3b1acb4a49
1 parent
db5aba8455
Exists in
master
clean up and adding template helpers
Showing
14 changed files
with
69 additions
and
21 deletions
Show diff stats
.eslintrc.js
... | ... | @@ -16,6 +16,8 @@ module.exports = { |
16 | 16 | 'BlazeLayout': true, |
17 | 17 | 'Documents': true, |
18 | 18 | 'FlowRouter': true, |
19 | + 'moment': true, | |
20 | + 'parseMarkdown': true, | |
19 | 21 | 'Roles': true, |
20 | 22 | 'SimpleSchema': true |
21 | 23 | }, |
... | ... | @@ -25,6 +27,7 @@ module.exports = { |
25 | 27 | 'eqeqeq': [ 2, 'smart' ], |
26 | 28 | 'indent': [ 2, 2, { 'VariableDeclarator': 2 } ], |
27 | 29 | 'linebreak-style': [ 2, 'unix' ], |
30 | + 'no-console': [ 0 ], | |
28 | 31 | 'no-unneeded-ternary': [ 2 ], |
29 | 32 | 'object-curly-spacing': [ 2, 'always' ], |
30 | 33 | 'quotes': [ 2, 'single' ], | ... | ... |
.meteor/packages
.meteor/versions
... | ... | @@ -76,6 +76,7 @@ reactive-dict@1.1.4-modules.8 |
76 | 76 | reactive-var@1.0.6 |
77 | 77 | reload@1.1.5-modules.8 |
78 | 78 | retry@1.0.4 |
79 | +risul:moment-timezone@0.5.0_5 | |
79 | 80 | routepolicy@1.0.7-modules.8 |
80 | 81 | service-configuration@1.0.6-modules.8 |
81 | 82 | session@1.1.2-modules.8 |
... | ... | @@ -89,6 +90,7 @@ standard-minifiers-js@1.0.3-modules.8 |
89 | 90 | templating@1.1.6-modules.8 |
90 | 91 | templating-tools@1.0.1-modules.8 |
91 | 92 | themeteorchef:bert@2.1.0 |
93 | +themeteorchef:commonmark@1.1.0 | |
92 | 94 | themeteorchef:jquery-validation@1.14.0 |
93 | 95 | themeteorchef:seeder@0.1.0 |
94 | 96 | tracker@1.0.10-modules.8 | ... | ... |
both/methods/insert/collection-name.js
both/methods/remove/collection-name.js
both/methods/update/collection-name.js
client/helpers/flow-router.js
client/helpers/template.js
client/helpers/template/date-time.js
... | ... | @@ -0,0 +1,11 @@ |
1 | +Template.registerHelper( 'formatDateTime', ( timestamp, format ) => { | |
2 | + if ( timestamp && format ) { | |
3 | + return moment( timestamp ).format( format ); | |
4 | + } | |
5 | +}); | |
6 | + | |
7 | +Template.registerHelper( 'formatDateTimeLocal', ( timestamp, timezone, format ) => { | |
8 | + if ( timestamp && timezone && format ) { | |
9 | + return moment( timestamp ).tz( timezone ).format( format ); | |
10 | + } | |
11 | +}); | ... | ... |
client/helpers/template/forms.js
client/helpers/template/logic.js
... | ... | @@ -0,0 +1,15 @@ |
1 | +Template.registerHelper( 'equals', ( valueOne, valueTwo ) => { | |
2 | + return valueOne === valueTwo; | |
3 | +}); | |
4 | + | |
5 | +Template.registerHelper( 'notEqual', ( valueOne, valueTwo ) => { | |
6 | + return valueOne !== valueTwo; | |
7 | +}); | |
8 | + | |
9 | +Template.registerHelper( 'or', ( valueOne, valueTwo ) => { | |
10 | + return valueOne || valueTwo; | |
11 | +}); | |
12 | + | |
13 | +Template.registerHelper( 'and', function( valueOne, valueTwo ) { | |
14 | + return valueOne && valueTwo; | |
15 | +}); | ... | ... |
client/helpers/template/strings.js
... | ... | @@ -0,0 +1,17 @@ |
1 | +Template.registerHelper( 'capitalize', ( string ) => { | |
2 | + if ( string ) { | |
3 | + return string.charAt( 0 ).toUpperCase() + string.slice( 1 ); | |
4 | + } | |
5 | +}); | |
6 | + | |
7 | +Template.registerHelper( 'lowercase', ( string ) => { | |
8 | + if ( string ) { | |
9 | + return string.toLowerCase(); | |
10 | + } | |
11 | +}); | |
12 | + | |
13 | +Template.registerHelper( 'parseMarkdown', ( string ) => { | |
14 | + if ( string && parseMarkdown ) { | |
15 | + return parseMarkdown( string ); | |
16 | + } | |
17 | +}); | ... | ... |
server/accounts/email-templates.js
1 | -let settings = Meteor.settings.public.application, | |
2 | - name = settings.name, | |
3 | - email = settings.supportEmail, | |
1 | +let appName = 'Application Name', | |
2 | + appEmail = `${ appName } <support@application.com>`, | |
4 | 3 | emailTemplates = Accounts.emailTemplates; |
5 | 4 | |
6 | -emailTemplates.siteName = name; | |
7 | -emailTemplates.from = `${ name } <${ email }>`; | |
5 | +emailTemplates.siteName = appName; | |
6 | +emailTemplates.from = appEmail; | |
8 | 7 | |
9 | 8 | emailTemplates.resetPassword = { |
10 | 9 | subject() { |
11 | - return `[${ name }] Reset Your Password`; | |
10 | + return `[${ appName }] Reset Your Password`; | |
12 | 11 | }, |
13 | 12 | text( user, url ) { |
14 | 13 | let emailAddress = user.emails[ 0 ].address, |
15 | - urlWithoutHash = url.replace( '#/', '' ), | |
16 | - supportEmail = 'support@application.com', | |
17 | - emailBody = `A password reset has been requested for the account related to this address (${emailAddress}). To reset the password, visit the following link:\n\n${urlWithoutHash}\n\n If you did not request this reset, please ignore this email. If you feel something is wrong, please contact our support team: ${supportEmail}.`; | |
14 | + urlWithoutHash = url.replace( '#/', '' ); | |
18 | 15 | |
19 | - return emailBody; | |
16 | + return `A password reset has been requested for the account related to this address (${ emailAddress }). To reset the password, visit the following link:\n\n${ urlWithoutHash }\n\n If you did not request this reset, please ignore this email. If you feel something is wrong, please contact our support team: ${ appEmail }.`; | |
20 | 17 | } |
21 | 18 | }; | ... | ... |