Commit 26c50813 authored by Manuel Gauto's avatar Manuel Gauto
Browse files

Start on sidebar and other basic layout for homepage

parent 1a71721c
<template name="home">
<ul class="side-nav" role="navigation" title="Channel List">
{{#each channels}}
<li role="menuitem"><a id="chan-{{_id}}" href="#">{{channelName channel._id}}</a></li>
{{/each}}
</ul>
<div class="row">
<!--Side bar START-->
<div class="large-2 columns">
<ul class="side-nav" role="navigation" title="Channel List">
{{#each channels}}
<li role="menuitem"><a id="chan-{{_id}}" href="#">{{channelName channel._id}}</a></li>
{{/each}}
</ul>
</div>
<!--Side Bar END-->
<!--Messages START-->
<div class="large-7 columns">
MESSAGES
</div>
</div>
Logged In As: {{username}}
</template>
......@@ -5,5 +5,12 @@ Template.home.helpers({
channelName: function(channelId) {
var channelObj = Channels.findOne(channelId);
return channelObj.name;
},
username: function() {
return Meteor.user().profile.name;
},
messages: function(channelId) {
var messArr = Messages.find({channelId: channelId}).fetch();
return messArr;
}
});
......@@ -30,7 +30,11 @@ Router.onBeforeAction(function() {
//Landing Page
Router.route('/', function() {
this.render('landing');
if(Meteor.userId()) {
this.render('home');
} else {
this.render('landing');
}
}, {
'name': 'landing'
});
......@@ -47,4 +51,4 @@ Router.route('/logout', function() {
});
}, {
'name': 'user.logout'
});
\ No newline at end of file
});
Meteor.methods({
sendMessage: function(message) {
//Make sure that the sender is logged in
if(!this.userId) {
throw new Meteor.Error("not-logged-in",
"Must be logged in to send a message.");
}
var username = this.user.profile.name;
if(username === message.sendId) {
Messages.insert(message);
} else {
console.log("Impersonation attempt by "+username);
}
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment