Commit c8b07469ee4d0807f321311a66ff22b4bbf21aed

Authored by Ryan Glover
1 parent 6b05a17126
Exists in master

Add themeteorchef:bert to help us with alerts.

Update /client/layouts/layout-default.html to include bertAlert template.
Update all client-side controllers to use Bert for error and success messages.
Closes #9.
1 # Meteor packages used by this project, one per line. 1 # Meteor packages used by this project, one per line.
2 # 2 #
3 # 'meteor add' and 'meteor remove' will edit this file for you, 3 # 'meteor add' and 'meteor remove' will edit this file for you,
4 # but you can also edit it by hand. 4 # but you can also edit it by hand.
5 5
6 standard-app-packages 6 standard-app-packages
7 underscore 7 underscore
8 accounts-password 8 accounts-password
9 accounts-base 9 accounts-base
10 jquery 10 jquery
11 check 11 check
12 audit-argument-checks 12 audit-argument-checks
13 iron:router 13 iron:router
14 cmather:handlebars-server 14 cmather:handlebars-server
15 themeteorchef:jquery-validation 15 themeteorchef:jquery-validation
16 particle4dev:sass@0.3.0 16 particle4dev:sass@0.3.0
17 twbs:bootstrap 17 twbs:bootstrap
18 browser-policy 18 browser-policy
19 meteorhacks:npm 19 meteorhacks:npm
20 20
21 21
22 npm-container
22 npm-container
23 themeteorchef:bert
1 accounts-base@1.1.3 1 accounts-base@1.1.3
2 accounts-password@1.0.6 2 accounts-password@1.0.6
3 application-configuration@1.0.4 3 application-configuration@1.0.4
4 audit-argument-checks@1.0.2 4 audit-argument-checks@1.0.2
5 autoupdate@1.1.5 5 autoupdate@1.1.5
6 base64@1.0.2 6 base64@1.0.2
7 binary-heap@1.0.2 7 binary-heap@1.0.2
8 blaze@2.0.4 8 blaze@2.0.4
9 blaze-tools@1.0.2 9 blaze-tools@1.0.2
10 boilerplate-generator@1.0.2 10 boilerplate-generator@1.0.2
11 browser-policy@1.0.3 11 browser-policy@1.0.3
12 browser-policy-common@1.0.2 12 browser-policy-common@1.0.2
13 browser-policy-content@1.0.3 13 browser-policy-content@1.0.3
14 browser-policy-framing@1.0.3 14 browser-policy-framing@1.0.3
15 callback-hook@1.0.2 15 callback-hook@1.0.2
16 check@1.0.4 16 check@1.0.4
17 cmather:handlebars-server@2.0.0 17 cmather:handlebars-server@2.0.0
18 ddp@1.0.14 18 ddp@1.0.14
19 deps@1.0.6 19 deps@1.0.6
20 ejson@1.0.5 20 ejson@1.0.5
21 email@1.0.5 21 email@1.0.5
22 fastclick@1.0.2 22 fastclick@1.0.2
23 follower-livedata@1.0.3 23 follower-livedata@1.0.3
24 geojson-utils@1.0.2 24 geojson-utils@1.0.2
25 handlebars@1.0.2 25 handlebars@1.0.2
26 html-tools@1.0.3 26 html-tools@1.0.3
27 htmljs@1.0.3 27 htmljs@1.0.3
28 http@1.0.10 28 http@1.0.10
29 id-map@1.0.2 29 id-map@1.0.2
30 iron:controller@1.0.7 30 iron:controller@1.0.7
31 iron:core@1.0.7 31 iron:core@1.0.7
32 iron:dynamic-template@1.0.7 32 iron:dynamic-template@1.0.7
33 iron:layout@1.0.7 33 iron:layout@1.0.7
34 iron:location@1.0.7 34 iron:location@1.0.7
35 iron:middleware-stack@1.0.7 35 iron:middleware-stack@1.0.7
36 iron:router@1.0.7 36 iron:router@1.0.7
37 iron:url@1.0.7 37 iron:url@1.0.7
38 jquery@1.11.3 38 jquery@1.11.3
39 json@1.0.2 39 json@1.0.2
40 launch-screen@1.0.1 40 launch-screen@1.0.1
41 livedata@1.0.12 41 livedata@1.0.12
42 localstorage@1.0.2 42 localstorage@1.0.2
43 logging@1.0.6 43 logging@1.0.6
44 meteor@1.1.4 44 meteor@1.1.4
45 meteor-platform@1.2.1 45 meteor-platform@1.2.1
46 meteorhacks:async@1.0.0 46 meteorhacks:async@1.0.0
47 meteorhacks:npm@1.2.2 47 meteorhacks:npm@1.2.2
48 minifiers@1.1.3 48 minifiers@1.1.3
49 minimongo@1.0.6 49 minimongo@1.0.6
50 mobile-status-bar@1.0.2 50 mobile-status-bar@1.0.2
51 mongo@1.0.11 51 mongo@1.0.11
52 npm-bcrypt@0.7.7 52 npm-bcrypt@0.7.7
53 npm-container@1.0.0 53 npm-container@1.0.0
54 observe-sequence@1.0.4 54 observe-sequence@1.0.4
55 ordered-dict@1.0.2 55 ordered-dict@1.0.2
56 particle4dev:sass@0.3.0 56 particle4dev:sass@0.3.0
57 random@1.0.2 57 random@1.0.2
58 reactive-dict@1.0.5 58 reactive-dict@1.0.5
59 reactive-var@1.0.4 59 reactive-var@1.0.4
60 reload@1.1.2 60 reload@1.1.2
61 retry@1.0.2 61 retry@1.0.2
62 routepolicy@1.0.4 62 routepolicy@1.0.4
63 service-configuration@1.0.3 63 service-configuration@1.0.3
64 session@1.0.5 64 session@1.0.5
65 sha@1.0.2 65 sha@1.0.2
66 spacebars@1.0.5 66 spacebars@1.0.5
67 spacebars-compiler@1.0.4 67 spacebars-compiler@1.0.4
68 srp@1.0.2 68 srp@1.0.2
69 standard-app-packages@1.0.4 69 standard-app-packages@1.0.4
70 templating@1.0.11 70 templating@1.0.11
71 themeteorchef:bert@1.0.1
71 themeteorchef:jquery-validation@1.13.1 72 themeteorchef:jquery-validation@1.13.1
72 tracker@1.0.5 73 tracker@1.0.5
73 twbs:bootstrap@3.3.1_2 74 twbs:bootstrap@3.3.1_2
74 ui@1.0.5 75 ui@1.0.5
75 underscore@1.0.2 76 underscore@1.0.2
76 url@1.0.3 77 url@1.0.3
77 webapp@1.1.6 78 webapp@1.1.6
78 webapp-hashing@1.0.2 79 webapp-hashing@1.0.2
79 80
client/controllers/authenticated/header.js
1 /* 1 /*
2 * Controller: Header 2 * Controller: Header
3 * Template: /client/includes/_header.html 3 * Template: /client/includes/_header.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.header.created = function(){ 10 Template.header.created = function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 }
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.header.rendered = function() { 18 Template.header.rendered = function() {
19 // Code to run when template is rendered goes here. 19 // Code to run when template is rendered goes here.
20 } 20 }
21 21
22 /* 22 /*
23 * Helpers 23 * Helpers
24 */ 24 */
25 25
26 Template.header.helpers({ 26 Template.header.helpers({
27 example: function(){ 27 example: function(){
28 // Code to run for helper function. 28 // Code to run for helper function.
29 } 29 }
30 }); 30 });
31 31
32 /* 32 /*
33 * Events 33 * Events
34 */ 34 */
35 35
36 Template.header.events({ 36 Template.header.events({
37 'click .logout': function(){ 37 'click .logout': function(){
38 Meteor.logout(function(error){ 38 Meteor.logout(function(error){
39 if(error){ 39 if(error){
40 alert(error.reason); 40 Bert.alert(error.reason, 'danger');
41 } else {
42 Bert.alert('Succesfully logged out!', 'success');
41 } 43 }
42 }); 44 });
43 } 45 }
44 }); 46 });
45 47
client/controllers/public/login.js
1 /* 1 /*
2 * Controller: Login 2 * Controller: Login
3 * Template: /client/views/public/login.html 3 * Template: /client/views/public/login.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.login.created = function(){ 10 Template.login.created = function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 }
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.login.rendered = function(){ 18 Template.login.rendered = function(){
19 $('#application-login').validate({ 19 $('#application-login').validate({
20 rules: { 20 rules: {
21 emailAddress: { 21 emailAddress: {
22 required: true, 22 required: true,
23 email: true 23 email: true
24 }, 24 },
25 password: { 25 password: {
26 required: true 26 required: true
27 } 27 }
28 }, 28 },
29 messages: { 29 messages: {
30 emailAddress: { 30 emailAddress: {
31 required: "Please enter your email address to login.", 31 required: "Please enter your email address to login.",
32 email: "Please enter a valid email address." 32 email: "Please enter a valid email address."
33 }, 33 },
34 password: { 34 password: {
35 required: "Please enter your password to login." 35 required: "Please enter your password to login."
36 } 36 }
37 }, 37 },
38 submitHandler: function(){ 38 submitHandler: function(){
39 // Grab the user's details. 39 // Grab the user's details.
40 user = { 40 user = {
41 email: $('[name="emailAddress"]').val(), 41 email: $('[name="emailAddress"]').val(),
42 password: $('[name="password"]').val() 42 password: $('[name="password"]').val()
43 } 43 }
44 44
45 // Log the user in. 45 // Log the user in.
46 Meteor.loginWithPassword(user.email, user.password, function(error){ 46 Meteor.loginWithPassword(user.email, user.password, function(error){
47 if(error){ 47 if(error){
48 alert(error.reason); 48 Bert.alert(error.reason, 'danger');
49 } else {
50 Bert.alert('Logged in!', 'success');
49 } 51 }
50 }); 52 });
51 } 53 }
52 }); 54 });
53 } 55 }
54 56
55 /* 57 /*
56 * Helpers 58 * Helpers
57 */ 59 */
58 60
59 Template.login.helpers({ 61 Template.login.helpers({
60 example: function(){ 62 example: function(){
61 // Code to run for helper function. 63 // Code to run for helper function.
62 } 64 }
63 }); 65 });
64 66
65 /* 67 /*
66 * Events 68 * Events
67 */ 69 */
68 70
69 Template.login.events({ 71 Template.login.events({
70 'submit form': function(e){ 72 'submit form': function(e){
71 // Prevent form from submitting. 73 // Prevent form from submitting.
72 e.preventDefault(); 74 e.preventDefault();
73 } 75 }
74 }); 76 });
75 77
client/controllers/public/recover-password.js
1 /* 1 /*
2 * Controller: Recover Password 2 * Controller: Recover Password
3 * Template: /client/views/public/recover-password.html 3 * Template: /client/views/public/recover-password.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.recoverPassword.created = function(){ 10 Template.recoverPassword.created = function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 }
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 18
19 Template.recoverPassword.rendered = function(){ 19 Template.recoverPassword.rendered = function(){
20 $('#application-recover-password').validate({ 20 $('#application-recover-password').validate({
21 rules: { 21 rules: {
22 emailAddress: { 22 emailAddress: {
23 required: true, 23 required: true,
24 email: true 24 email: true
25 } 25 }
26 }, 26 },
27 messages: { 27 messages: {
28 emailAddress: { 28 emailAddress: {
29 required: "Please enter your email address to recover your password.", 29 required: "Please enter your email address to recover your password.",
30 email: "Please enter a valid email address." 30 email: "Please enter a valid email address."
31 } 31 }
32 }, 32 },
33 submitHandler: function(){ 33 submitHandler: function(){
34 // Grab the user's email address. 34 // Grab the user's email address.
35 var email = $('[name="emailAddress"]').val(); 35 var email = $('[name="emailAddress"]').val();
36 36
37 // Call the send reset password email method. 37 // Call the send reset password email method.
38 Accounts.forgotPassword({email: email}, function(error){ 38 Accounts.forgotPassword({email: email}, function(error){
39 if(error){ 39 if(error){
40 alert(error.reason); 40 Bert.alert(error.reason, 'danger');
41 } else {
42 Bert.alert('Check your inbox for a reset link!', 'success');
41 } 43 }
42 }); 44 });
43 } 45 }
44 }); 46 });
45 } 47 }
46 48
47 /* 49 /*
48 * Helpers 50 * Helpers
49 */ 51 */
50 52
51 Template.recoverPassword.helpers({ 53 Template.recoverPassword.helpers({
52 example: function(){ 54 example: function(){
53 // Code to run for helper function. 55 // Code to run for helper function.
54 } 56 }
55 }); 57 });
56 58
57 /* 59 /*
58 * Events 60 * Events
59 */ 61 */
60 62
61 Template.recoverPassword.events({ 63 Template.recoverPassword.events({
62 'submit form': function(e){ 64 'submit form': function(e){
63 // Prevent form from submitting. 65 // Prevent form from submitting.
64 e.preventDefault(); 66 e.preventDefault();
65 } 67 }
66 }); 68 });
67 69
client/controllers/public/reset-password.js
1 /* 1 /*
2 * Controller: Reset Password 2 * Controller: Reset Password
3 * Template: /client/views/public/reset-password.html 3 * Template: /client/views/public/reset-password.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.resetPassword.created = function(){ 10 Template.resetPassword.created = function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 }
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.resetPassword.rendered = function(){ 18 Template.resetPassword.rendered = function(){
19 $('#application-reset-password').validate({ 19 $('#application-reset-password').validate({
20 rules: { 20 rules: {
21 newPassword: { 21 newPassword: {
22 required: true, 22 required: true,
23 minlength: 6 23 minlength: 6
24 }, 24 },
25 repeatNewPassword: { 25 repeatNewPassword: {
26 required: true, 26 required: true,
27 minlength: 6, 27 minlength: 6,
28 equalTo: "[name='newPassword']" 28 equalTo: "[name='newPassword']"
29 } 29 }
30 }, 30 },
31 messages: { 31 messages: {
32 newPassword: { 32 newPassword: {
33 required: "Please enter a new password.", 33 required: "Please enter a new password.",
34 minlength: "Please use at least six characters." 34 minlength: "Please use at least six characters."
35 }, 35 },
36 repeatNewPassword: { 36 repeatNewPassword: {
37 required: "Please repeat your new password.", 37 required: "Please repeat your new password.",
38 equalTo: "Your password do not match. Please try again." 38 equalTo: "Your password do not match. Please try again."
39 } 39 }
40 }, 40 },
41 submitHandler: function(){ 41 submitHandler: function(){
42 // Grab the user's reset token and new password. 42 // Grab the user's reset token and new password.
43 var token = Session.get('resetPasswordToken'), 43 var token = Session.get('resetPasswordToken'),
44 password = $('[name="newPassword"]').val(); 44 password = $('[name="newPassword"]').val();
45 45
46 // Reset the user's password. 46 // Reset the user's password.
47 Accounts.resetPassword(token, password, function(error){ 47 Accounts.resetPassword(token, password, function(error){
48 if(error){ 48 if(error){
49 alert(error.reason); 49 Bert.alert(error.reason, 'danger');
50 } else { 50 } else {
51 Bert.alert('Password successfully reset!', 'success');
51 Session.set('resetPasswordToken', null); 52 Session.set('resetPasswordToken', null);
52 } 53 }
53 }); 54 });
54 } 55 }
55 }); 56 });
56 } 57 }
57 58
58 /* 59 /*
59 * Helpers 60 * Helpers
60 */ 61 */
61 62
62 Template.resetPassword.helpers({ 63 Template.resetPassword.helpers({
63 example: function(){ 64 example: function(){
64 // Code to run for helper function. 65 // Code to run for helper function.
65 } 66 }
66 }); 67 });
67 68
68 /* 69 /*
69 * Events 70 * Events
70 */ 71 */
71 72
72 Template.resetPassword.events({ 73 Template.resetPassword.events({
73 'submit form': function(e){ 74 'submit form': function(e){
74 // Prevent form from submitting. 75 // Prevent form from submitting.
75 e.preventDefault(); 76 e.preventDefault();
76 } 77 }
77 }); 78 });
78 79
client/controllers/public/signup.js
1 /* 1 /*
2 * Controller: Signup 2 * Controller: Signup
3 * Template: /client/views/public/signup.html 3 * Template: /client/views/public/signup.html
4 */ 4 */
5 5
6 /* 6 /*
7 * Created 7 * Created
8 */ 8 */
9 9
10 Template.signup.created = function(){ 10 Template.signup.created = function(){
11 // Code to run when template is created goes here. 11 // Code to run when template is created goes here.
12 } 12 }
13 13
14 /* 14 /*
15 * Rendered 15 * Rendered
16 */ 16 */
17 17
18 Template.signup.rendered = function(){ 18 Template.signup.rendered = function(){
19 $('#application-signup').validate({ 19 $('#application-signup').validate({
20 rules: { 20 rules: {
21 emailAddress: { 21 emailAddress: {
22 required: true, 22 required: true,
23 email: true 23 email: true
24 }, 24 },
25 password: { 25 password: {
26 required: true, 26 required: true,
27 minlength: 6 27 minlength: 6
28 } 28 }
29 }, 29 },
30 messages: { 30 messages: {
31 emailAddress: { 31 emailAddress: {
32 required: "Please enter your email address to sign up.", 32 required: "Please enter your email address to sign up.",
33 email: "Please enter a valid email address." 33 email: "Please enter a valid email address."
34 }, 34 },
35 password: { 35 password: {
36 required: "Please enter a password to sign up.", 36 required: "Please enter a password to sign up.",
37 minlength: "Please use at least six characters." 37 minlength: "Please use at least six characters."
38 } 38 }
39 }, 39 },
40 submitHandler: function(){ 40 submitHandler: function(){
41 // Grab the user's details. 41 // Grab the user's details.
42 user = { 42 user = {
43 email: $('[name="emailAddress"]').val(), 43 email: $('[name="emailAddress"]').val(),
44 password: $('[name="password"]').val() 44 password: $('[name="password"]').val()
45 } 45 }
46 46
47 // Create the user's account. 47 // Create the user's account.
48 Accounts.createUser({email: user.email, password: user.password}, function(error){ 48 Accounts.createUser({email: user.email, password: user.password}, function(error){
49 if(error){ 49 if(error){
50 alert(error.reason); 50 Bert.alert(error.reason, 'danger');
51 } else {
52 Bert.alert('Welcome!', 'success');
51 } 53 }
52 }); 54 });
53 } 55 }
54 }); 56 });
55 } 57 }
56 58
57 /* 59 /*
58 * Helpers 60 * Helpers
59 */ 61 */
60 62
61 Template.signup.helpers({ 63 Template.signup.helpers({
62 example: function(){ 64 example: function(){
63 // Code to run for helper function. 65 // Code to run for helper function.
64 } 66 }
65 }); 67 });
66 68
67 /* 69 /*
68 * Events 70 * Events
69 */ 71 */
70 72
71 Template.signup.events({ 73 Template.signup.events({
72 'submit form': function(e){ 74 'submit form': function(e){
73 // Prevent form from submitting. 75 // Prevent form from submitting.
74 e.preventDefault(); 76 e.preventDefault();
75 } 77 }
76 }); 78 });
77 79
client/layouts/layout-default.html
1 <template name="layoutDefault"> 1 <template name="layoutDefault">
2 {{>bertAlert}}
2 {{>header}} 3 {{>header}}
3 <div class="container"> 4 <div class="container">
4 {{>yield}} 5 {{>yield}}
5 </div> 6 </div>
6 </template> 7 </template>
7 8