Commit a330c5ff authored by Manuel Gauto's avatar Manuel Gauto
Browse files

Initial Commit

parents
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics
xkg2fjsp2way1kjrse
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-platform
autopublish
insecure
iron:router
ewall:foundation
aldeed:collection2
server
browser
aldeed:collection2@2.2.0
aldeed:simple-schema@1.0.3
application-configuration@1.0.3
autopublish@1.0.1
autoupdate@1.1.3
base64@1.0.1
binary-heap@1.0.1
blaze-tools@1.0.1
blaze@2.0.3
boilerplate-generator@1.0.1
callback-hook@1.0.1
check@1.0.2
ctl-helper@1.0.4
ctl@1.0.2
ddp@1.0.11
deps@1.0.5
ejson@1.0.4
ewall:foundation@5.4.7
fastclick@1.0.1
follower-livedata@1.0.2
geojson-utils@1.0.1
html-tools@1.0.2
htmljs@1.0.2
http@1.0.8
id-map@1.0.1
insecure@1.0.1
iron:controller@1.0.0
iron:core@1.0.0
iron:dynamic-template@1.0.0
iron:layout@1.0.0
iron:location@1.0.1
iron:middleware-stack@1.0.0
iron:router@1.0.1
iron:url@1.0.0
jquery@1.0.1
json@1.0.1
launch-screen@1.0.0
livedata@1.0.11
logging@1.0.5
meteor-platform@1.2.0
meteor@1.1.3
minifiers@1.1.2
minimongo@1.0.5
mobile-status-bar@1.0.1
mongo-livedata@1.0.6
mongo@1.0.8
observe-sequence@1.0.3
ordered-dict@1.0.1
random@1.0.1
reactive-dict@1.0.4
reactive-var@1.0.3
reload@1.1.1
retry@1.0.1
routepolicy@1.0.2
session@1.0.4
spacebars-compiler@1.0.3
spacebars@1.0.3
templating@1.0.9
tracker@1.0.3
ui@1.0.4
underscore@1.0.1
url@1.0.2
webapp-hashing@1.0.1
webapp@1.1.4
<template name="contentLayout">
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<h1><a href="#">SRCTChat</a></h1>
</li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li><a href="#">Right Button Active</a></li>
</ul>
<!-- Left Nav Section -->
<ul class="left">
<li><a href="#">Left Nav Button</a></li>
</ul>
</section>
</nav>
<div class="mainContent">
{{> yield}}
</div>
</template>
<template name="landing">
<h1>Hello</h1>
</template>
<template name="loginForm">
<div id="loginFormDiv">
<form id="loginForm">
<input type="text" id="username-field" placeholder="Username"/>
<br/>
<input type="text" id="password-field" placeholder="Password"/>
<br>
<input type="submit" value="Login">
</form>
</div>
</template>
//Define Collections
Channels = new Meteor.Collection("channels");
ChannelMemberships = new Meteor.Collection("channelMemberships");
Messages = new Meteor.Collection("messages");
//Define Our Schemas
var Schemas = {};
Schemas.Channel = new SimpleSchema({
name: {
type: String
},
createdBy: {
type: String
},
dateCreated: {
type: Date
}
});
Schemas.ChannelMembership = new SimpleSchema({
channelId: {
type: String
},
userId: {
type: String
}
});
Schemas.Message = new SimpleSchema({
iconUrl: {
type: String
},
channelId: {
type: String
},
senderId: {
type: String
},
isPrivate: {
type: Boolean
},
receiverId: {
type: String
},
timestamp: {
type: Date
},
content: {
type: String
}
});
//Attach Schemas
Channels.attachSchema(Schemas.Channel);
ChannelMemberships.attachSchema(Schemas.ChannelMembership);
Messages.attachSchema(Schemas.Message);
if(Meteor.isServer) {
Meteor.publish('channels', function() {
//Get UserId
var curUserId = Meteor.userId();
//Get the ChannelMemberships for the user
var channelAsso = ChannelMemberships.find({userId: curUserId}).fetch();
for(var i = 0; i < channelAsso.length; i++) {
var channelMembership = channelAssoc[i];
var channelToAdd = Channels.findOne(channelMembership.channelId);
this.added('channels', channelToAdd._id, channelToAdd);
}
this.ready();
});
Meteor.publish('messages', function() {
//Get UserId
var curUserId = Meteor.userId();
//Get the messages
var messages = Messages.find({$or: [{$or: [{senderId: curUserId}, {receiverId: curUserId}]}, {isPrivate: false}]}).fetch();
return messages;
});
Meteor.publish('channelMemberships', function() {
return ChannelMemberships.find({userId: Meteor.userId()}).fetch();
});
}
if(Meteor.isClient) {
Meteor.subscribe('channels');
Meteor.subscribe('messages');
}
Router.configure({
layoutTemplate: 'contentLayout'
});
//Landing Page
Router.route('/', function() {
this.render('landing');
});
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