classes on profile page

This commit is contained in:
yamanq 2016-08-10 15:19:53 -04:00
parent f1d7e180f0
commit 5b575922b3
2 changed files with 59 additions and 8 deletions

View File

@ -35,15 +35,15 @@
<div id="profFunctions">
<div class="profFunction manageClass">
<i class="fa fa-tasks" aria-hidden="true"></i>
<h4 style="color:{{profClassTab 'manClass'}}">Manage my Classes</h4>
<h4 style="color:{{profClassTabColor 'manClass'}}">Manage my Classes</h4>
</div>
<div class="profFunction addClass">
<i class="fa fa-plus" aria-hidden="true"></i>
<h4 style="color:{{profClassTab 'addClass'}}">Join a Class</h4>
<h4 style="color:{{profClassTabColor 'addClass'}}">Join a Class</h4>
</div>
<div class="profFunction createClass">
<i class="fa fa-graduation-cap" aria-hidden="true"></i>
<h4 style="color:{{profClassTab 'creClass'}}">Create a Class</h4>
<h4 style="color:{{profClassTabColor 'creClass'}}">Create a Class</h4>
</div>
</div>
<div id="profClassInfoHolder">
@ -51,7 +51,7 @@
{{/if}}
{{#if profClassTab "addClass"}}
<!-- put autocomplete stuff here -->
{{> inputAutocomplete settings=classsettings placeholder="Search..."}}
{{/if}}
{{#if profClassTab "creClass"}}
{{/if}}
@ -102,4 +102,8 @@
</div>
</div>
</div>
</template>
<template name="classdisplay">
{{name}}
</template>

View File

@ -6,6 +6,21 @@ Session.set("modifying",null);
Session.set("radioDiv",null);
Template.profile.helpers({
classsettings: function() {
return {
position: "bottom",
limit: 6,
rules: [
{
token: '',
collection: classes,
field: "name",
template: Template.classdisplay,
// filter:
}
]
};
},
mainCenter() {
var width = window.innerWidth * 1600/1920 + 10;
return "width:"+width.toString()+"px;margin-left:"+-.5*width.toString()+"px";
@ -51,9 +66,13 @@ Template.profile.helpers({
classes() {
return classes.find( { status: { $eq: true }, privacy: { $eq: false }}, {sort: { subscribers: -1 }}).fetch();
},
profClassOpen(tab) {
Session.set("profClassTab",tab);
},
profClassTabColor(tab) {
        if(status === Session.get("profClassTab")) {
            return themeColors[Cookie.get("theme")].highlightText;
        } else {
            return;
        }
    },
profClassTab(tab) {
if(tab === Session.get("profClassTab")) {
return true;
@ -143,7 +162,35 @@ Template.profile.events({
closeDivFade(p.parentNode);
input.focus();
Session.set("radioDiv",null)
}
},
'click .addClass' () {
        //var functionHolder = document.getElementById("functionHolder")
        //closeDivFade(functionHolder);
        //setTimeout(function() {
            Session.set("function","addClass");
        //    openDivFade(functionHolder);
        //},300);
    },
    'click .manageClass' () {
        //var functionHolder = document.getElementById("functionHolder")
        //closeDivFade(functionHolder);
        //setTimeout(function() {
            Session.set("function","manClass");
        //    openDivFade(functionHolder);
        //},300);
    },
    'click .createClass' () {
        //var functionHolder = document.getElementById("functionHolder")
        //closeDivFade(functionHolder);
        //setTimeout(function() {
            Session.set("function","creClass");
        //    openDivFade(functionHolder);
        //},300);
    },
'click .profFunction' (event) {
        var name = event.target.className.substring(13);
        Session.set("profClassTab",name);
    }
})
function openDivFade(div) {