add leave class button

This commit is contained in:
Kenneth Jao 2016-08-21 22:50:23 -04:00
parent a797de4c0e
commit e68ffb9dba
4 changed files with 22 additions and 4 deletions

View File

@ -74,6 +74,7 @@ Template.registerHelper('myClasses', () => {
found.subscribers = found.subscribers.length; found.subscribers = found.subscribers.length;
if(found.admin === Meteor.userId()) found.box = " owned"; if(found.admin === Meteor.userId()) found.box = " owned";
found.mine = true;
array.push(found); array.push(found);
var thisWork = work.find({class: courses[i]}).fetch(); var thisWork = work.find({class: courses[i]}).fetch();

View File

@ -317,11 +317,11 @@
} }
.name { .name {
width: 40%; width: 45%;
} }
.teacher { .teacher {
width: 25%; width: 20%;
} }
.hour { .hour {
@ -332,6 +332,10 @@
width: 13%; width: 13%;
} }
.hour.classText, .subscribers.classText {
text-align: center;
}
#creRules { #creRules {
position: absolute; position: absolute;
} }
@ -536,7 +540,11 @@
margin-right: 5%; margin-right: 5%;
} }
.userBox .fa-times { .classBox .fa-times {
font-size: 110% !important;
}
.userBox .fa-times, .classBox .fa-times {
font-size: 150%; font-size: 150%;
-webkit-transition: color 0.4s ease; -webkit-transition: color 0.4s ease;
@ -545,7 +553,7 @@
transition: color 0.4s ease; transition: color 0.4s ease;
} }
.userBox .fa-times:hover { .userBox .fa-times:hover, .classBox .fa-times:hover {
color: #CC4444; color: #CC4444;
} }

View File

@ -58,6 +58,7 @@
<div class="classHolder" style="max-height:{{classHolderHeight}}"> <div class="classHolder" style="max-height:{{classHolderHeight}}">
{{#each myClasses}} {{#each myClasses}}
{{> classDisplay}} {{> classDisplay}}
{{/each}} {{/each}}
{{#if noclass}} {{#if noclass}}
<h3>No results found...</h3> <h3>No results found...</h3>
@ -199,6 +200,9 @@
<span class="teacher classText">{{teacher}}</span> <span class="teacher classText">{{teacher}}</span>
<span class="hour classText">{{hour}}</span> <span class="hour classText">{{hour}}</span>
<span class="subscribers classText">{{subscribers}}</span> <span class="subscribers classText">{{subscribers}}</span>
{{#if mine}}
<i class="fa fa-times" aria-hidden="true"></i>
{{/if}}
</div> </div>
</template> </template>

View File

@ -506,6 +506,11 @@ Template.profile.events({
sendData("trackUserInClass"); sendData("trackUserInClass");
}, },
'click .classBox .fa-times' (event) {
var box = event.target.parentNode;
Session.set("serverData", box.getAttribute("classid"));
sendData("leaveClass");
},
'click .userBox .fa-times' (event) { 'click .userBox .fa-times' (event) {
var box = event.target.parentNode; var box = event.target.parentNode;
Session.set("serverData", [ Session.set("serverData", [