Commit f8071bb525d01bf54505984f797627fc190b6cb6
Exists in
master
Merge branch 'refactor/file_organization_#60' into v3.0.0
Closes #60
Showing
61 changed files
Show diff stats
.meteor/packages
.meteor/versions
application.html
both/methods/insert/example.js
... | ... | @@ -0,0 +1,20 @@ |
1 | +/* | |
2 | +* Methods: Insert - Example | |
3 | +* Example of a method used for inserting into the database. | |
4 | +*/ | |
5 | + | |
6 | +Meteor.methods({ | |
7 | + exampleInsertMethod: function(argument){ | |
8 | + // Check the argument. Assuming an Object type here. | |
9 | + check(argument, Object); | |
10 | + | |
11 | + // Perform the insert. | |
12 | + try { | |
13 | + var exampleId = Example.insert(argument); | |
14 | + return exampleId; | |
15 | + } catch(exception) { | |
16 | + // If an error occurs, return it to the client. | |
17 | + return exception; | |
18 | + } | |
19 | + } | |
20 | +}); | ... | ... |
both/methods/read/example.js
... | ... | @@ -0,0 +1,22 @@ |
1 | +/* | |
2 | +* Methods: Read - Example | |
3 | +* Example of a method used for reading from the database. | |
4 | +*/ | |
5 | + | |
6 | +Meteor.methods({ | |
7 | + exampleReadMethod: function(argument){ | |
8 | + // Check the argument. Assuming a String type here. | |
9 | + check(argument, String); | |
10 | + | |
11 | + // Perform the read. | |
12 | + var exampleItem = Example.findOne(argument); | |
13 | + | |
14 | + // If the read fails (no documents found), throw an error. | |
15 | + if (!exampleItem) { | |
16 | + throw new Meteor.Error(500, 'Error 500: Not Found', 'No documents found.'); | |
17 | + } | |
18 | + | |
19 | + // Return either the result or the error. | |
20 | + return exampleItem; | |
21 | + } | |
22 | +}); | ... | ... |
both/methods/remove/example.js
... | ... | @@ -0,0 +1,20 @@ |
1 | +/* | |
2 | +* Methods: Remove - Example | |
3 | +* Example of a method used for removing a document from the database. | |
4 | +*/ | |
5 | + | |
6 | +Meteor.methods({ | |
7 | + exampleRemoveMethod: function(argument){ | |
8 | + // Check the argument. Assuming a String type here. | |
9 | + check(argument, String); | |
10 | + | |
11 | + // Perform the remove. | |
12 | + try { | |
13 | + var exampleId = Example.remove(argument); | |
14 | + return exampleId; | |
15 | + } catch(exception) { | |
16 | + // If an error occurs, return it to the client. | |
17 | + return exception; | |
18 | + } | |
19 | + } | |
20 | +}); | ... | ... |
both/methods/update/example.js
... | ... | @@ -0,0 +1,24 @@ |
1 | +/* | |
2 | +* Methods: Update - Example | |
3 | +* Example of a method used for updating a document in the database. | |
4 | +*/ | |
5 | + | |
6 | +Meteor.methods({ | |
7 | + exampleUpdateMethod: function(argument){ | |
8 | + // Check the argument. Assuming an Object type here. | |
9 | + check(argument, Object); | |
10 | + | |
11 | + // Perform the update. | |
12 | + try { | |
13 | + var exampleId = Example.update(argument._id, { | |
14 | + $set: { | |
15 | + "someKey": argument.someKey | |
16 | + } | |
17 | + }); | |
18 | + return exampleId; | |
19 | + } catch(exception) { | |
20 | + // If an error occurs, return it to the client. | |
21 | + return exception; | |
22 | + } | |
23 | + } | |
24 | +}); | ... | ... |
both/modules/_modules.js
both/modules/startup.js
both/startup.js
... | ... | @@ -0,0 +1 @@ |
1 | +Meteor.startup( function() { Modules.both.startup(); } ); | ... | ... |
client/controllers/authenticated/header.js
... | ... | @@ -1,46 +0,0 @@ |
1 | -/* | |
2 | -* Controller: Header | |
3 | -* Template: /client/includes/_header.html | |
4 | -*/ | |
5 | - | |
6 | -/* | |
7 | -* Created | |
8 | -*/ | |
9 | - | |
10 | -Template.header.onCreated(function(){ | |
11 | - // Code to run when template is created goes here. | |
12 | -}); | |
13 | - | |
14 | -/* | |
15 | -* Rendered | |
16 | -*/ | |
17 | - | |
18 | -Template.header.onRendered(function() { | |
19 | - // Code to run when template is rendered goes here. | |
20 | -}); | |
21 | - | |
22 | -/* | |
23 | -* Helpers | |
24 | -*/ | |
25 | - | |
26 | -Template.header.helpers({ | |
27 | - example: function(){ | |
28 | - // Code to run for helper function. | |
29 | - } | |
30 | -}); | |
31 | - | |
32 | -/* | |
33 | -* Events | |
34 | -*/ | |
35 | - | |
36 | -Template.header.events({ | |
37 | - 'click .logout': function(){ | |
38 | - Meteor.logout(function(error){ | |
39 | - if(error){ | |
40 | - Bert.alert(error.reason, 'danger'); | |
41 | - } else { | |
42 | - Bert.alert('Succesfully logged out!', 'success'); | |
43 | - } | |
44 | - }); | |
45 | - } | |
46 | -}); |
client/controllers/public/login.js
... | ... | @@ -1,76 +0,0 @@ |
1 | -/* | |
2 | -* Controller: Login | |
3 | -* Template: /client/views/public/login.html | |
4 | -*/ | |
5 | - | |
6 | -/* | |
7 | -* Created | |
8 | -*/ | |
9 | - | |
10 | -Template.login.onCreated(function(){ | |
11 | - // Code to run when template is created goes here. | |
12 | -}); | |
13 | - | |
14 | -/* | |
15 | -* Rendered | |
16 | -*/ | |
17 | - | |
18 | -Template.login.onRendered(function(){ | |
19 | - $('#application-login').validate({ | |
20 | - rules: { | |
21 | - emailAddress: { | |
22 | - required: true, | |
23 | - email: true | |
24 | - }, | |
25 | - password: { | |
26 | - required: true | |
27 | - } | |
28 | - }, | |
29 | - messages: { | |
30 | - emailAddress: { | |
31 | - required: "Please enter your email address to login.", | |
32 | - email: "Please enter a valid email address." | |
33 | - }, | |
34 | - password: { | |
35 | - required: "Please enter your password to login." | |
36 | - } | |
37 | - }, | |
38 | - submitHandler: function(){ | |
39 | - // Grab the user's details. | |
40 | - user = { | |
41 | - email: $('[name="emailAddress"]').val(), | |
42 | - password: $('[name="password"]').val() | |
43 | - } | |
44 | - | |
45 | - // Log the user in. | |
46 | - Meteor.loginWithPassword(user.email, user.password, function(error){ | |
47 | - if(error){ | |
48 | - Bert.alert(error.reason, 'danger'); | |
49 | - } else { | |
50 | - Bert.alert('Logged in!', 'success'); | |
51 | - } | |
52 | - }); | |
53 | - } | |
54 | - }); | |
55 | -}); | |
56 | - | |
57 | -/* | |
58 | -* Helpers | |
59 | -*/ | |
60 | - | |
61 | -Template.login.helpers({ | |
62 | - example: function(){ | |
63 | - // Code to run for helper function. | |
64 | - } | |
65 | -}); | |
66 | - | |
67 | -/* | |
68 | -* Events | |
69 | -*/ | |
70 | - | |
71 | -Template.login.events({ | |
72 | - 'submit form': function(e){ | |
73 | - // Prevent form from submitting. | |
74 | - e.preventDefault(); | |
75 | - } | |
76 | -}); |
client/controllers/public/recover-password.js
... | ... | @@ -1,68 +0,0 @@ |
1 | -/* | |
2 | -* Controller: Recover Password | |
3 | -* Template: /client/views/public/recover-password.html | |
4 | -*/ | |
5 | - | |
6 | -/* | |
7 | -* Created | |
8 | -*/ | |
9 | - | |
10 | -Template.recoverPassword.onCreated(function(){ | |
11 | - // Code to run when template is created goes here. | |
12 | -}); | |
13 | - | |
14 | -/* | |
15 | -* Rendered | |
16 | -*/ | |
17 | - | |
18 | - | |
19 | -Template.recoverPassword.onRendered(function(){ | |
20 | - $('#application-recover-password').validate({ | |
21 | - rules: { | |
22 | - emailAddress: { | |
23 | - required: true, | |
24 | - email: true | |
25 | - } | |
26 | - }, | |
27 | - messages: { | |
28 | - emailAddress: { | |
29 | - required: "Please enter your email address to recover your password.", | |
30 | - email: "Please enter a valid email address." | |
31 | - } | |
32 | - }, | |
33 | - submitHandler: function(){ | |
34 | - // Grab the user's email address. | |
35 | - var email = $('[name="emailAddress"]').val(); | |
36 | - | |
37 | - // Call the send reset password email method. | |
38 | - Accounts.forgotPassword({email: email}, function(error){ | |
39 | - if(error){ | |
40 | - Bert.alert(error.reason, 'danger'); | |
41 | - } else { | |
42 | - Bert.alert('Check your inbox for a reset link!', 'success'); | |
43 | - } | |
44 | - }); | |
45 | - } | |
46 | - }); | |
47 | -}); | |
48 | - | |
49 | -/* | |
50 | -* Helpers | |
51 | -*/ | |
52 | - | |
53 | -Template.recoverPassword.helpers({ | |
54 | - example: function(){ | |
55 | - // Code to run for helper function. | |
56 | - } | |
57 | -}); | |
58 | - | |
59 | -/* | |
60 | -* Events | |
61 | -*/ | |
62 | - | |
63 | -Template.recoverPassword.events({ | |
64 | - 'submit form': function(e){ | |
65 | - // Prevent form from submitting. | |
66 | - e.preventDefault(); | |
67 | - } | |
68 | -}); |
client/controllers/public/reset-password.js
... | ... | @@ -1,78 +0,0 @@ |
1 | -/* | |
2 | -* Controller: Reset Password | |
3 | -* Template: /client/views/public/reset-password.html | |
4 | -*/ | |
5 | - | |
6 | -/* | |
7 | -* Created | |
8 | -*/ | |
9 | - | |
10 | -Template.resetPassword.onCreated(function(){ | |
11 | - // Code to run when template is created goes here. | |
12 | -}); | |
13 | - | |
14 | -/* | |
15 | -* Rendered | |
16 | -*/ | |
17 | - | |
18 | -Template.resetPassword.onRendered(function(){ | |
19 | - $('#application-reset-password').validate({ | |
20 | - rules: { | |
21 | - newPassword: { | |
22 | - required: true, | |
23 | - minlength: 6 | |
24 | - }, | |
25 | - repeatNewPassword: { | |
26 | - required: true, | |
27 | - minlength: 6, | |
28 | - equalTo: "[name='newPassword']" | |
29 | - } | |
30 | - }, | |
31 | - messages: { | |
32 | - newPassword: { | |
33 | - required: "Please enter a new password.", | |
34 | - minlength: "Please use at least six characters." | |
35 | - }, | |
36 | - repeatNewPassword: { | |
37 | - required: "Please repeat your new password.", | |
38 | - equalTo: "Your password do not match. Please try again." | |
39 | - } | |
40 | - }, | |
41 | - submitHandler: function(){ | |
42 | - // Grab the user's reset token and new password. | |
43 | - var token = Session.get('resetPasswordToken'), | |
44 | - password = $('[name="newPassword"]').val(); | |
45 | - | |
46 | - // Reset the user's password. | |
47 | - Accounts.resetPassword(token, password, function(error){ | |
48 | - if(error){ | |
49 | - Bert.alert(error.reason, 'danger'); | |
50 | - } else { | |
51 | - Bert.alert('Password successfully reset!', 'success'); | |
52 | - Session.set('resetPasswordToken', null); | |
53 | - } | |
54 | - }); | |
55 | - } | |
56 | - }); | |
57 | -}); | |
58 | - | |
59 | -/* | |
60 | -* Helpers | |
61 | -*/ | |
62 | - | |
63 | -Template.resetPassword.helpers({ | |
64 | - example: function(){ | |
65 | - // Code to run for helper function. | |
66 | - } | |
67 | -}); | |
68 | - | |
69 | -/* | |
70 | -* Events | |
71 | -*/ | |
72 | - | |
73 | -Template.resetPassword.events({ | |
74 | - 'submit form': function(e){ | |
75 | - // Prevent form from submitting. | |
76 | - e.preventDefault(); | |
77 | - } | |
78 | -}); |
client/controllers/public/signup.js
... | ... | @@ -1,78 +0,0 @@ |
1 | -/* | |
2 | -* Controller: Signup | |
3 | -* Template: /client/views/public/signup.html | |
4 | -*/ | |
5 | - | |
6 | -/* | |
7 | -* Created | |
8 | -*/ | |
9 | - | |
10 | -Template.signup.onCreated(function(){ | |
11 | - // Code to run when template is created goes here. | |
12 | -}); | |
13 | - | |
14 | -/* | |
15 | -* Rendered | |
16 | -*/ | |
17 | - | |
18 | -Template.signup.onRendered(function(){ | |
19 | - $('#application-signup').validate({ | |
20 | - rules: { | |
21 | - emailAddress: { | |
22 | - required: true, | |
23 | - email: true | |
24 | - }, | |
25 | - password: { | |
26 | - required: true, | |
27 | - minlength: 6 | |
28 | - } | |
29 | - }, | |
30 | - messages: { | |
31 | - emailAddress: { | |
32 | - required: "Please enter your email address to sign up.", | |
33 | - email: "Please enter a valid email address." | |
34 | - }, | |
35 | - password: { | |
36 | - required: "Please enter a password to sign up.", | |
37 | - minlength: "Please use at least six characters." | |
38 | - } | |
39 | - }, | |
40 | - submitHandler: function(){ | |
41 | - // Grab the user's details. | |
42 | - user = { | |
43 | - email: $('[name="emailAddress"]').val(), | |
44 | - password: $('[name="password"]').val() | |
45 | - } | |
46 | - | |
47 | - // Create the user's account. | |
48 | - Accounts.createUser({email: user.email, password: user.password}, function(error){ | |
49 | - if(error){ | |
50 | - Bert.alert(error.reason, 'danger'); | |
51 | - } else { | |
52 | - Bert.alert('Welcome!', 'success'); | |
53 | - } | |
54 | - }); | |
55 | - } | |
56 | - }); | |
57 | -}); | |
58 | - | |
59 | -/* | |
60 | -* Helpers | |
61 | -*/ | |
62 | - | |
63 | -Template.signup.helpers({ | |
64 | - example: function(){ | |
65 | - // Code to run for helper function. | |
66 | - } | |
67 | -}); | |
68 | - | |
69 | -/* | |
70 | -* Events | |
71 | -*/ | |
72 | - | |
73 | -Template.signup.events({ | |
74 | - 'submit form': function(e){ | |
75 | - // Prevent form from submitting. | |
76 | - e.preventDefault(); | |
77 | - } | |
78 | -}); |
client/helpers/helpers-ui.js
... | ... | @@ -1,15 +0,0 @@ |
1 | -/* | |
2 | -* UI Helpers | |
3 | -* Define UI helpers for common template functionality. | |
4 | -*/ | |
5 | - | |
6 | -/* | |
7 | -* Current Route | |
8 | -* Return an active class if the currentRoute session variable name | |
9 | -* (set in the appropriate file in /client/routes/) is equal to the name passed | |
10 | -* to the helper in the template. | |
11 | -*/ | |
12 | - | |
13 | -UI.registerHelper('currentRoute', function(route){ | |
14 | - return Session.equals('currentRoute', route) ? 'active' : ''; | |
15 | -}); |
client/helpers/template.js
... | ... | @@ -0,0 +1,15 @@ |
1 | +/* | |
2 | +* UI Helpers | |
3 | +* Define UI helpers for common template functionality. | |
4 | +*/ | |
5 | + | |
6 | +/* | |
7 | +* Current Route | |
8 | +* Return an active class if the currentRoute session variable name | |
9 | +* (set in the appropriate file in /client/routes/) is equal to the name passed | |
10 | +* to the helper in the template. | |
11 | +*/ | |
12 | + | |
13 | +UI.registerHelper('currentRoute', function(route){ | |
14 | + return Session.equals('currentRoute', route) ? 'active' : ''; | |
15 | +}); | ... | ... |
client/includes/_header.html
... | ... | @@ -1,32 +0,0 @@ |
1 | -<template name="header"> | |
2 | - <nav class="navbar navbar-default" role="navigation"> | |
3 | - <div class="container"> | |
4 | - <div class="navbar-header"> | |
5 | - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
6 | - <span class="sr-only">Toggle navigation</span> | |
7 | - <span class="icon-bar"></span> | |
8 | - <span class="icon-bar"></span> | |
9 | - <span class="icon-bar"></span> | |
10 | - </button> | |
11 | - <a class="navbar-brand" href="{{pathFor 'index'}}">Base</a> | |
12 | - </div> | |
13 | - <div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse"> | |
14 | - {{#if currentUser}} | |
15 | - <ul class="nav navbar-nav navbar-right"> | |
16 | - <li class="dropdown"> | |
17 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{currentUser.emails.[0].address}} <span class="caret"></span></a> | |
18 | - <ul class="dropdown-menu" role="menu"> | |
19 | - <li class="logout"><a href="#">Logout</a></li> | |
20 | - </ul> | |
21 | - </li> | |
22 | - </ul> | |
23 | - {{else}} | |
24 | - <ul class="nav navbar-nav navbar-right"> | |
25 | - <li class="{{currentRoute 'login'}}"><a href="{{pathFor 'login'}}">Login</a></li> | |
26 | - <li class="{{currentRoute 'signup'}}"><a href="{{pathFor 'signup'}}">Sign Up</a></li> | |
27 | - </ul> | |
28 | - {{/if}} | |
29 | - </div> <!-- end .navbar-collapse --> | |
30 | - </div> <!-- end .container-fluid --> | |
31 | - </nav> | |
32 | -</template> |
client/layouts/layout-default.html
client/modules/_modules.js
... | ... | @@ -0,0 +1 @@ |
1 | +Modules.client = {}; | ... | ... |
client/modules/startup.js
client/startup.js
... | ... | @@ -0,0 +1 @@ |
1 | +Meteor.startup( function() { Modules.client.startup(); } ); | ... | ... |
client/stylesheets/application.scss
client/stylesheets/components/_login.scss
client/stylesheets/sass/application.scss
client/stylesheets/sass/globals/_extends.scss
client/stylesheets/sass/views/public/_login.scss
client/stylesheets/tools/_extends.scss
client/templates/authenticated/index.html
client/templates/globals/header.html
... | ... | @@ -0,0 +1,32 @@ |
1 | +<template name="header"> | |
2 | + <nav class="navbar navbar-default" role="navigation"> | |
3 | + <div class="container"> | |
4 | + <div class="navbar-header"> | |
5 | + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
6 | + <span class="sr-only">Toggle navigation</span> | |
7 | + <span class="icon-bar"></span> | |
8 | + <span class="icon-bar"></span> | |
9 | + <span class="icon-bar"></span> | |
10 | + </button> | |
11 | + <a class="navbar-brand" href="{{pathFor 'index'}}">Application Name</a> | |
12 | + </div> | |
13 | + <div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse"> | |
14 | + {{#if currentUser}} | |
15 | + <ul class="nav navbar-nav navbar-right"> | |
16 | + <li class="dropdown"> | |
17 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{currentUser.emails.[0].address}} <span class="caret"></span></a> | |
18 | + <ul class="dropdown-menu" role="menu"> | |
19 | + <li class="logout"><a href="#">Logout</a></li> | |
20 | + </ul> | |
21 | + </li> | |
22 | + </ul> | |
23 | + {{else}} | |
24 | + <ul class="nav navbar-nav navbar-right"> | |
25 | + <li class="{{currentRoute 'login'}}"><a href="{{pathFor 'login'}}">Login</a></li> | |
26 | + <li class="{{currentRoute 'signup'}}"><a href="{{pathFor 'signup'}}">Sign Up</a></li> | |
27 | + </ul> | |
28 | + {{/if}} | |
29 | + </div> <!-- end .navbar-collapse --> | |
30 | + </div> <!-- end .container-fluid --> | |
31 | + </nav> | |
32 | +</template> | ... | ... |
client/templates/globals/header.js
... | ... | @@ -0,0 +1,46 @@ |
1 | +/* | |
2 | +* Controller: Header | |
3 | +* Template: /client/includes/_header.html | |
4 | +*/ | |
5 | + | |
6 | +/* | |
7 | +* Created | |
8 | +*/ | |
9 | + | |
10 | +Template.header.onCreated(function(){ | |
11 | + // Code to run when template is created goes here. | |
12 | +}); | |
13 | + | |
14 | +/* | |
15 | +* Rendered | |
16 | +*/ | |
17 | + | |
18 | +Template.header.onRendered(function() { | |
19 | + // Code to run when template is rendered goes here. | |
20 | +}); | |
21 | + | |
22 | +/* | |
23 | +* Helpers | |
24 | +*/ | |
25 | + | |
26 | +Template.header.helpers({ | |
27 | + example: function(){ | |
28 | + // Code to run for helper function. | |
29 | + } | |
30 | +}); | |
31 | + | |
32 | +/* | |
33 | +* Events | |
34 | +*/ | |
35 | + | |
36 | +Template.header.events({ | |
37 | + 'click .logout': function(){ | |
38 | + Meteor.logout(function(error){ | |
39 | + if(error){ | |
40 | + Bert.alert(error.reason, 'danger'); | |
41 | + } else { | |
42 | + Bert.alert('Succesfully logged out!', 'success'); | |
43 | + } | |
44 | + }); | |
45 | + } | |
46 | +}); | ... | ... |
client/templates/layouts/layout-default.html
client/templates/public/loading.html
client/templates/public/login.html
... | ... | @@ -0,0 +1,21 @@ |
1 | +<template name="login"> | |
2 | + <div class="row"> | |
3 | + <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | + <h3 class="page-header">Login</h3> | |
5 | + <form id="application-login" class="login"> | |
6 | + <div class="form-group"> | |
7 | + <label for="emailAddress">Email Address</label> | |
8 | + <input type="email" name="emailAddress" class="form-control" placeholder="Email Address"> | |
9 | + </div> <!-- end .form-group --> | |
10 | + <div class="form-group"> | |
11 | + <label for="password"><span class="pull-left">Password</span> <a class="pull-right" href="{{pathFor 'recover-password'}}">Forgot Password?</a></label> | |
12 | + <input type="password" name="password" class="form-control" placeholder="Password"> | |
13 | + </div> <!-- end .form-group --> | |
14 | + <div class="form-group"> | |
15 | + <input type="submit" class="btn btn-success" value="Login"> | |
16 | + </div> <!-- end .form-group --> | |
17 | + </form> | |
18 | + <p>Don't have an account? <a href="{{pathFor 'signup'}}">Sign Up</a>.</p> | |
19 | + </div> <!-- end .col-xs-12 --> | |
20 | + </div> <!-- end .row --> | |
21 | +</template> | ... | ... |
client/templates/public/login.js
... | ... | @@ -0,0 +1,76 @@ |
1 | +/* | |
2 | +* Controller: Login | |
3 | +* Template: /client/views/public/login.html | |
4 | +*/ | |
5 | + | |
6 | +/* | |
7 | +* Created | |
8 | +*/ | |
9 | + | |
10 | +Template.login.onCreated(function(){ | |
11 | + // Code to run when template is created goes here. | |
12 | +}); | |
13 | + | |
14 | +/* | |
15 | +* Rendered | |
16 | +*/ | |
17 | + | |
18 | +Template.login.onRendered(function(){ | |
19 | + $('#application-login').validate({ | |
20 | + rules: { | |
21 | + emailAddress: { | |
22 | + required: true, | |
23 | + email: true | |
24 | + }, | |
25 | + password: { | |
26 | + required: true | |
27 | + } | |
28 | + }, | |
29 | + messages: { | |
30 | + emailAddress: { | |
31 | + required: "Please enter your email address to login.", | |
32 | + email: "Please enter a valid email address." | |
33 | + }, | |
34 | + password: { | |
35 | + required: "Please enter your password to login." | |
36 | + } | |
37 | + }, | |
38 | + submitHandler: function(){ | |
39 | + // Grab the user's details. | |
40 | + user = { | |
41 | + email: $('[name="emailAddress"]').val(), | |
42 | + password: $('[name="password"]').val() | |
43 | + } | |
44 | + | |
45 | + // Log the user in. | |
46 | + Meteor.loginWithPassword(user.email, user.password, function(error){ | |
47 | + if(error){ | |
48 | + Bert.alert(error.reason, 'danger'); | |
49 | + } else { | |
50 | + Bert.alert('Logged in!', 'success'); | |
51 | + } | |
52 | + }); | |
53 | + } | |
54 | + }); | |
55 | +}); | |
56 | + | |
57 | +/* | |
58 | +* Helpers | |
59 | +*/ | |
60 | + | |
61 | +Template.login.helpers({ | |
62 | + example: function(){ | |
63 | + // Code to run for helper function. | |
64 | + } | |
65 | +}); | |
66 | + | |
67 | +/* | |
68 | +* Events | |
69 | +*/ | |
70 | + | |
71 | +Template.login.events({ | |
72 | + 'submit form': function(e){ | |
73 | + // Prevent form from submitting. | |
74 | + e.preventDefault(); | |
75 | + } | |
76 | +}); | ... | ... |
client/templates/public/not-found.html
client/templates/public/recover-password.html
... | ... | @@ -0,0 +1,17 @@ |
1 | +<template name="recoverPassword"> | |
2 | + <div class="row"> | |
3 | + <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | + <h3 class="page-header">Recover Password</h3> | |
5 | + <form id="application-recover-password" class="recover-password"> | |
6 | + <p>Enter the email address associated with your account below and click the "Recover Password" button. You will receive an email with further instructions on how to reset your password.</p> | |
7 | + <div class="form-group"> | |
8 | + <label for="emailAddress">Email Address</label> | |
9 | + <input type="email" name="emailAddress" class="form-control" placeholder="Email Address"> | |
10 | + </div> <!-- end .form-group --> | |
11 | + <div class="form-group"> | |
12 | + <input type="submit" class="btn btn-success" value="Recover Password"> | |
13 | + </div> <!-- end .form-group --> | |
14 | + </form> | |
15 | + </div> <!-- end .col-xs-12 --> | |
16 | + </div> <!-- end .row --> | |
17 | +</template> | ... | ... |
client/templates/public/recover-password.js
... | ... | @@ -0,0 +1,68 @@ |
1 | +/* | |
2 | +* Controller: Recover Password | |
3 | +* Template: /client/views/public/recover-password.html | |
4 | +*/ | |
5 | + | |
6 | +/* | |
7 | +* Created | |
8 | +*/ | |
9 | + | |
10 | +Template.recoverPassword.onCreated(function(){ | |
11 | + // Code to run when template is created goes here. | |
12 | +}); | |
13 | + | |
14 | +/* | |
15 | +* Rendered | |
16 | +*/ | |
17 | + | |
18 | + | |
19 | +Template.recoverPassword.onRendered(function(){ | |
20 | + $('#application-recover-password').validate({ | |
21 | + rules: { | |
22 | + emailAddress: { | |
23 | + required: true, | |
24 | + email: true | |
25 | + } | |
26 | + }, | |
27 | + messages: { | |
28 | + emailAddress: { | |
29 | + required: "Please enter your email address to recover your password.", | |
30 | + email: "Please enter a valid email address." | |
31 | + } | |
32 | + }, | |
33 | + submitHandler: function(){ | |
34 | + // Grab the user's email address. | |
35 | + var email = $('[name="emailAddress"]').val(); | |
36 | + | |
37 | + // Call the send reset password email method. | |
38 | + Accounts.forgotPassword({email: email}, function(error){ | |
39 | + if(error){ | |
40 | + Bert.alert(error.reason, 'danger'); | |
41 | + } else { | |
42 | + Bert.alert('Check your inbox for a reset link!', 'success'); | |
43 | + } | |
44 | + }); | |
45 | + } | |
46 | + }); | |
47 | +}); | |
48 | + | |
49 | +/* | |
50 | +* Helpers | |
51 | +*/ | |
52 | + | |
53 | +Template.recoverPassword.helpers({ | |
54 | + example: function(){ | |
55 | + // Code to run for helper function. | |
56 | + } | |
57 | +}); | |
58 | + | |
59 | +/* | |
60 | +* Events | |
61 | +*/ | |
62 | + | |
63 | +Template.recoverPassword.events({ | |
64 | + 'submit form': function(e){ | |
65 | + // Prevent form from submitting. | |
66 | + e.preventDefault(); | |
67 | + } | |
68 | +}); | ... | ... |
client/templates/public/reset-password.html
... | ... | @@ -0,0 +1,21 @@ |
1 | +<template name="resetPassword"> | |
2 | + <div class="row"> | |
3 | + <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | + <h3 class="page-header">Reset Password</h3> | |
5 | + <form id="application-reset-password" class="reset-password"> | |
6 | + <p>Enter your new password below and repeat it to confirm. This will reset your password and log you into the application.</p> | |
7 | + <div class="form-group"> | |
8 | + <label for="newPassword">New Password</label> | |
9 | + <input type="password" name="newPassword" class="form-control" placeholder="New Password"> | |
10 | + </div> <!-- end .form-group --> | |
11 | + <div class="form-group"> | |
12 | + <label for="password">Repeat New Password</label> | |
13 | + <input type="password" name="repeatNewPassword" class="form-control" placeholder="Password"> | |
14 | + </div> <!-- end .form-group --> | |
15 | + <div class="form-group"> | |
16 | + <input type="submit" class="btn btn-success" value="Reset Password & Login"> | |
17 | + </div> <!-- end .form-group --> | |
18 | + </form> | |
19 | + </div> <!-- end .col-xs-12 --> | |
20 | + </div> <!-- end .row --> | |
21 | +</template> | ... | ... |
client/templates/public/reset-password.js
... | ... | @@ -0,0 +1,78 @@ |
1 | +/* | |
2 | +* Controller: Reset Password | |
3 | +* Template: /client/views/public/reset-password.html | |
4 | +*/ | |
5 | + | |
6 | +/* | |
7 | +* Created | |
8 | +*/ | |
9 | + | |
10 | +Template.resetPassword.onCreated(function(){ | |
11 | + // Code to run when template is created goes here. | |
12 | +}); | |
13 | + | |
14 | +/* | |
15 | +* Rendered | |
16 | +*/ | |
17 | + | |
18 | +Template.resetPassword.onRendered(function(){ | |
19 | + $('#application-reset-password').validate({ | |
20 | + rules: { | |
21 | + newPassword: { | |
22 | + required: true, | |
23 | + minlength: 6 | |
24 | + }, | |
25 | + repeatNewPassword: { | |
26 | + required: true, | |
27 | + minlength: 6, | |
28 | + equalTo: "[name='newPassword']" | |
29 | + } | |
30 | + }, | |
31 | + messages: { | |
32 | + newPassword: { | |
33 | + required: "Please enter a new password.", | |
34 | + minlength: "Please use at least six characters." | |
35 | + }, | |
36 | + repeatNewPassword: { | |
37 | + required: "Please repeat your new password.", | |
38 | + equalTo: "Your password do not match. Please try again." | |
39 | + } | |
40 | + }, | |
41 | + submitHandler: function(){ | |
42 | + // Grab the user's reset token and new password. | |
43 | + var token = Session.get('resetPasswordToken'), | |
44 | + password = $('[name="newPassword"]').val(); | |
45 | + | |
46 | + // Reset the user's password. | |
47 | + Accounts.resetPassword(token, password, function(error){ | |
48 | + if(error){ | |
49 | + Bert.alert(error.reason, 'danger'); | |
50 | + } else { | |
51 | + Bert.alert('Password successfully reset!', 'success'); | |
52 | + Session.set('resetPasswordToken', null); | |
53 | + } | |
54 | + }); | |
55 | + } | |
56 | + }); | |
57 | +}); | |
58 | + | |
59 | +/* | |
60 | +* Helpers | |
61 | +*/ | |
62 | + | |
63 | +Template.resetPassword.helpers({ | |
64 | + example: function(){ | |
65 | + // Code to run for helper function. | |
66 | + } | |
67 | +}); | |
68 | + | |
69 | +/* | |
70 | +* Events | |
71 | +*/ | |
72 | + | |
73 | +Template.resetPassword.events({ | |
74 | + 'submit form': function(e){ | |
75 | + // Prevent form from submitting. | |
76 | + e.preventDefault(); | |
77 | + } | |
78 | +}); | ... | ... |
client/templates/public/signup.html
... | ... | @@ -0,0 +1,21 @@ |
1 | +<template name="signup"> | |
2 | + <div class="row"> | |
3 | + <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | + <h3 class="page-header">Sign Up</h3> | |
5 | + <form id="application-signup" class="signup"> | |
6 | + <div class="form-group"> | |
7 | + <label for="emailAddress">Email Address</label> | |
8 | + <input type="email" name="emailAddress" class="form-control" placeholder="Email Address"> | |
9 | + </div> <!-- end .form-group --> | |
10 | + <div class="form-group"> | |
11 | + <label for="password">Password</label> | |
12 | + <input type="password" name="password" class="form-control" placeholder="Password"> | |
13 | + </div> <!-- end .form-group --> | |
14 | + <div class="form-group"> | |
15 | + <input type="submit" class="btn btn-success" value="Sign Up"> | |
16 | + </div> <!-- end .form-group --> | |
17 | + </form> | |
18 | + <p>Already have an account? <a href="{{pathFor 'login'}}">Log In</a>.</p> | |
19 | + </div> <!-- end .col-xs-12 --> | |
20 | + </div> <!-- end .row --> | |
21 | +</template> | ... | ... |
client/templates/public/signup.js
... | ... | @@ -0,0 +1,78 @@ |
1 | +/* | |
2 | +* Controller: Signup | |
3 | +* Template: /client/views/public/signup.html | |
4 | +*/ | |
5 | + | |
6 | +/* | |
7 | +* Created | |
8 | +*/ | |
9 | + | |
10 | +Template.signup.onCreated(function(){ | |
11 | + // Code to run when template is created goes here. | |
12 | +}); | |
13 | + | |
14 | +/* | |
15 | +* Rendered | |
16 | +*/ | |
17 | + | |
18 | +Template.signup.onRendered(function(){ | |
19 | + $('#application-signup').validate({ | |
20 | + rules: { | |
21 | + emailAddress: { | |
22 | + required: true, | |
23 | + email: true | |
24 | + }, | |
25 | + password: { | |
26 | + required: true, | |
27 | + minlength: 6 | |
28 | + } | |
29 | + }, | |
30 | + messages: { | |
31 | + emailAddress: { | |
32 | + required: "Please enter your email address to sign up.", | |
33 | + email: "Please enter a valid email address." | |
34 | + }, | |
35 | + password: { | |
36 | + required: "Please enter a password to sign up.", | |
37 | + minlength: "Please use at least six characters." | |
38 | + } | |
39 | + }, | |
40 | + submitHandler: function(){ | |
41 | + // Grab the user's details. | |
42 | + user = { | |
43 | + email: $('[name="emailAddress"]').val(), | |
44 | + password: $('[name="password"]').val() | |
45 | + } | |
46 | + | |
47 | + // Create the user's account. | |
48 | + Accounts.createUser({email: user.email, password: user.password}, function(error){ | |
49 | + if(error){ | |
50 | + Bert.alert(error.reason, 'danger'); | |
51 | + } else { | |
52 | + Bert.alert('Welcome!', 'success'); | |
53 | + } | |
54 | + }); | |
55 | + } | |
56 | + }); | |
57 | +}); | |
58 | + | |
59 | +/* | |
60 | +* Helpers | |
61 | +*/ | |
62 | + | |
63 | +Template.signup.helpers({ | |
64 | + example: function(){ | |
65 | + // Code to run for helper function. | |
66 | + } | |
67 | +}); | |
68 | + | |
69 | +/* | |
70 | +* Events | |
71 | +*/ | |
72 | + | |
73 | +Template.signup.events({ | |
74 | + 'submit form': function(e){ | |
75 | + // Prevent form from submitting. | |
76 | + e.preventDefault(); | |
77 | + } | |
78 | +}); | ... | ... |
client/views/authenticated/index.html
client/views/public/loading.html
client/views/public/login.html
... | ... | @@ -1,21 +0,0 @@ |
1 | -<template name="login"> | |
2 | - <div class="row"> | |
3 | - <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | - <h3 class="page-header">Login</h3> | |
5 | - <form id="application-login" class="login"> | |
6 | - <div class="form-group"> | |
7 | - <label for="emailAddress">Email Address</label> | |
8 | - <input type="email" name="emailAddress" class="form-control" placeholder="Email Address"> | |
9 | - </div> <!-- end .form-group --> | |
10 | - <div class="form-group"> | |
11 | - <label for="password"><span class="pull-left">Password</span> <a class="pull-right" href="{{pathFor 'recover-password'}}">Forgot Password?</a></label> | |
12 | - <input type="password" name="password" class="form-control" placeholder="Password"> | |
13 | - </div> <!-- end .form-group --> | |
14 | - <div class="form-group"> | |
15 | - <input type="submit" class="btn btn-success" value="Login"> | |
16 | - </div> <!-- end .form-group --> | |
17 | - </form> | |
18 | - <p>Don't have an account? <a href="{{pathFor 'signup'}}">Sign Up</a>.</p> | |
19 | - </div> <!-- end .col-xs-12 --> | |
20 | - </div> <!-- end .row --> | |
21 | -</template> |
client/views/public/not-found.html
client/views/public/recover-password.html
... | ... | @@ -1,17 +0,0 @@ |
1 | -<template name="recoverPassword"> | |
2 | - <div class="row"> | |
3 | - <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | - <h3 class="page-header">Recover Password</h3> | |
5 | - <form id="application-recover-password" class="recover-password"> | |
6 | - <p>Enter the email address associated with your account below and click the "Recover Password" button. You will receive an email with further instructions on how to reset your password.</p> | |
7 | - <div class="form-group"> | |
8 | - <label for="emailAddress">Email Address</label> | |
9 | - <input type="email" name="emailAddress" class="form-control" placeholder="Email Address"> | |
10 | - </div> <!-- end .form-group --> | |
11 | - <div class="form-group"> | |
12 | - <input type="submit" class="btn btn-success" value="Recover Password"> | |
13 | - </div> <!-- end .form-group --> | |
14 | - </form> | |
15 | - </div> <!-- end .col-xs-12 --> | |
16 | - </div> <!-- end .row --> | |
17 | -</template> |
client/views/public/reset-password.html
... | ... | @@ -1,21 +0,0 @@ |
1 | -<template name="resetPassword"> | |
2 | - <div class="row"> | |
3 | - <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | - <h3 class="page-header">Reset Password</h3> | |
5 | - <form id="application-reset-password" class="reset-password"> | |
6 | - <p>Enter your new password below and repeat it to confirm. This will reset your password and log you into the application.</p> | |
7 | - <div class="form-group"> | |
8 | - <label for="newPassword">New Password</label> | |
9 | - <input type="password" name="newPassword" class="form-control" placeholder="New Password"> | |
10 | - </div> <!-- end .form-group --> | |
11 | - <div class="form-group"> | |
12 | - <label for="password">Repeat New Password</label> | |
13 | - <input type="password" name="repeatNewPassword" class="form-control" placeholder="Password"> | |
14 | - </div> <!-- end .form-group --> | |
15 | - <div class="form-group"> | |
16 | - <input type="submit" class="btn btn-success" value="Reset Password & Login"> | |
17 | - </div> <!-- end .form-group --> | |
18 | - </form> | |
19 | - </div> <!-- end .col-xs-12 --> | |
20 | - </div> <!-- end .row --> | |
21 | -</template> |
client/views/public/signup.html
... | ... | @@ -1,21 +0,0 @@ |
1 | -<template name="signup"> | |
2 | - <div class="row"> | |
3 | - <div class="col-xs-12 col-sm-6 col-md-4"> | |
4 | - <h3 class="page-header">Sign Up</h3> | |
5 | - <form id="application-signup" class="signup"> | |
6 | - <div class="form-group"> | |
7 | - <label for="emailAddress">Email Address</label> | |
8 | - <input type="email" name="emailAddress" class="form-control" placeholder="Email Address"> | |
9 | - </div> <!-- end .form-group --> | |
10 | - <div class="form-group"> | |
11 | - <label for="password">Password</label> | |
12 | - <input type="password" name="password" class="form-control" placeholder="Password"> | |
13 | - </div> <!-- end .form-group --> | |
14 | - <div class="form-group"> | |
15 | - <input type="submit" class="btn btn-success" value="Sign Up"> | |
16 | - </div> <!-- end .form-group --> | |
17 | - </form> | |
18 | - <p>Already have an account? <a href="{{pathFor 'login'}}">Log In</a>.</p> | |
19 | - </div> <!-- end .col-xs-12 --> | |
20 | - </div> <!-- end .row --> | |
21 | -</template> |
packages.json
packages/npm-container/index.js
... | ... | @@ -0,0 +1,9 @@ |
1 | +Meteor.npmRequire = function(moduleName) { | |
2 | + var module = Npm.require(moduleName); | |
3 | + return module; | |
4 | +}; | |
5 | + | |
6 | +Meteor.require = function(moduleName) { | |
7 | + console.warn('Meteor.require is deprecated. Please use Meteor.npmRequire instead!'); | |
8 | + return Meteor.npmRequire(moduleName); | |
9 | +}; | |
0 | 10 | \ No newline at end of file | ... | ... |
packages/npm-container/package.js
... | ... | @@ -0,0 +1,30 @@ |
1 | +var path = Npm.require('path'); | |
2 | +var fs = Npm.require('fs'); | |
3 | + | |
4 | +Package.describe({ | |
5 | + summary: 'Contains all your npm dependencies', | |
6 | + version: '1.2.0', | |
7 | + name: 'npm-container' | |
8 | +}); | |
9 | + | |
10 | +var packagesJsonFile = path.resolve('./packages.json'); | |
11 | +try { | |
12 | + var fileContent = fs.readFileSync(packagesJsonFile); | |
13 | + var packages = JSON.parse(fileContent.toString()); | |
14 | + Npm.depends(packages); | |
15 | +} catch (ex) { | |
16 | + console.error('ERROR: packages.json parsing error [ ' + ex.message + ' ]'); | |
17 | +} | |
18 | + | |
19 | +// Adding the app's packages.json as a used file for this package will get | |
20 | +// Meteor to watch it and reload this package when it changes | |
21 | +Package.onUse(function(api) { | |
22 | + api.addFiles('index.js', 'server'); | |
23 | + if (api.addAssets) { | |
24 | + api.addAssets('../../packages.json', 'server'); | |
25 | + } else { | |
26 | + api.addFiles('../../packages.json', 'server', { | |
27 | + isAsset: true | |
28 | + }); | |
29 | + } | |
30 | +}); | |
0 | 31 | \ No newline at end of file | ... | ... |
public/favicon.ico
No preview for this file type
server/methods/insert/example.js
... | ... | @@ -1,20 +0,0 @@ |
1 | -/* | |
2 | -* Methods: Insert - Example | |
3 | -* Example of a method used for inserting into the database. | |
4 | -*/ | |
5 | - | |
6 | -Meteor.methods({ | |
7 | - exampleInsertMethod: function(argument){ | |
8 | - // Check the argument. Assuming an Object type here. | |
9 | - check(argument, Object); | |
10 | - | |
11 | - // Perform the insert. | |
12 | - try { | |
13 | - var exampleId = Example.insert(argument); | |
14 | - return exampleId; | |
15 | - } catch(exception) { | |
16 | - // If an error occurs, return it to the client. | |
17 | - return exception; | |
18 | - } | |
19 | - } | |
20 | -}); |
server/methods/read/example.js
... | ... | @@ -1,22 +0,0 @@ |
1 | -/* | |
2 | -* Methods: Read - Example | |
3 | -* Example of a method used for reading from the database. | |
4 | -*/ | |
5 | - | |
6 | -Meteor.methods({ | |
7 | - exampleReadMethod: function(argument){ | |
8 | - // Check the argument. Assuming a String type here. | |
9 | - check(argument, String); | |
10 | - | |
11 | - // Perform the read. | |
12 | - var exampleItem = Example.findOne(argument); | |
13 | - | |
14 | - // If the read fails (no documents found), throw an error. | |
15 | - if (!exampleItem) { | |
16 | - throw new Meteor.Error(500, 'Error 500: Not Found', 'No documents found.'); | |
17 | - } | |
18 | - | |
19 | - // Return either the result or the error. | |
20 | - return exampleItem; | |
21 | - } | |
22 | -}); |
server/methods/remove/example.js
... | ... | @@ -1,20 +0,0 @@ |
1 | -/* | |
2 | -* Methods: Remove - Example | |
3 | -* Example of a method used for removing a document from the database. | |
4 | -*/ | |
5 | - | |
6 | -Meteor.methods({ | |
7 | - exampleRemoveMethod: function(argument){ | |
8 | - // Check the argument. Assuming a String type here. | |
9 | - check(argument, String); | |
10 | - | |
11 | - // Perform the remove. | |
12 | - try { | |
13 | - var exampleId = Example.remove(argument); | |
14 | - return exampleId; | |
15 | - } catch(exception) { | |
16 | - // If an error occurs, return it to the client. | |
17 | - return exception; | |
18 | - } | |
19 | - } | |
20 | -}); |
server/methods/update/example.js
... | ... | @@ -1,24 +0,0 @@ |
1 | -/* | |
2 | -* Methods: Update - Example | |
3 | -* Example of a method used for updating a document in the database. | |
4 | -*/ | |
5 | - | |
6 | -Meteor.methods({ | |
7 | - exampleUpdateMethod: function(argument){ | |
8 | - // Check the argument. Assuming an Object type here. | |
9 | - check(argument, Object); | |
10 | - | |
11 | - // Perform the update. | |
12 | - try { | |
13 | - var exampleId = Example.update(argument._id, { | |
14 | - $set: { | |
15 | - "someKey": argument.someKey | |
16 | - } | |
17 | - }); | |
18 | - return exampleId; | |
19 | - } catch(exception) { | |
20 | - // If an error occurs, return it to the client. | |
21 | - return exception; | |
22 | - } | |
23 | - } | |
24 | -}); |
server/methods/utility/example.js
... | ... | @@ -1,28 +0,0 @@ |
1 | -/* | |
2 | -* Methods: Utility - Example | |
3 | -* Example of a method used for performing a function on the server. | |
4 | -*/ | |
5 | - | |
6 | -// Example third-party API stub to call. | |
7 | -// This should be deleted and is only here as an example. | |
8 | -var chipotle = { | |
9 | - getBurrito: function(burrito){ | |
10 | - return burrito; | |
11 | - } | |
12 | -} | |
13 | - | |
14 | -Meteor.methods({ | |
15 | - exampleUtilityMethod: function(argument){ | |
16 | - // Check the argument. Assuming an Object type here. | |
17 | - check(argument, Object); | |
18 | - | |
19 | - // Perform the function. | |
20 | - try { | |
21 | - var apiCall = chipotle.getBurrito("Barbacoa"); | |
22 | - return apiCall; | |
23 | - } catch(exception) { | |
24 | - // If an error occurs, return it to the client. | |
25 | - return exception; | |
26 | - } | |
27 | - } | |
28 | -}); |
server/modules/_modules.js
... | ... | @@ -0,0 +1 @@ |
1 | +Modules.server = {}; | ... | ... |
server/modules/startup.js
server/startup.js
... | ... | @@ -0,0 +1 @@ |
1 | +Meteor.startup( function() { Modules.server.startup(); } ); | ... | ... |