Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactor messaging a bit

  • Loading branch information...
commit 40bd52849b4730f5c7facbb99f2435d94e0ad8dc 1 parent 2fdbc32
@theresaanna authored
View
2  client/login/login.html
@@ -8,7 +8,7 @@
</body>
<template name="loginForm">
- <form>
+ <form id="login">
<label>Please enter your email to login.</label>
<p><a href="#" class="register">I'm new!</a></p>
<input type="text" name="email" id="emailaddr" value="Email" />
View
23 client/login/login.js
@@ -22,27 +22,6 @@ Template.loginForm.events = {
}
}
};
-
-Template.messages = function() {
- return Session.get('message');
-};
-
-// FOR CONSIDERATION: currently messaging system
-// only supports one message at a time
-Meteor.userAlert = function(alert) {
- var updateMessages = function() {
- var context = new Meteor.deps.Context();
- context.on_invalidate(updateMessages);
- context.run(function() {
- var tmpl = Meteor.ui.render(function() {
- return Template.messages();
- });
- $('body').prepend(tmpl);
- })
- }
- updateMessages();
-}
-
// takes: email field input
// returns: user object
function validateEmail(email) {
@@ -50,7 +29,7 @@ function validateEmail(email) {
// intentionally simplistic
var criteria = /\S+@\S+\.\S+/,
results = criteria.test(email);
-console.log(results);
+
// test email format validity
// TODO: server side validation
if (!results) {
View
14 client/messaging.js
@@ -1,7 +1,3 @@
-Template.messages = function() {
- return Session.get('message');
-};
-
// FOR CONSIDERATION: currently messaging system
// only supports one message at a time
Meteor.userAlert = function(alert) {
@@ -9,11 +5,11 @@ Meteor.userAlert = function(alert) {
var context = new Meteor.deps.Context();
context.on_invalidate(updateMessages);
context.run(function() {
- var tmpl = Meteor.ui.render(function() {
- return Template.messages();
- });
- $('#messages').fadeIn().html(tmpl);
- })
+ // empty the contents of #messages
+ // then insert new value of 'message'
+ $('#messages').empty()
+ .append(Session.get('message'));
+ });
}
updateMessages();
}
View
7 goalie.js
@@ -22,6 +22,12 @@ if (Meteor.is_client) {
},
dashboard: function() {
+ // complete and utter hack.
+ // there has to be a better way
+ // remove the login form once
+ // user logs in and dashboard loads
+ $('#login').remove();
+
var projectsView = Meteor.ui.render(function() {
return Template.projects();
});
@@ -46,7 +52,6 @@ if (Meteor.is_client) {
});
}
-
if (Meteor.is_server) {
Meteor.startup(function () {
// code to run on server at startup
Please sign in to comment.
Something went wrong with that request. Please try again.