-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean a bit of code. Start working on displaying conversation
- Loading branch information
1 parent
280e388
commit abcaf05
Showing
17 changed files
with
373 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template name="loading"> | ||
{{> spinner}} | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<template name="conversation"> | ||
|
||
yoyo | ||
<ul> | ||
{{#each messages}} | ||
<li>To:{{to}}, From:{{from}}</li> | ||
{{/each}} | ||
</ul> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Template.conversation.helpers({ | ||
messages: function(){ | ||
console.log('message'); | ||
|
||
return Messages.find({}, {sort: {timestamp: -1}}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
<template name="mailbox"> | ||
|
||
<a href="{{composePath}}">Compose a new message</a> | ||
<a href="{{composePath}}">Compose a new message</a> | ||
|
||
<ul> | ||
{{#each conversations}} | ||
<li>{{lastMessage}} with {{userInfo}}</li> | ||
<li><a href="{{conversationPath _id}}">{{lastMessage}} with {{userInfo.profile.name}} {{#if isMyFriend}}Yes{{else}}No{{/if}}</li> | ||
{{/each}} | ||
{{#if conversationReady}} | ||
{{#unless allConversationsLoaded}} | ||
<a class="load-more" href="#">Load more</a> | ||
{{/unless}} | ||
{{else}} | ||
{{>spinner}} | ||
{{/if}} | ||
|
||
</ul> | ||
|
||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
Template.mailbox.helpers({ | ||
conversations: function(){ | ||
return Conversations.find({owner: Meteor.userId()}); | ||
return Conversations.find({owner: Meteor.userId()},{limit: conversationsHandle.limit()}); | ||
}, | ||
conversationReady: function(){ | ||
return ! conversationsHandle.loading(); | ||
}, | ||
allConversationsLoaded: function(){ | ||
return !conversationsHandle.loading() && | ||
Conversations.find({owner: Meteor.userId()}).count() < conversationsHandle.loaded() | ||
}, | ||
userInfo: function(){ | ||
return this.with; | ||
return Meteor.users.findOne(this.with); | ||
}, | ||
isMyFriend: function(){ | ||
return _.contains(Meteor.user().friends, this.with); | ||
} | ||
}); | ||
|
||
Template.mailbox.events({ | ||
'click .load-more': function(e){ | ||
e.preventDefault(); | ||
conversationsHandle.loadNextPage(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
Template.online_friends.helpers({ | ||
friends: function(){ | ||
var friends = Meteor.user().friends || []; | ||
return Meteor.users.find({'profile.online': 1, visible: 1, _id: {$in: friends}}); | ||
return Meteor.users.find({'profile.online': 1, _id: {$in: friends}}); | ||
}, | ||
count: function(){ | ||
// console.log(Meteor.user()); | ||
var friends = Meteor.user().friends || []; | ||
return Meteor.users.find({'profile.online': 1, visible: 1, _id: {$in: friends}}).count(); | ||
return Meteor.users.find({'profile.online': 1, _id: {$in: friends}}).count(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.