This commit is contained in:
Yaman Qalieh 2016-09-10 16:11:41 -04:00
commit aa16f61cea
4 changed files with 69 additions and 14 deletions

View File

@ -445,6 +445,14 @@ input, textarea {
box-shadow: 2px 2px 5px 3px #666, inset 0 0 0 99999px rgba(0,0,0,0.09); box-shadow: 2px 2px 5px 3px #666, inset 0 0 0 99999px rgba(0,0,0,0.09);
} }
.cWorkTop {
margin: 0 0 5% 0;
}
.cWorkCreator {
float: right;
}
.cWorkCont { .cWorkCont {
padding: 5%; padding: 5%;
} }
@ -473,6 +481,10 @@ input, textarea {
} }
#workDesca { #workDesca {
width: 15vw;
}
#workDatea {
width: 17vw; width: 17vw;
} }
@ -560,13 +572,13 @@ input, textarea {
} }
#workInfoContainer { #workInfoContainer {
width: 70%; width: 28vw;
margin-right: 3%; margin-right: 3%;
float: left; float: left;
} }
#workToggle { #workToggle {
width: 27%; width: 10.8vw;
float: right; float: right;
vertical-align: top; vertical-align: top;
} }
@ -1034,9 +1046,9 @@ input, textarea {
} }
.doneUser img { .doneUser img {
height: 4vh; height: 2vw;
width: 4vh; width: 2vw;
margin-right: 5%; margin-right: 0.5vw;
-moz-border-radius: 50%; -moz-border-radius: 50%;
-webkit-border-radius: 50%; -webkit-border-radius: 50%;
@ -1046,6 +1058,7 @@ input, textarea {
.doneUser span { .doneUser span {
position: absolute; position: absolute;
top: 32%; top: 32%;
width: 7.5vw;
} }
#toggleButtons { #toggleButtons {
@ -1074,8 +1087,8 @@ input, textarea {
#markDone p, #markConfirm p, #markReport p { #markDone p, #markConfirm p, #markReport p {
margin: 0; margin: 0;
display: inline; display: inline;
}
}
#markDone, #markConfirm, #markReport { #markDone, #markConfirm, #markReport {
padding: 5%; padding: 5%;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
@ -1090,6 +1103,12 @@ input, textarea {
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.15); box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.15);
} }
.workCreator span {
font-weight: 400;
font-size: 1.2vh;
text-align: center;
}
#userTab { #userTab {
width: 0; width: 0;
height: 0; height: 0;
@ -1149,7 +1168,7 @@ input, textarea {
} }
#userDropdownAvatar p { #userDropdownAvatar p {
width: 9vh; width: 15vw;
margin: 0 auto 0 auto; margin: 0 auto 0 auto;
padding-top: 12vh; padding-top: 12vh;
text-align: center; text-align: center;

View File

@ -187,6 +187,10 @@
<i class="fa fa-thumbs-down" aria-hidden="true"></i> <i class="fa fa-thumbs-down" aria-hidden="true"></i>
<p>{{work 'reports'}}</p> <p>{{work 'reports'}}</p>
</div> </div>
<div class="workCreator doneUser" onclick="window.location='/user/{{work 'email'}}'">
<img src="{{work 'avatar'}}">
<span>Created by<br>{{work 'creator'}}</span>
</div>
</div> </div>
</div> </div>
{{/unless}} {{/unless}}
@ -277,7 +281,10 @@
<div class="workCard" workid="{{_id}}" classid="{{classid}}"> <div class="workCard" workid="{{_id}}" classid="{{classid}}">
<div class="cWorkType" style="background-color:{{typeColor}}"></div> <div class="cWorkType" style="background-color:{{typeColor}}"></div>
<div class="cWorkCont"> <div class="cWorkCont">
<p class="cWorkName">{{name}}</p> <div class="cWorkTop">
<span class="cWorkName">{{name}}</span>
<span class="cWorkCreator">{{creator}}</span>
</div>
<span class="cWorkDate" style="font-weight:{{cardDate}}">{{dueDate}}</span> <span class="cWorkDate" style="font-weight:{{cardDate}}">{{dueDate}}</span>
<div style="float:right"> <div style="float:right">
<i class="fa fa-thumbs-up" aria-hidden="true"></i> <i class="fa fa-thumbs-up" aria-hidden="true"></i>

View File

@ -160,6 +160,8 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective
thisWork[j].confirmationLength = thisWork[j].confirmations.length; // Counts the number of confirmations and reports for a particular work. thisWork[j].confirmationLength = thisWork[j].confirmations.length; // Counts the number of confirmations and reports for a particular work.
thisWork[j].reportLength = thisWork[j].reports.length; thisWork[j].reportLength = thisWork[j].reports.length;
thisWork[j].creator = Meteor.users.findOne({_id: thisWork[j].creator}).profile.name;
} }
array[i].thisClassWork = thisWork; array[i].thisClassWork = thisWork;
} }
@ -614,7 +616,6 @@ Template.main.events({
if (event.target.id !== "workDate") input.value = ele.childNodes[0].nodeValue; if (event.target.id !== "workDate") input.value = ele.childNodes[0].nodeValue;
input.className = "changeInput"; input.className = "changeInput";
input.style.padding = "0.1%"; input.style.padding = "0.1%";
input.id = ele.id + "a"; input.id = ele.id + "a";
ele.parentNode.appendChild(input); ele.parentNode.appendChild(input);
@ -645,10 +646,10 @@ Template.main.events({
_id: Session.get("currentWork")["class"] _id: Session.get("currentWork")["class"]
}); });
if (!(Meteor.userId() === Session.get("currentWork").creator || if (!(Meteor.userId() === Session.get("currentWork").creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 || currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1 currClass.banned.indexOf(Meteor.userId()) !== -1
)) return; )) return;
} }
var op = event.target; var op = event.target;
@ -989,8 +990,15 @@ function formReadable(input) { // Makes work information readable by users.
input.userReport = ""; input.userReport = "";
} }
var thisUser = Meteor.users.findOne({
_id: input.creator
});
input.confirmations = input.confirmations.length; input.confirmations = input.confirmations.length;
input.reports = input.reports.length; input.reports = input.reports.length;
input.creator = thisUser.profile.name;
input.avatar = thisUser.profile.avatar;
input.email = thisUser.services.google.email;
var comments = input.comments; var comments = input.comments;
var resort = []; var resort = [];

View File

@ -47,7 +47,6 @@ Router.route('/profile', {
}); });
Router.route('/user/:email', { Router.route('/user/:email', {
template: 'user',
data: function() { data: function() {
return Meteor.users.findOne({'services.google.email': this.params.email}); return Meteor.users.findOne({'services.google.email': this.params.email});
}, },
@ -55,9 +54,31 @@ Router.route('/user/:email', {
return [ return [
Meteor.subscribe('users', this.params._id) Meteor.subscribe('users', this.params._id)
]; ];
},
action: function() {
if(Meteor.users.findOne({'services.google.email': this.params.email}) !== undefined) {
if(this.params.email === Meteor.user().services.google.email) {
this.redirect('/profile');
} else {
this.render('user');
}
} else {
this.render("NotFound");
}
} }
}); });
/*Router.route('/admin', {
action: function() {
console.log("hi");
if (!Roles.userIsInRole(Meteor.userId(), ['admin', 'superadmin'])) {
this.redirect("/");
} else {
this.render("admin");
}
}
});*/
Router.configure({ Router.configure({
notFoundTemplate: "NotFound" notFoundTemplate: "NotFound"
}); });