Commit 3c77b41eaa15f026358bc88ea78b29662fc29700

Authored by Ryan Glover
1 parent 8d005a632f
Exists in master

refactor file structure

Showing 61 changed files with 661 additions and 633 deletions   Show diff stats
... ... @@ -21,3 +21,6 @@ themeteorchef:bert
21 21 meteorhacks:ssr
22 22 fourseven:scss
23 23 standard-minifiers
  24 +
  25 +
  26 +npm-container
24 27 \ No newline at end of file
... ...
... ... @@ -59,6 +59,7 @@ mobile-status-bar@1.0.6
59 59 mongo@1.1.1
60 60 mongo-id@1.0.1
61 61 npm-bcrypt@0.7.8_2
  62 +npm-container@1.2.0
62 63 npm-mongo@1.4.39_1
63 64 observe-sequence@1.0.7
64 65 ordered-dict@1.0.4
... ...
1 1 <head>
2   - <meta name="viewport" content="width=device-width, initial-scale=1">
3 2 <title>Application Name</title>
  3 + <meta name="viewport" content="width=device-width, initial-scale=1">
  4 + <link rel="icon" href="/favicon.ico">
4 5 </head>
5 6  
6 7 <body></body>
... ...
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
... ... @@ -0,0 +1,2 @@
  1 +Modules = {};
  2 +Modules.both = {};
... ...
both/modules/startup.js
... ... @@ -0,0 +1,3 @@
  1 +var startup = function() {};
  2 +
  3 +Modules.both.startup = startup;
... ...
... ... @@ -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
... ... @@ -1,7 +0,0 @@
1   -<template name="layoutDefault">
2   - {{>bertAlert}}
3   - {{>header}}
4   - <div class="container">
5   - {{>yield}}
6   - </div>
7   -</template>
client/modules/_modules.js
... ... @@ -0,0 +1 @@
  1 +Modules.client = {};
... ...
client/modules/startup.js
... ... @@ -0,0 +1,3 @@
  1 +var startup = function() {};
  2 +
  3 +Modules.client.startup = startup;
... ...
client/startup.js
... ... @@ -0,0 +1 @@
  1 +Meteor.startup( function() { Modules.client.startup(); } );
... ...
client/stylesheets/application.scss
... ... @@ -0,0 +1,3 @@
  1 +@import "tools/extends";
  2 +
  3 +@import "components/login";
... ...
client/stylesheets/components/_login.scss
... ... @@ -0,0 +1,4 @@
  1 +.login label {
  2 + display: block;
  3 + @extend %clearfix;
  4 +}
... ...
client/stylesheets/sass/application.scss
... ... @@ -1,5 +0,0 @@
1   -/* Globals */
2   -@import "globals/extends";
3   -
4   -/* Views */
5   -@import "views/public/login";
client/stylesheets/sass/globals/_extends.scss
... ... @@ -1,17 +0,0 @@
1   -/*
2   - Clearfix
3   - via http://nicolasgallagher.com/micro-clearfix-hack
4   -*/
5   -%clearfix {
6   - *zoom: 1;
7   -
8   - &:before,
9   - &:after {
10   - display: table;
11   - content: "";
12   - }
13   -
14   - &:after {
15   - clear: both;
16   - }
17   -}
client/stylesheets/sass/views/public/_login.scss
... ... @@ -1,4 +0,0 @@
1   -.login label {
2   - display: block;
3   - @extend %clearfix;
4   -}
client/stylesheets/tools/_extends.scss
... ... @@ -0,0 +1,17 @@
  1 +/*
  2 + Clearfix
  3 + via http://nicolasgallagher.com/micro-clearfix-hack
  4 +*/
  5 +%clearfix {
  6 + *zoom: 1;
  7 +
  8 + &:before,
  9 + &:after {
  10 + display: table;
  11 + content: "";
  12 + }
  13 +
  14 + &:after {
  15 + clear: both;
  16 + }
  17 +}
... ...
client/templates/authenticated/index.html
... ... @@ -0,0 +1,3 @@
  1 +<template name="index">
  2 + <h1>Index</h1>
  3 +</template>
... ...
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
... ... @@ -0,0 +1,7 @@
  1 +<template name="layoutDefault">
  2 + {{>bertAlert}}
  3 + {{>header}}
  4 + <div class="container">
  5 + {{>yield}}
  6 + </div>
  7 +</template>
... ...
client/templates/public/loading.html
... ... @@ -0,0 +1,3 @@
  1 +<template name="loading">
  2 + <p>Loading...</p>
  3 +</template>
... ...
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
... ... @@ -0,0 +1,3 @@
  1 +<template name="notFound">
  2 + <h1>404 &mdash; Not Found.</h1>
  3 +</template>
... ...
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 &amp; 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
... ... @@ -1,3 +0,0 @@
1   -<template name="index">
2   - <h1>Index</h1>
3   -</template>
client/views/public/loading.html
... ... @@ -1,3 +0,0 @@
1   -<template name="loading">
2   - <p>Loading...</p>
3   -</template>
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
... ... @@ -1,3 +0,0 @@
1   -<template name="notFound">
2   - <h1>404 &mdash; Not Found.</h1>
3   -</template>
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 &amp; 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>
1   -{
2   -
3   -}
4 1 \ No newline at end of file
  2 +{}
... ...
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
... ... @@ -0,0 +1,3 @@
  1 +var startup = function() {};
  2 +
  3 +Modules.server.startup = startup;
... ...
server/startup.js
... ... @@ -0,0 +1 @@
  1 +Meteor.startup( function() { Modules.server.startup(); } );
... ...