Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mentor-Participant Chat Feature #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions client/components/mentorChat/mentorChat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template name="mentorChat">
<div class="mentorChat">
<div class="ui segment">
{{#if queueEnabled}}

{{#if currentTicket}}
{{#with currentTicket}}
{{#if statusIs "CLAIMED"}}
<div class="content">
<div>
<div class="ui message left floated">
<p>{{name}}: I am sitting at table #3</p>
</div>
<div class="ui message right floated">
<p>{{claimName}}: Ok, be right there</p>
</div>
</div>
<div class="ui input action" style="width: 100%;">
<input type="text" placeholder="Send a message to the participant..."/>
<div class="ui button">Send</div>
</div>
</div>
{{/if}}
{{/with}}
{{/if}}
{{/if}}
</div>
</div>
</template>
28 changes: 28 additions & 0 deletions client/components/mentorChat/mentorChat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Template.mentorChat.onCreated(function(){
this.subscribe("userTickets");
});

Template.mentorChat.helpers({
// Return the current open or claimed Ticket held by the user, if it exists
currentTicket: function(){
return Tickets.findOne({
userId: Meteor.userId(),
status: {
$in: ["OPEN", "CLAIMED"]
}
})
},
statusIs: function(status){
return this.status === status;
},
queueEnabled: function(){
var settings = Settings.findOne({});
if (settings){
return settings.queueEnabled;
}
}
});

Template.mentorChat.rendered = function(){
$(this.find('.mentorChat')).addClass('animated bounceIn')
};
16 changes: 15 additions & 1 deletion client/components/tickets/ticket/ticket.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@
<strong> Contact: </strong>
{{contact}}
</div>
<div class="content">
<div>
<div class="ui message left floated">
<p>{{name}}: I am sitting at table #3</p>
</div>
<div class="ui message right floated">
<p>You: Ok, be right there</p>
</div>
</div>
<div class="ui input action" style="width: 100%;">
<input type="text" placeholder="Send a message to the participant..."/>
<div class="ui button">Send</div>
</div>
</div>
<div class="extra content">
{{#if statusIs "OPEN"}}

Expand Down Expand Up @@ -67,4 +81,4 @@
</div>

</div>
</template>
</template>
8 changes: 8 additions & 0 deletions client/views/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
</div>
</div>
</div>
<div class="centered row">
<div class="six wide column">
{{> mentorChat }}
</div>
<div class="six wide column">
<!-- Nothing for now... but the possibilities are endless -->
</div>
</div>
</div>
</section>
</template>
Expand Down