From 3c77b41eaa15f026358bc88ea78b29662fc29700 Mon Sep 17 00:00:00 2001 From: Ryan Glover Date: Fri, 25 Sep 2015 22:41:33 -0500 Subject: [PATCH] refactor file structure --- .meteor/packages | 3 + .meteor/versions | 1 + application.html | 3 +- both/methods/insert/example.js | 20 ++++++ both/methods/read/example.js | 22 +++++++ both/methods/remove/example.js | 20 ++++++ both/methods/update/example.js | 24 +++++++ both/modules/_modules.js | 2 + both/modules/startup.js | 3 + both/startup.js | 1 + client/controllers/authenticated/header.js | 46 ------------- client/controllers/public/login.js | 76 ---------------------- client/controllers/public/recover-password.js | 68 -------------------- client/controllers/public/reset-password.js | 78 ----------------------- client/controllers/public/signup.js | 78 ----------------------- client/helpers/helpers-ui.js | 15 ----- client/helpers/template.js | 15 +++++ client/includes/_header.html | 32 ---------- client/layouts/layout-default.html | 7 -- client/modules/_modules.js | 1 + client/modules/startup.js | 3 + client/startup.js | 1 + client/stylesheets/application.scss | 3 + client/stylesheets/components/_login.scss | 4 ++ client/stylesheets/sass/application.scss | 5 -- client/stylesheets/sass/globals/_extends.scss | 17 ----- client/stylesheets/sass/views/public/_login.scss | 4 -- client/stylesheets/tools/_extends.scss | 17 +++++ client/templates/authenticated/index.html | 3 + client/templates/globals/header.html | 32 ++++++++++ client/templates/globals/header.js | 46 +++++++++++++ client/templates/layouts/layout-default.html | 7 ++ client/templates/public/loading.html | 3 + client/templates/public/login.html | 21 ++++++ client/templates/public/login.js | 76 ++++++++++++++++++++++ client/templates/public/not-found.html | 3 + client/templates/public/recover-password.html | 17 +++++ client/templates/public/recover-password.js | 68 ++++++++++++++++++++ client/templates/public/reset-password.html | 21 ++++++ client/templates/public/reset-password.js | 78 +++++++++++++++++++++++ client/templates/public/signup.html | 21 ++++++ client/templates/public/signup.js | 78 +++++++++++++++++++++++ client/views/authenticated/index.html | 3 - client/views/public/loading.html | 3 - client/views/public/login.html | 21 ------ client/views/public/not-found.html | 3 - client/views/public/recover-password.html | 17 ----- client/views/public/reset-password.html | 21 ------ client/views/public/signup.html | 21 ------ packages.json | 4 +- packages/npm-container/index.js | 9 +++ packages/npm-container/package.js | 30 +++++++++ public/favicon.ico | Bin 0 -> 5430 bytes server/methods/insert/example.js | 20 ------ server/methods/read/example.js | 22 ------- server/methods/remove/example.js | 20 ------ server/methods/update/example.js | 24 ------- server/methods/utility/example.js | 28 -------- server/modules/_modules.js | 1 + server/modules/startup.js | 3 + server/startup.js | 1 + 61 files changed, 661 insertions(+), 633 deletions(-) create mode 100644 both/methods/insert/example.js create mode 100644 both/methods/read/example.js create mode 100644 both/methods/remove/example.js create mode 100644 both/methods/update/example.js create mode 100644 both/modules/_modules.js create mode 100644 both/modules/startup.js create mode 100644 both/startup.js delete mode 100644 client/controllers/authenticated/header.js delete mode 100644 client/controllers/public/login.js delete mode 100644 client/controllers/public/recover-password.js delete mode 100644 client/controllers/public/reset-password.js delete mode 100644 client/controllers/public/signup.js delete mode 100644 client/helpers/helpers-ui.js create mode 100644 client/helpers/template.js delete mode 100644 client/includes/_header.html delete mode 100644 client/layouts/layout-default.html create mode 100644 client/modules/_modules.js create mode 100644 client/modules/startup.js create mode 100644 client/startup.js create mode 100644 client/stylesheets/application.scss create mode 100644 client/stylesheets/components/_login.scss delete mode 100644 client/stylesheets/sass/application.scss delete mode 100644 client/stylesheets/sass/globals/_extends.scss delete mode 100644 client/stylesheets/sass/views/public/_login.scss create mode 100644 client/stylesheets/tools/_extends.scss create mode 100644 client/templates/authenticated/index.html create mode 100644 client/templates/globals/header.html create mode 100644 client/templates/globals/header.js create mode 100644 client/templates/layouts/layout-default.html create mode 100644 client/templates/public/loading.html create mode 100644 client/templates/public/login.html create mode 100644 client/templates/public/login.js create mode 100644 client/templates/public/not-found.html create mode 100644 client/templates/public/recover-password.html create mode 100644 client/templates/public/recover-password.js create mode 100644 client/templates/public/reset-password.html create mode 100644 client/templates/public/reset-password.js create mode 100644 client/templates/public/signup.html create mode 100644 client/templates/public/signup.js delete mode 100644 client/views/authenticated/index.html delete mode 100644 client/views/public/loading.html delete mode 100644 client/views/public/login.html delete mode 100644 client/views/public/not-found.html delete mode 100644 client/views/public/recover-password.html delete mode 100644 client/views/public/reset-password.html delete mode 100644 client/views/public/signup.html create mode 100644 packages/npm-container/index.js create mode 100644 packages/npm-container/package.js create mode 100755 public/favicon.ico delete mode 100644 server/methods/insert/example.js delete mode 100644 server/methods/read/example.js delete mode 100644 server/methods/remove/example.js delete mode 100644 server/methods/update/example.js delete mode 100644 server/methods/utility/example.js create mode 100644 server/modules/_modules.js create mode 100644 server/modules/startup.js create mode 100644 server/startup.js diff --git a/.meteor/packages b/.meteor/packages index d1f5c37..e966eab 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -21,3 +21,6 @@ themeteorchef:bert meteorhacks:ssr fourseven:scss standard-minifiers + + +npm-container \ No newline at end of file diff --git a/.meteor/versions b/.meteor/versions index 84b501f..e12c85d 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -59,6 +59,7 @@ mobile-status-bar@1.0.6 mongo@1.1.1 mongo-id@1.0.1 npm-bcrypt@0.7.8_2 +npm-container@1.2.0 npm-mongo@1.4.39_1 observe-sequence@1.0.7 ordered-dict@1.0.4 diff --git a/application.html b/application.html index 06f4602..0efdc35 100644 --- a/application.html +++ b/application.html @@ -1,6 +1,7 @@ - Application Name + + diff --git a/both/methods/insert/example.js b/both/methods/insert/example.js new file mode 100644 index 0000000..1bc32d0 --- /dev/null +++ b/both/methods/insert/example.js @@ -0,0 +1,20 @@ +/* +* Methods: Insert - Example +* Example of a method used for inserting into the database. +*/ + +Meteor.methods({ + exampleInsertMethod: function(argument){ + // Check the argument. Assuming an Object type here. + check(argument, Object); + + // Perform the insert. + try { + var exampleId = Example.insert(argument); + return exampleId; + } catch(exception) { + // If an error occurs, return it to the client. + return exception; + } + } +}); diff --git a/both/methods/read/example.js b/both/methods/read/example.js new file mode 100644 index 0000000..1c54af7 --- /dev/null +++ b/both/methods/read/example.js @@ -0,0 +1,22 @@ +/* +* Methods: Read - Example +* Example of a method used for reading from the database. +*/ + +Meteor.methods({ + exampleReadMethod: function(argument){ + // Check the argument. Assuming a String type here. + check(argument, String); + + // Perform the read. + var exampleItem = Example.findOne(argument); + + // If the read fails (no documents found), throw an error. + if (!exampleItem) { + throw new Meteor.Error(500, 'Error 500: Not Found', 'No documents found.'); + } + + // Return either the result or the error. + return exampleItem; + } +}); diff --git a/both/methods/remove/example.js b/both/methods/remove/example.js new file mode 100644 index 0000000..9c8058e --- /dev/null +++ b/both/methods/remove/example.js @@ -0,0 +1,20 @@ +/* +* Methods: Remove - Example +* Example of a method used for removing a document from the database. +*/ + +Meteor.methods({ + exampleRemoveMethod: function(argument){ + // Check the argument. Assuming a String type here. + check(argument, String); + + // Perform the remove. + try { + var exampleId = Example.remove(argument); + return exampleId; + } catch(exception) { + // If an error occurs, return it to the client. + return exception; + } + } +}); diff --git a/both/methods/update/example.js b/both/methods/update/example.js new file mode 100644 index 0000000..a7cacd3 --- /dev/null +++ b/both/methods/update/example.js @@ -0,0 +1,24 @@ +/* +* Methods: Update - Example +* Example of a method used for updating a document in the database. +*/ + +Meteor.methods({ + exampleUpdateMethod: function(argument){ + // Check the argument. Assuming an Object type here. + check(argument, Object); + + // Perform the update. + try { + var exampleId = Example.update(argument._id, { + $set: { + "someKey": argument.someKey + } + }); + return exampleId; + } catch(exception) { + // If an error occurs, return it to the client. + return exception; + } + } +}); diff --git a/both/modules/_modules.js b/both/modules/_modules.js new file mode 100644 index 0000000..f13b910 --- /dev/null +++ b/both/modules/_modules.js @@ -0,0 +1,2 @@ +Modules = {}; +Modules.both = {}; diff --git a/both/modules/startup.js b/both/modules/startup.js new file mode 100644 index 0000000..adbe072 --- /dev/null +++ b/both/modules/startup.js @@ -0,0 +1,3 @@ +var startup = function() {}; + +Modules.both.startup = startup; diff --git a/both/startup.js b/both/startup.js new file mode 100644 index 0000000..dce5dec --- /dev/null +++ b/both/startup.js @@ -0,0 +1 @@ +Meteor.startup( function() { Modules.both.startup(); } ); diff --git a/client/controllers/authenticated/header.js b/client/controllers/authenticated/header.js deleted file mode 100644 index 0bd86f7..0000000 --- a/client/controllers/authenticated/header.js +++ /dev/null @@ -1,46 +0,0 @@ -/* -* Controller: Header -* Template: /client/includes/_header.html -*/ - -/* -* Created -*/ - -Template.header.onCreated(function(){ - // Code to run when template is created goes here. -}); - -/* -* Rendered -*/ - -Template.header.onRendered(function() { - // Code to run when template is rendered goes here. -}); - -/* -* Helpers -*/ - -Template.header.helpers({ - example: function(){ - // Code to run for helper function. - } -}); - -/* -* Events -*/ - -Template.header.events({ - 'click .logout': function(){ - Meteor.logout(function(error){ - if(error){ - Bert.alert(error.reason, 'danger'); - } else { - Bert.alert('Succesfully logged out!', 'success'); - } - }); - } -}); diff --git a/client/controllers/public/login.js b/client/controllers/public/login.js deleted file mode 100644 index e3e5ec3..0000000 --- a/client/controllers/public/login.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Controller: Login -* Template: /client/views/public/login.html -*/ - -/* -* Created -*/ - -Template.login.onCreated(function(){ - // Code to run when template is created goes here. -}); - -/* -* Rendered -*/ - -Template.login.onRendered(function(){ - $('#application-login').validate({ - rules: { - emailAddress: { - required: true, - email: true - }, - password: { - required: true - } - }, - messages: { - emailAddress: { - required: "Please enter your email address to login.", - email: "Please enter a valid email address." - }, - password: { - required: "Please enter your password to login." - } - }, - submitHandler: function(){ - // Grab the user's details. - user = { - email: $('[name="emailAddress"]').val(), - password: $('[name="password"]').val() - } - - // Log the user in. - Meteor.loginWithPassword(user.email, user.password, function(error){ - if(error){ - Bert.alert(error.reason, 'danger'); - } else { - Bert.alert('Logged in!', 'success'); - } - }); - } - }); -}); - -/* -* Helpers -*/ - -Template.login.helpers({ - example: function(){ - // Code to run for helper function. - } -}); - -/* -* Events -*/ - -Template.login.events({ - 'submit form': function(e){ - // Prevent form from submitting. - e.preventDefault(); - } -}); diff --git a/client/controllers/public/recover-password.js b/client/controllers/public/recover-password.js deleted file mode 100644 index c388491..0000000 --- a/client/controllers/public/recover-password.js +++ /dev/null @@ -1,68 +0,0 @@ -/* -* Controller: Recover Password -* Template: /client/views/public/recover-password.html -*/ - -/* -* Created -*/ - -Template.recoverPassword.onCreated(function(){ - // Code to run when template is created goes here. -}); - -/* -* Rendered -*/ - - -Template.recoverPassword.onRendered(function(){ - $('#application-recover-password').validate({ - rules: { - emailAddress: { - required: true, - email: true - } - }, - messages: { - emailAddress: { - required: "Please enter your email address to recover your password.", - email: "Please enter a valid email address." - } - }, - submitHandler: function(){ - // Grab the user's email address. - var email = $('[name="emailAddress"]').val(); - - // Call the send reset password email method. - Accounts.forgotPassword({email: email}, function(error){ - if(error){ - Bert.alert(error.reason, 'danger'); - } else { - Bert.alert('Check your inbox for a reset link!', 'success'); - } - }); - } - }); -}); - -/* -* Helpers -*/ - -Template.recoverPassword.helpers({ - example: function(){ - // Code to run for helper function. - } -}); - -/* -* Events -*/ - -Template.recoverPassword.events({ - 'submit form': function(e){ - // Prevent form from submitting. - e.preventDefault(); - } -}); diff --git a/client/controllers/public/reset-password.js b/client/controllers/public/reset-password.js deleted file mode 100644 index e17c7be..0000000 --- a/client/controllers/public/reset-password.js +++ /dev/null @@ -1,78 +0,0 @@ -/* -* Controller: Reset Password -* Template: /client/views/public/reset-password.html -*/ - -/* -* Created -*/ - -Template.resetPassword.onCreated(function(){ - // Code to run when template is created goes here. -}); - -/* -* Rendered -*/ - -Template.resetPassword.onRendered(function(){ - $('#application-reset-password').validate({ - rules: { - newPassword: { - required: true, - minlength: 6 - }, - repeatNewPassword: { - required: true, - minlength: 6, - equalTo: "[name='newPassword']" - } - }, - messages: { - newPassword: { - required: "Please enter a new password.", - minlength: "Please use at least six characters." - }, - repeatNewPassword: { - required: "Please repeat your new password.", - equalTo: "Your password do not match. Please try again." - } - }, - submitHandler: function(){ - // Grab the user's reset token and new password. - var token = Session.get('resetPasswordToken'), - password = $('[name="newPassword"]').val(); - - // Reset the user's password. - Accounts.resetPassword(token, password, function(error){ - if(error){ - Bert.alert(error.reason, 'danger'); - } else { - Bert.alert('Password successfully reset!', 'success'); - Session.set('resetPasswordToken', null); - } - }); - } - }); -}); - -/* -* Helpers -*/ - -Template.resetPassword.helpers({ - example: function(){ - // Code to run for helper function. - } -}); - -/* -* Events -*/ - -Template.resetPassword.events({ - 'submit form': function(e){ - // Prevent form from submitting. - e.preventDefault(); - } -}); diff --git a/client/controllers/public/signup.js b/client/controllers/public/signup.js deleted file mode 100644 index 60c3ad1..0000000 --- a/client/controllers/public/signup.js +++ /dev/null @@ -1,78 +0,0 @@ -/* -* Controller: Signup -* Template: /client/views/public/signup.html -*/ - -/* -* Created -*/ - -Template.signup.onCreated(function(){ - // Code to run when template is created goes here. -}); - -/* -* Rendered -*/ - -Template.signup.onRendered(function(){ - $('#application-signup').validate({ - rules: { - emailAddress: { - required: true, - email: true - }, - password: { - required: true, - minlength: 6 - } - }, - messages: { - emailAddress: { - required: "Please enter your email address to sign up.", - email: "Please enter a valid email address." - }, - password: { - required: "Please enter a password to sign up.", - minlength: "Please use at least six characters." - } - }, - submitHandler: function(){ - // Grab the user's details. - user = { - email: $('[name="emailAddress"]').val(), - password: $('[name="password"]').val() - } - - // Create the user's account. - Accounts.createUser({email: user.email, password: user.password}, function(error){ - if(error){ - Bert.alert(error.reason, 'danger'); - } else { - Bert.alert('Welcome!', 'success'); - } - }); - } - }); -}); - -/* -* Helpers -*/ - -Template.signup.helpers({ - example: function(){ - // Code to run for helper function. - } -}); - -/* -* Events -*/ - -Template.signup.events({ - 'submit form': function(e){ - // Prevent form from submitting. - e.preventDefault(); - } -}); diff --git a/client/helpers/helpers-ui.js b/client/helpers/helpers-ui.js deleted file mode 100644 index 89a83cf..0000000 --- a/client/helpers/helpers-ui.js +++ /dev/null @@ -1,15 +0,0 @@ -/* -* UI Helpers -* Define UI helpers for common template functionality. -*/ - -/* -* Current Route -* Return an active class if the currentRoute session variable name -* (set in the appropriate file in /client/routes/) is equal to the name passed -* to the helper in the template. -*/ - -UI.registerHelper('currentRoute', function(route){ - return Session.equals('currentRoute', route) ? 'active' : ''; -}); diff --git a/client/helpers/template.js b/client/helpers/template.js new file mode 100644 index 0000000..89a83cf --- /dev/null +++ b/client/helpers/template.js @@ -0,0 +1,15 @@ +/* +* UI Helpers +* Define UI helpers for common template functionality. +*/ + +/* +* Current Route +* Return an active class if the currentRoute session variable name +* (set in the appropriate file in /client/routes/) is equal to the name passed +* to the helper in the template. +*/ + +UI.registerHelper('currentRoute', function(route){ + return Session.equals('currentRoute', route) ? 'active' : ''; +}); diff --git a/client/includes/_header.html b/client/includes/_header.html deleted file mode 100644 index 9fbe3f7..0000000 --- a/client/includes/_header.html +++ /dev/null @@ -1,32 +0,0 @@ - diff --git a/client/layouts/layout-default.html b/client/layouts/layout-default.html deleted file mode 100644 index a5090e9..0000000 --- a/client/layouts/layout-default.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/client/modules/_modules.js b/client/modules/_modules.js new file mode 100644 index 0000000..b97216f --- /dev/null +++ b/client/modules/_modules.js @@ -0,0 +1 @@ +Modules.client = {}; diff --git a/client/modules/startup.js b/client/modules/startup.js new file mode 100644 index 0000000..5d737f4 --- /dev/null +++ b/client/modules/startup.js @@ -0,0 +1,3 @@ +var startup = function() {}; + +Modules.client.startup = startup; diff --git a/client/startup.js b/client/startup.js new file mode 100644 index 0000000..4db56b0 --- /dev/null +++ b/client/startup.js @@ -0,0 +1 @@ +Meteor.startup( function() { Modules.client.startup(); } ); diff --git a/client/stylesheets/application.scss b/client/stylesheets/application.scss new file mode 100644 index 0000000..5fbade7 --- /dev/null +++ b/client/stylesheets/application.scss @@ -0,0 +1,3 @@ +@import "tools/extends"; + +@import "components/login"; diff --git a/client/stylesheets/components/_login.scss b/client/stylesheets/components/_login.scss new file mode 100644 index 0000000..e0744e8 --- /dev/null +++ b/client/stylesheets/components/_login.scss @@ -0,0 +1,4 @@ +.login label { + display: block; + @extend %clearfix; +} diff --git a/client/stylesheets/sass/application.scss b/client/stylesheets/sass/application.scss deleted file mode 100644 index 327a830..0000000 --- a/client/stylesheets/sass/application.scss +++ /dev/null @@ -1,5 +0,0 @@ -/* Globals */ -@import "globals/extends"; - -/* Views */ -@import "views/public/login"; diff --git a/client/stylesheets/sass/globals/_extends.scss b/client/stylesheets/sass/globals/_extends.scss deleted file mode 100644 index f0ea750..0000000 --- a/client/stylesheets/sass/globals/_extends.scss +++ /dev/null @@ -1,17 +0,0 @@ -/* - Clearfix - via http://nicolasgallagher.com/micro-clearfix-hack -*/ -%clearfix { - *zoom: 1; - - &:before, - &:after { - display: table; - content: ""; - } - - &:after { - clear: both; - } -} diff --git a/client/stylesheets/sass/views/public/_login.scss b/client/stylesheets/sass/views/public/_login.scss deleted file mode 100644 index e0744e8..0000000 --- a/client/stylesheets/sass/views/public/_login.scss +++ /dev/null @@ -1,4 +0,0 @@ -.login label { - display: block; - @extend %clearfix; -} diff --git a/client/stylesheets/tools/_extends.scss b/client/stylesheets/tools/_extends.scss new file mode 100644 index 0000000..f0ea750 --- /dev/null +++ b/client/stylesheets/tools/_extends.scss @@ -0,0 +1,17 @@ +/* + Clearfix + via http://nicolasgallagher.com/micro-clearfix-hack +*/ +%clearfix { + *zoom: 1; + + &:before, + &:after { + display: table; + content: ""; + } + + &:after { + clear: both; + } +} diff --git a/client/templates/authenticated/index.html b/client/templates/authenticated/index.html new file mode 100644 index 0000000..d62b919 --- /dev/null +++ b/client/templates/authenticated/index.html @@ -0,0 +1,3 @@ + diff --git a/client/templates/globals/header.html b/client/templates/globals/header.html new file mode 100644 index 0000000..5ecd284 --- /dev/null +++ b/client/templates/globals/header.html @@ -0,0 +1,32 @@ + diff --git a/client/templates/globals/header.js b/client/templates/globals/header.js new file mode 100644 index 0000000..0bd86f7 --- /dev/null +++ b/client/templates/globals/header.js @@ -0,0 +1,46 @@ +/* +* Controller: Header +* Template: /client/includes/_header.html +*/ + +/* +* Created +*/ + +Template.header.onCreated(function(){ + // Code to run when template is created goes here. +}); + +/* +* Rendered +*/ + +Template.header.onRendered(function() { + // Code to run when template is rendered goes here. +}); + +/* +* Helpers +*/ + +Template.header.helpers({ + example: function(){ + // Code to run for helper function. + } +}); + +/* +* Events +*/ + +Template.header.events({ + 'click .logout': function(){ + Meteor.logout(function(error){ + if(error){ + Bert.alert(error.reason, 'danger'); + } else { + Bert.alert('Succesfully logged out!', 'success'); + } + }); + } +}); diff --git a/client/templates/layouts/layout-default.html b/client/templates/layouts/layout-default.html new file mode 100644 index 0000000..a5090e9 --- /dev/null +++ b/client/templates/layouts/layout-default.html @@ -0,0 +1,7 @@ + diff --git a/client/templates/public/loading.html b/client/templates/public/loading.html new file mode 100644 index 0000000..effbcbc --- /dev/null +++ b/client/templates/public/loading.html @@ -0,0 +1,3 @@ + diff --git a/client/templates/public/login.html b/client/templates/public/login.html new file mode 100644 index 0000000..744999c --- /dev/null +++ b/client/templates/public/login.html @@ -0,0 +1,21 @@ + diff --git a/client/templates/public/login.js b/client/templates/public/login.js new file mode 100644 index 0000000..e3e5ec3 --- /dev/null +++ b/client/templates/public/login.js @@ -0,0 +1,76 @@ +/* +* Controller: Login +* Template: /client/views/public/login.html +*/ + +/* +* Created +*/ + +Template.login.onCreated(function(){ + // Code to run when template is created goes here. +}); + +/* +* Rendered +*/ + +Template.login.onRendered(function(){ + $('#application-login').validate({ + rules: { + emailAddress: { + required: true, + email: true + }, + password: { + required: true + } + }, + messages: { + emailAddress: { + required: "Please enter your email address to login.", + email: "Please enter a valid email address." + }, + password: { + required: "Please enter your password to login." + } + }, + submitHandler: function(){ + // Grab the user's details. + user = { + email: $('[name="emailAddress"]').val(), + password: $('[name="password"]').val() + } + + // Log the user in. + Meteor.loginWithPassword(user.email, user.password, function(error){ + if(error){ + Bert.alert(error.reason, 'danger'); + } else { + Bert.alert('Logged in!', 'success'); + } + }); + } + }); +}); + +/* +* Helpers +*/ + +Template.login.helpers({ + example: function(){ + // Code to run for helper function. + } +}); + +/* +* Events +*/ + +Template.login.events({ + 'submit form': function(e){ + // Prevent form from submitting. + e.preventDefault(); + } +}); diff --git a/client/templates/public/not-found.html b/client/templates/public/not-found.html new file mode 100644 index 0000000..b8df76e --- /dev/null +++ b/client/templates/public/not-found.html @@ -0,0 +1,3 @@ + diff --git a/client/templates/public/recover-password.html b/client/templates/public/recover-password.html new file mode 100644 index 0000000..f6c6e9d --- /dev/null +++ b/client/templates/public/recover-password.html @@ -0,0 +1,17 @@ + diff --git a/client/templates/public/recover-password.js b/client/templates/public/recover-password.js new file mode 100644 index 0000000..c388491 --- /dev/null +++ b/client/templates/public/recover-password.js @@ -0,0 +1,68 @@ +/* +* Controller: Recover Password +* Template: /client/views/public/recover-password.html +*/ + +/* +* Created +*/ + +Template.recoverPassword.onCreated(function(){ + // Code to run when template is created goes here. +}); + +/* +* Rendered +*/ + + +Template.recoverPassword.onRendered(function(){ + $('#application-recover-password').validate({ + rules: { + emailAddress: { + required: true, + email: true + } + }, + messages: { + emailAddress: { + required: "Please enter your email address to recover your password.", + email: "Please enter a valid email address." + } + }, + submitHandler: function(){ + // Grab the user's email address. + var email = $('[name="emailAddress"]').val(); + + // Call the send reset password email method. + Accounts.forgotPassword({email: email}, function(error){ + if(error){ + Bert.alert(error.reason, 'danger'); + } else { + Bert.alert('Check your inbox for a reset link!', 'success'); + } + }); + } + }); +}); + +/* +* Helpers +*/ + +Template.recoverPassword.helpers({ + example: function(){ + // Code to run for helper function. + } +}); + +/* +* Events +*/ + +Template.recoverPassword.events({ + 'submit form': function(e){ + // Prevent form from submitting. + e.preventDefault(); + } +}); diff --git a/client/templates/public/reset-password.html b/client/templates/public/reset-password.html new file mode 100644 index 0000000..c5c8ded --- /dev/null +++ b/client/templates/public/reset-password.html @@ -0,0 +1,21 @@ + diff --git a/client/templates/public/reset-password.js b/client/templates/public/reset-password.js new file mode 100644 index 0000000..e17c7be --- /dev/null +++ b/client/templates/public/reset-password.js @@ -0,0 +1,78 @@ +/* +* Controller: Reset Password +* Template: /client/views/public/reset-password.html +*/ + +/* +* Created +*/ + +Template.resetPassword.onCreated(function(){ + // Code to run when template is created goes here. +}); + +/* +* Rendered +*/ + +Template.resetPassword.onRendered(function(){ + $('#application-reset-password').validate({ + rules: { + newPassword: { + required: true, + minlength: 6 + }, + repeatNewPassword: { + required: true, + minlength: 6, + equalTo: "[name='newPassword']" + } + }, + messages: { + newPassword: { + required: "Please enter a new password.", + minlength: "Please use at least six characters." + }, + repeatNewPassword: { + required: "Please repeat your new password.", + equalTo: "Your password do not match. Please try again." + } + }, + submitHandler: function(){ + // Grab the user's reset token and new password. + var token = Session.get('resetPasswordToken'), + password = $('[name="newPassword"]').val(); + + // Reset the user's password. + Accounts.resetPassword(token, password, function(error){ + if(error){ + Bert.alert(error.reason, 'danger'); + } else { + Bert.alert('Password successfully reset!', 'success'); + Session.set('resetPasswordToken', null); + } + }); + } + }); +}); + +/* +* Helpers +*/ + +Template.resetPassword.helpers({ + example: function(){ + // Code to run for helper function. + } +}); + +/* +* Events +*/ + +Template.resetPassword.events({ + 'submit form': function(e){ + // Prevent form from submitting. + e.preventDefault(); + } +}); diff --git a/client/templates/public/signup.html b/client/templates/public/signup.html new file mode 100644 index 0000000..5a7e961 --- /dev/null +++ b/client/templates/public/signup.html @@ -0,0 +1,21 @@ + diff --git a/client/templates/public/signup.js b/client/templates/public/signup.js new file mode 100644 index 0000000..60c3ad1 --- /dev/null +++ b/client/templates/public/signup.js @@ -0,0 +1,78 @@ +/* +* Controller: Signup +* Template: /client/views/public/signup.html +*/ + +/* +* Created +*/ + +Template.signup.onCreated(function(){ + // Code to run when template is created goes here. +}); + +/* +* Rendered +*/ + +Template.signup.onRendered(function(){ + $('#application-signup').validate({ + rules: { + emailAddress: { + required: true, + email: true + }, + password: { + required: true, + minlength: 6 + } + }, + messages: { + emailAddress: { + required: "Please enter your email address to sign up.", + email: "Please enter a valid email address." + }, + password: { + required: "Please enter a password to sign up.", + minlength: "Please use at least six characters." + } + }, + submitHandler: function(){ + // Grab the user's details. + user = { + email: $('[name="emailAddress"]').val(), + password: $('[name="password"]').val() + } + + // Create the user's account. + Accounts.createUser({email: user.email, password: user.password}, function(error){ + if(error){ + Bert.alert(error.reason, 'danger'); + } else { + Bert.alert('Welcome!', 'success'); + } + }); + } + }); +}); + +/* +* Helpers +*/ + +Template.signup.helpers({ + example: function(){ + // Code to run for helper function. + } +}); + +/* +* Events +*/ + +Template.signup.events({ + 'submit form': function(e){ + // Prevent form from submitting. + e.preventDefault(); + } +}); diff --git a/client/views/authenticated/index.html b/client/views/authenticated/index.html deleted file mode 100644 index d62b919..0000000 --- a/client/views/authenticated/index.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/client/views/public/loading.html b/client/views/public/loading.html deleted file mode 100644 index effbcbc..0000000 --- a/client/views/public/loading.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/client/views/public/login.html b/client/views/public/login.html deleted file mode 100644 index 744999c..0000000 --- a/client/views/public/login.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/client/views/public/not-found.html b/client/views/public/not-found.html deleted file mode 100644 index b8df76e..0000000 --- a/client/views/public/not-found.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/client/views/public/recover-password.html b/client/views/public/recover-password.html deleted file mode 100644 index f6c6e9d..0000000 --- a/client/views/public/recover-password.html +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/client/views/public/reset-password.html b/client/views/public/reset-password.html deleted file mode 100644 index c5c8ded..0000000 --- a/client/views/public/reset-password.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/client/views/public/signup.html b/client/views/public/signup.html deleted file mode 100644 index 5a7e961..0000000 --- a/client/views/public/signup.html +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/packages.json b/packages.json index 077404a..0967ef4 100644 --- a/packages.json +++ b/packages.json @@ -1,3 +1 @@ -{ - -} \ No newline at end of file +{} diff --git a/packages/npm-container/index.js b/packages/npm-container/index.js new file mode 100644 index 0000000..c3fc862 --- /dev/null +++ b/packages/npm-container/index.js @@ -0,0 +1,9 @@ +Meteor.npmRequire = function(moduleName) { + var module = Npm.require(moduleName); + return module; +}; + +Meteor.require = function(moduleName) { + console.warn('Meteor.require is deprecated. Please use Meteor.npmRequire instead!'); + return Meteor.npmRequire(moduleName); +}; \ No newline at end of file diff --git a/packages/npm-container/package.js b/packages/npm-container/package.js new file mode 100644 index 0000000..9fab3ce --- /dev/null +++ b/packages/npm-container/package.js @@ -0,0 +1,30 @@ +var path = Npm.require('path'); +var fs = Npm.require('fs'); + +Package.describe({ + summary: 'Contains all your npm dependencies', + version: '1.2.0', + name: 'npm-container' +}); + +var packagesJsonFile = path.resolve('./packages.json'); +try { + var fileContent = fs.readFileSync(packagesJsonFile); + var packages = JSON.parse(fileContent.toString()); + Npm.depends(packages); +} catch (ex) { + console.error('ERROR: packages.json parsing error [ ' + ex.message + ' ]'); +} + +// Adding the app's packages.json as a used file for this package will get +// Meteor to watch it and reload this package when it changes +Package.onUse(function(api) { + api.addFiles('index.js', 'server'); + if (api.addAssets) { + api.addAssets('../../packages.json', 'server'); + } else { + api.addFiles('../../packages.json', 'server', { + isAsset: true + }); + } +}); \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100755 index 0000000000000000000000000000000000000000..6a0bdc9aca2646e4da474db8d2ce675b07133d65 GIT binary patch literal 5430 zcmeHLSx*yD6dsK~fS=GOu!EI5w&{ z^*WAQ&vBee<$r#}<}b6k4Q!76WE}o^Hb~N@^g;ZuS8~Q6lB4jiv}_E00}d=KcrkDD zpjpFXPvNkv?<^`Ef!pmvSC0+n%O_EGVFHcstl;N8C_XtFQHQ3T$AH#>l&qz3J#}sz zon5ww^43`ouHKrC$S1XCn==RDV!ofbI1!aR>9kngsEE=&$+vvv(bh4)#6GQ~l)qAQ z$4`&J>-C|qWF#O{RXu~xt#g5ADY@Xe#`jiC8C_5xH3%|ACr04&`H-16BufXaU44T^ z$OFow@ktkGUD9&2vgAcy@(YGhQ8|su`$ps))GLw|b;Ns=ED8!Hsm`d_wUJ#^kCvl& zf5)nR`Fm_NR`O#-wQEbZ7O5fiJf1P!%IsaaK821SHkd7LIGtYD>|W>$PSm|H%f_;3 ze59H=I<|mtMELle)yK3Q%IaYxfAR|SLY)8Kj5C^5_QKhy+`RV_K Xc