}
}
+function tmpl_render() {
+ if (user.name) {
+ $('.username').text(user.name).attr('href', '/profile');
+ $("#login_status").show();
+ $('#login_link').text('Logout').attr('href', '/logout');
+ $('#register_link').hide();
+ $('#sign_up-link').hide();
+ } else {
+ $('.username').text('Guest');
+ $("#login_status").hide();
+ $('#login_link').text('Login').attr('href', '/login');
+ $('#register_link').show();
+ $('#sign_up-link').show();
+ }
+};
+
function render(pageId, response) {
+ console.log(user);
if (user.name) {
$('.username').text(user.name).attr('href', '/profile');
$("#login_status").show();
function checkUser(cb) {
$.get('/checkuser', function(data) {
+ console.log(data);
if (data.user) {
user = data.user;
} else {
router.add('schools', function(data, cb) {
$('#school_link').addClass('active');
+ tmpl_render();
var response = {
id: 'school',