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

View File

@ -187,6 +187,10 @@
<i class="fa fa-thumbs-down" aria-hidden="true"></i>
<p>{{work 'reports'}}</p>
</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>
{{/unless}}
@ -277,7 +281,10 @@
<div class="workCard" workid="{{_id}}" classid="{{classid}}">
<div class="cWorkType" style="background-color:{{typeColor}}"></div>
<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>
<div style="float:right">
<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].reportLength = thisWork[j].reports.length;
thisWork[j].creator = Meteor.users.findOne({_id: thisWork[j].creator}).profile.name;
}
array[i].thisClassWork = thisWork;
}
@ -614,7 +616,6 @@ Template.main.events({
if (event.target.id !== "workDate") input.value = ele.childNodes[0].nodeValue;
input.className = "changeInput";
input.style.padding = "0.1%";
input.id = ele.id + "a";
ele.parentNode.appendChild(input);
@ -645,10 +646,10 @@ Template.main.events({
_id: Session.get("currentWork")["class"]
});
if (!(Meteor.userId() === Session.get("currentWork").creator ||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1
)) return;
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
currClass.banned.indexOf(Meteor.userId()) !== -1
)) return;
}
var op = event.target;
@ -989,8 +990,15 @@ function formReadable(input) { // Makes work information readable by users.
input.userReport = "";
}
var thisUser = Meteor.users.findOne({
_id: input.creator
});
input.confirmations = input.confirmations.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 resort = [];

View File

@ -47,7 +47,6 @@ Router.route('/profile', {
});
Router.route('/user/:email', {
template: 'user',
data: function() {
return Meteor.users.findOne({'services.google.email': this.params.email});
},
@ -55,9 +54,31 @@ Router.route('/user/:email', {
return [
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({
notFoundTemplate: "NotFound"
});