diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 59bdeab..26f88af 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -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; diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 43d2041..5cb028b 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -187,6 +187,10 @@

{{work 'reports'}}

+
+ + Created by
{{work 'creator'}}
+
{{/unless}} @@ -277,7 +281,10 @@
-

{{name}}

+
+ {{name}} + {{creator}} +
{{dueDate}}
diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 2e08130..1817272 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -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 = []; diff --git a/hourglass/lib/router.js b/hourglass/lib/router.js index 4c6e2b2..8039b40 100644 --- a/hourglass/lib/router.js +++ b/hourglass/lib/router.js @@ -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" });