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
1 | module.exports = { | 1 | module.exports = { |
2 | 'env': { | 2 | 'env': { |
3 | 'es6': true, | 3 | 'es6': true, |
4 | 'meteor': true, | 4 | 'meteor': true, |
5 | 'node': true | 5 | 'node': true |
6 | }, | 6 | }, |
7 | 'extends': 'eslint:recommended', | 7 | 'extends': 'eslint:recommended', |
8 | 'ecmaFeatures': { | 8 | 'ecmaFeatures': { |
9 | 'jsx': true, | 9 | 'jsx': true, |
10 | 'modules': true, | 10 | 'modules': true, |
11 | 'experimentalObjectRestSpread': true | 11 | 'experimentalObjectRestSpread': true |
12 | }, | 12 | }, |
13 | 'plugins': [], | 13 | 'plugins': [], |
14 | 'globals': { | 14 | 'globals': { |
15 | 'Bert': true, | 15 | 'Bert': true, |
16 | 'BlazeLayout': true, | 16 | 'BlazeLayout': true, |
17 | 'Documents': true, | 17 | 'Documents': true, |
18 | 'FlowRouter': true, | 18 | 'FlowRouter': true, |
19 | 'moment': true, | ||
20 | 'parseMarkdown': true, | ||
19 | 'Roles': true, | 21 | 'Roles': true, |
20 | 'SimpleSchema': true | 22 | 'SimpleSchema': true |
21 | }, | 23 | }, |
22 | 'rules': { | 24 | 'rules': { |
23 | 'comma-dangle': [ 2, 'never' ], | 25 | 'comma-dangle': [ 2, 'never' ], |
24 | 'computed-property-spacing': [ 2, 'always' ], | 26 | 'computed-property-spacing': [ 2, 'always' ], |
25 | 'eqeqeq': [ 2, 'smart' ], | 27 | 'eqeqeq': [ 2, 'smart' ], |
26 | 'indent': [ 2, 2, { 'VariableDeclarator': 2 } ], | 28 | 'indent': [ 2, 2, { 'VariableDeclarator': 2 } ], |
27 | 'linebreak-style': [ 2, 'unix' ], | 29 | 'linebreak-style': [ 2, 'unix' ], |
30 | 'no-console': [ 0 ], | ||
28 | 'no-unneeded-ternary': [ 2 ], | 31 | 'no-unneeded-ternary': [ 2 ], |
29 | 'object-curly-spacing': [ 2, 'always' ], | 32 | 'object-curly-spacing': [ 2, 'always' ], |
30 | 'quotes': [ 2, 'single' ], | 33 | 'quotes': [ 2, 'single' ], |
31 | 'semi': [ 2, 'always' ], | 34 | 'semi': [ 2, 'always' ], |
32 | 'space-infix-ops': [ 2 ] | 35 | 'space-infix-ops': [ 2 ] |
33 | } | 36 | } |
34 | }; | 37 | }; |
35 | 38 |
.meteor/packages
1 | # Meteor packages used by this project, one per line. | 1 | # Meteor packages used by this project, one per line. |
2 | # | 2 | # |
3 | # 'meteor add' and 'meteor remove' will edit this file for you, | 3 | # 'meteor add' and 'meteor remove' will edit this file for you, |
4 | # but you can also edit it by hand. | 4 | # but you can also edit it by hand. |
5 | 5 | ||
6 | accounts-password | 6 | accounts-password |
7 | accounts-base | 7 | accounts-base |
8 | jquery | 8 | jquery |
9 | check | 9 | check |
10 | audit-argument-checks | 10 | audit-argument-checks |
11 | themeteorchef:jquery-validation | 11 | themeteorchef:jquery-validation |
12 | browser-policy | 12 | browser-policy |
13 | 13 | ||
14 | 14 | ||
15 | themeteorchef:bert | 15 | themeteorchef:bert |
16 | meteorhacks:ssr | 16 | meteorhacks:ssr |
17 | standard-minifiers | 17 | standard-minifiers |
18 | 18 | ||
19 | 19 | ||
20 | ecmascript | 20 | ecmascript |
21 | kadira:flow-router | 21 | kadira:flow-router |
22 | kadira:blaze-layout | 22 | kadira:blaze-layout |
23 | meteorhacks:fast-render | 23 | meteorhacks:fast-render |
24 | meteor-base | 24 | meteor-base |
25 | session | 25 | session |
26 | templating | 26 | templating |
27 | fourseven:scss | 27 | fourseven:scss |
28 | reactive-var | 28 | reactive-var |
29 | reactive-dict | 29 | reactive-dict |
30 | aldeed:collection2 | 30 | aldeed:collection2 |
31 | tracker | 31 | tracker |
32 | twbs:bootstrap | 32 | twbs:bootstrap |
33 | momentjs:moment | 33 | momentjs:moment |
34 | alanning:roles | 34 | alanning:roles |
35 | themeteorchef:seeder | 35 | themeteorchef:seeder |
36 | themeteorchef:commonmark | ||
37 | risul:moment-timezone | ||
36 | 38 |
.meteor/versions
1 | accounts-base@1.2.3-modules.8 | 1 | accounts-base@1.2.3-modules.8 |
2 | accounts-password@1.1.5-modules.8 | 2 | accounts-password@1.1.5-modules.8 |
3 | alanning:roles@1.2.14 | 3 | alanning:roles@1.2.14 |
4 | aldeed:collection2@2.6.1 | 4 | aldeed:collection2@2.6.1 |
5 | aldeed:simple-schema@1.3.3 | 5 | aldeed:simple-schema@1.3.3 |
6 | allow-deny@1.0.1-modules.8 | 6 | allow-deny@1.0.1-modules.8 |
7 | audit-argument-checks@1.0.4 | 7 | audit-argument-checks@1.0.4 |
8 | autoupdate@1.2.5-modules.8 | 8 | autoupdate@1.2.5-modules.8 |
9 | babel-compiler@6.4.0-modules.8 | 9 | babel-compiler@6.4.0-modules.8 |
10 | babel-runtime@0.1.5-modules.8 | 10 | babel-runtime@0.1.5-modules.8 |
11 | base64@1.0.5-modules.8 | 11 | base64@1.0.5-modules.8 |
12 | binary-heap@1.0.5-modules.8 | 12 | binary-heap@1.0.5-modules.8 |
13 | blaze@2.1.4-modules.8 | 13 | blaze@2.1.4-modules.8 |
14 | blaze-tools@1.0.5-modules.8 | 14 | blaze-tools@1.0.5-modules.8 |
15 | boilerplate-generator@1.0.5-modules.8 | 15 | boilerplate-generator@1.0.5-modules.8 |
16 | browser-policy@1.0.6-modules.8 | 16 | browser-policy@1.0.6-modules.8 |
17 | browser-policy-common@1.0.5-modules.8 | 17 | browser-policy-common@1.0.5-modules.8 |
18 | browser-policy-content@1.0.7-modules.8 | 18 | browser-policy-content@1.0.7-modules.8 |
19 | browser-policy-framing@1.0.7-modules.8 | 19 | browser-policy-framing@1.0.7-modules.8 |
20 | caching-compiler@1.0.1-modules.8 | 20 | caching-compiler@1.0.1-modules.8 |
21 | caching-html-compiler@1.0.3-modules.8 | 21 | caching-html-compiler@1.0.3-modules.8 |
22 | callback-hook@1.0.5-modules.8 | 22 | callback-hook@1.0.5-modules.8 |
23 | check@1.1.1-modules.8 | 23 | check@1.1.1-modules.8 |
24 | chuangbo:cookie@1.1.0 | 24 | chuangbo:cookie@1.1.0 |
25 | coffeescript@1.0.12-modules.8 | 25 | coffeescript@1.0.12-modules.8 |
26 | cosmos:browserify@0.9.2 | 26 | cosmos:browserify@0.9.2 |
27 | ddp@1.2.2 | 27 | ddp@1.2.2 |
28 | ddp-client@1.2.2-modules.8 | 28 | ddp-client@1.2.2-modules.8 |
29 | ddp-common@1.2.2 | 29 | ddp-common@1.2.2 |
30 | ddp-rate-limiter@1.0.1-modules.8 | 30 | ddp-rate-limiter@1.0.1-modules.8 |
31 | ddp-server@1.2.3-modules.8 | 31 | ddp-server@1.2.3-modules.8 |
32 | deps@1.0.9 | 32 | deps@1.0.9 |
33 | diff-sequence@1.0.2-modules.8 | 33 | diff-sequence@1.0.2-modules.8 |
34 | ecmascript@0.4.0-modules.8 | 34 | ecmascript@0.4.0-modules.8 |
35 | ecmascript-runtime@0.2.7-modules.8 | 35 | ecmascript-runtime@0.2.7-modules.8 |
36 | ejson@1.0.8-modules.8 | 36 | ejson@1.0.8-modules.8 |
37 | email@1.0.9-modules.8 | 37 | email@1.0.9-modules.8 |
38 | fortawesome:fontawesome@4.4.0_1 | 38 | fortawesome:fontawesome@4.4.0_1 |
39 | fourseven:scss@3.4.1 | 39 | fourseven:scss@3.4.1 |
40 | geojson-utils@1.0.5-modules.8 | 40 | geojson-utils@1.0.5-modules.8 |
41 | hot-code-push@1.0.1-modules.8 | 41 | hot-code-push@1.0.1-modules.8 |
42 | html-tools@1.0.6-modules.8 | 42 | html-tools@1.0.6-modules.8 |
43 | htmljs@1.0.6-modules.8 | 43 | htmljs@1.0.6-modules.8 |
44 | http@1.1.2-modules.8 | 44 | http@1.1.2-modules.8 |
45 | id-map@1.0.4 | 45 | id-map@1.0.4 |
46 | jquery@1.11.5-modules.8 | 46 | jquery@1.11.5-modules.8 |
47 | kadira:blaze-layout@2.3.0 | 47 | kadira:blaze-layout@2.3.0 |
48 | kadira:flow-router@2.10.0 | 48 | kadira:flow-router@2.10.0 |
49 | livedata@1.0.15 | 49 | livedata@1.0.15 |
50 | localstorage@1.0.6-modules.8 | 50 | localstorage@1.0.6-modules.8 |
51 | logging@1.0.9-modules.8 | 51 | logging@1.0.9-modules.8 |
52 | meteor@1.1.11-modules.8 | 52 | meteor@1.1.11-modules.8 |
53 | meteor-base@1.0.1 | 53 | meteor-base@1.0.1 |
54 | meteor-env-dev@0.0.1-modules.8 | 54 | meteor-env-dev@0.0.1-modules.8 |
55 | meteor-env-prod@0.0.1-modules.8 | 55 | meteor-env-prod@0.0.1-modules.8 |
56 | meteorhacks:fast-render@2.11.0 | 56 | meteorhacks:fast-render@2.11.0 |
57 | meteorhacks:inject-data@1.4.1 | 57 | meteorhacks:inject-data@1.4.1 |
58 | meteorhacks:picker@1.0.3 | 58 | meteorhacks:picker@1.0.3 |
59 | meteorhacks:ssr@2.2.0 | 59 | meteorhacks:ssr@2.2.0 |
60 | minifiers-css@1.1.8-modules.8 | 60 | minifiers-css@1.1.8-modules.8 |
61 | minifiers-js@1.1.8-modules.8 | 61 | minifiers-js@1.1.8-modules.8 |
62 | minimongo@1.0.11-modules.8 | 62 | minimongo@1.0.11-modules.8 |
63 | modules@0.5.0-modules.8 | 63 | modules@0.5.0-modules.8 |
64 | modules-runtime@0.5.0-modules.8 | 64 | modules-runtime@0.5.0-modules.8 |
65 | momentjs:moment@2.11.2 | 65 | momentjs:moment@2.11.2 |
66 | mongo@1.1.4-modules.8 | 66 | mongo@1.1.4-modules.8 |
67 | mongo-id@1.0.1 | 67 | mongo-id@1.0.1 |
68 | npm-bcrypt@0.7.8_2 | 68 | npm-bcrypt@0.7.8_2 |
69 | npm-mongo@1.4.40-modules.8 | 69 | npm-mongo@1.4.40-modules.8 |
70 | observe-sequence@1.0.8-modules.8 | 70 | observe-sequence@1.0.8-modules.8 |
71 | ordered-dict@1.0.4 | 71 | ordered-dict@1.0.4 |
72 | promise@0.5.2-modules.8 | 72 | promise@0.5.2-modules.8 |
73 | random@1.0.6-modules.8 | 73 | random@1.0.6-modules.8 |
74 | rate-limit@1.0.1-modules.8 | 74 | rate-limit@1.0.1-modules.8 |
75 | reactive-dict@1.1.4-modules.8 | 75 | reactive-dict@1.1.4-modules.8 |
76 | reactive-var@1.0.6 | 76 | reactive-var@1.0.6 |
77 | reload@1.1.5-modules.8 | 77 | reload@1.1.5-modules.8 |
78 | retry@1.0.4 | 78 | retry@1.0.4 |
79 | risul:moment-timezone@0.5.0_5 | ||
79 | routepolicy@1.0.7-modules.8 | 80 | routepolicy@1.0.7-modules.8 |
80 | service-configuration@1.0.6-modules.8 | 81 | service-configuration@1.0.6-modules.8 |
81 | session@1.1.2-modules.8 | 82 | session@1.1.2-modules.8 |
82 | sha@1.0.4 | 83 | sha@1.0.4 |
83 | spacebars@1.0.8-modules.8 | 84 | spacebars@1.0.8-modules.8 |
84 | spacebars-compiler@1.0.8-modules.8 | 85 | spacebars-compiler@1.0.8-modules.8 |
85 | srp@1.0.5-modules.8 | 86 | srp@1.0.5-modules.8 |
86 | standard-minifiers@1.0.3-modules.8 | 87 | standard-minifiers@1.0.3-modules.8 |
87 | standard-minifiers-css@1.0.3-modules.8 | 88 | standard-minifiers-css@1.0.3-modules.8 |
88 | standard-minifiers-js@1.0.3-modules.8 | 89 | standard-minifiers-js@1.0.3-modules.8 |
89 | templating@1.1.6-modules.8 | 90 | templating@1.1.6-modules.8 |
90 | templating-tools@1.0.1-modules.8 | 91 | templating-tools@1.0.1-modules.8 |
91 | themeteorchef:bert@2.1.0 | 92 | themeteorchef:bert@2.1.0 |
93 | themeteorchef:commonmark@1.1.0 | ||
92 | themeteorchef:jquery-validation@1.14.0 | 94 | themeteorchef:jquery-validation@1.14.0 |
93 | themeteorchef:seeder@0.1.0 | 95 | themeteorchef:seeder@0.1.0 |
94 | tracker@1.0.10-modules.8 | 96 | tracker@1.0.10-modules.8 |
95 | twbs:bootstrap@3.3.6 | 97 | twbs:bootstrap@3.3.6 |
96 | ui@1.0.8 | 98 | ui@1.0.8 |
97 | underscore@1.0.5-modules.8 | 99 | underscore@1.0.5-modules.8 |
98 | url@1.0.6-modules.8 | 100 | url@1.0.6-modules.8 |
99 | webapp@1.2.4-modules.8 | 101 | webapp@1.2.4-modules.8 |
100 | webapp-hashing@1.0.6-modules.8 | 102 | webapp-hashing@1.0.6-modules.8 |
101 | 103 |
both/methods/insert/collection-name.js
1 | Meteor.methods({ | 1 | Meteor.methods({ |
2 | insert( object ) { | 2 | insertBoth( object ) { |
3 | check( object, Object ); | 3 | check( object, Object ); |
4 | 4 | ||
5 | try { | 5 | try { |
6 | return Documents.insert( object ); | 6 | return Documents.insert( object ); |
7 | } catch ( exception ) { | 7 | } catch ( exception ) { |
8 | throw new Meteor.Error( '500', `${ exception }` ); | 8 | throw new Meteor.Error( '500', `${ exception }` ); |
9 | } | 9 | } |
10 | } | 10 | } |
11 | }); | 11 | }); |
12 | 12 |
both/methods/remove/collection-name.js
1 | Meteor.methods({ | 1 | Meteor.methods({ |
2 | remove( documentId ) { | 2 | removeBoth( documentId ) { |
3 | check( documentId, String ); | 3 | check( documentId, String ); |
4 | 4 | ||
5 | try { | 5 | try { |
6 | return Documents.remove( documentId ); | 6 | return Documents.remove( documentId ); |
7 | } catch ( exception ) { | 7 | } catch ( exception ) { |
8 | throw new Meteor.Error( '500', `${ exception }` ); | 8 | throw new Meteor.Error( '500', `${ exception }` ); |
9 | } | 9 | } |
10 | } | 10 | } |
11 | }); | 11 | }); |
12 | 12 |
both/methods/update/collection-name.js
1 | Meteor.methods({ | 1 | Meteor.methods({ |
2 | update( update ) { | 2 | updateBoth( update ) { |
3 | check( update, Object ); | 3 | check( update, Object ); |
4 | 4 | ||
5 | try { | 5 | try { |
6 | return Documents.update( update._id, { $set: update } ); | 6 | return Documents.update( update._id, { $set: update } ); |
7 | } catch ( exception ) { | 7 | } catch ( exception ) { |
8 | throw new Meteor.Error( '500', `${ exception }` ); | 8 | throw new Meteor.Error( '500', `${ exception }` ); |
9 | } | 9 | } |
10 | } | 10 | } |
11 | }); | 11 | }); |
12 | 12 |
client/helpers/flow-router.js
1 | let pathFor = ( path, view ) => { | 1 | const pathFor = ( path, view ) => { |
2 | if ( path.hash ) { | 2 | if ( path.hash ) { |
3 | view = path; | 3 | view = path; |
4 | path = view.hash.route; | 4 | path = view.hash.route; |
5 | delete view.hash.route; | 5 | delete view.hash.route; |
6 | } | 6 | } |
7 | 7 | ||
8 | let query = view.hash.query ? FlowRouter._qs.parse( view.hash.query ) : {}; | 8 | let query = view.hash.query ? FlowRouter._qs.parse( view.hash.query ) : {}; |
9 | return FlowRouter.path( path, view.hash, query ); | 9 | return FlowRouter.path( path, view.hash, query ); |
10 | }; | 10 | }; |
11 | 11 | ||
12 | Template.registerHelper( 'pathFor', pathFor ); | 12 | Template.registerHelper( 'pathFor', pathFor ); |
13 | 13 | ||
14 | Template.registerHelper( 'urlFor', ( path, view ) => { | 14 | Template.registerHelper( 'urlFor', ( path, view ) => { |
15 | return Meteor.absoluteUrl( pathFor( path, view ).substr( 1 ) ); | 15 | return Meteor.absoluteUrl( pathFor( path, view ).substr( 1 ) ); |
16 | }); | 16 | }); |
17 | 17 | ||
18 | Template.registerHelper( 'currentRoute', ( route ) => { | 18 | Template.registerHelper( 'currentRoute', ( route ) => { |
19 | FlowRouter.watchPathChange(); | 19 | FlowRouter.watchPathChange(); |
20 | return FlowRouter.current().route.name === route ? 'active' : ''; | 20 | return FlowRouter.current().route.name === route ? 'active' : ''; |
21 | }); | 21 | }); |
22 | 22 |
client/helpers/template.js
client/helpers/template/date-time.js
File was created | 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 | }); | ||
12 |
client/helpers/template/forms.js
File was created | 1 | Template.registerHelper( 'selected', ( valueOne, valueTwo ) => { | |
2 | return valueOne === valueTwo ? 'selected' : ''; | ||
3 | }); | ||
4 | |||
5 | Template.registerHelper( 'checked', ( valueOne, valueTwo ) => { | ||
6 | return valueOne === valueTwo ? 'checked' : ''; | ||
7 | }); | ||
8 |
client/helpers/template/logic.js
File was created | 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 | }); | ||
16 |
client/helpers/template/strings.js
File was created | 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 | }); | ||
18 |
server/accounts/email-templates.js
1 | let settings = Meteor.settings.public.application, | 1 | let appName = 'Application Name', |
2 | name = settings.name, | 2 | appEmail = `${ appName } <support@application.com>`, |
3 | email = settings.supportEmail, | ||
4 | emailTemplates = Accounts.emailTemplates; | 3 | emailTemplates = Accounts.emailTemplates; |
5 | 4 | ||
6 | emailTemplates.siteName = name; | 5 | emailTemplates.siteName = appName; |
7 | emailTemplates.from = `${ name } <${ email }>`; | 6 | emailTemplates.from = appEmail; |
8 | 7 | ||
9 | emailTemplates.resetPassword = { | 8 | emailTemplates.resetPassword = { |
10 | subject() { | 9 | subject() { |
11 | return `[${ name }] Reset Your Password`; | 10 | return `[${ appName }] Reset Your Password`; |
12 | }, | 11 | }, |
13 | text( user, url ) { | 12 | text( user, url ) { |
14 | let emailAddress = user.emails[ 0 ].address, | 13 | let emailAddress = user.emails[ 0 ].address, |
15 | urlWithoutHash = url.replace( '#/', '' ), | 14 | 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}.`; | ||
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 | }; |
22 | 19 |
settings-development.json
1 | { | 1 | { |
2 | "public": { | 2 | "public": {}, |
3 | "application": { | ||
4 | "name": "Application Name", | ||
5 | "domain": "localhost:3000", | ||
6 | "supportEmail": "admin@application.com" | ||
7 | } | ||
8 | }, | ||
9 | "private": {} | 3 | "private": {} |
10 | } | 4 | } |
11 | 5 |