From 725a72f21a6d2284e043b6c9d4e7241e0831f853 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 10 Sep 2016 13:39:46 -0400 Subject: [PATCH 1/4] Added creator for work --- hourglass/client/main/main.css | 21 ++++++++++++++++----- hourglass/client/main/main.html | 4 ++++ hourglass/client/main/main.js | 16 +++++++++++----- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 59bdeab..8bb506a 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -476,6 +476,10 @@ input, textarea { width: 17vw; } +#workDatea { + width: 17vw; +} + #editWorkCont { width: 100%; height: 100%; @@ -560,13 +564,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 +1038,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 +1050,7 @@ input, textarea { .doneUser span { position: absolute; top: 32%; + width: 7.5vw; } #toggleButtons { @@ -1090,6 +1095,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; diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 43d2041..aafb4f4 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -187,6 +187,10 @@

{{work 'reports'}}

+
+ + Created by
{{work 'creator'}}
+
{{/unless}} diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 2e08130..9c998fc 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -614,7 +614,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 +644,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 +988,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 = []; From b480fa655833f36dc89e31366e0f80395ac3a86e Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 10 Sep 2016 14:06:22 -0400 Subject: [PATCH 2/4] Added NotFound for undefined user, and moved redirection to router --- hourglass/client/main/main.css | 4 ++-- hourglass/lib/router.js | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 8bb506a..470a3e2 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -1079,8 +1079,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); @@ -1160,7 +1160,7 @@ input, textarea { } #userDropdownAvatar p { - width: 9vh; + width: 15vw; margin: 0 auto 0 auto; padding-top: 12vh; text-align: center; 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" }); From c82ceb9afacda72ce571436399a09dd067825255 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 10 Sep 2016 14:13:00 -0400 Subject: [PATCH 3/4] Added creator to work card --- hourglass/client/main/main.css | 8 ++++++++ hourglass/client/main/main.html | 5 ++++- hourglass/client/main/main.js | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 470a3e2..760bed7 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%; } diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index aafb4f4..5cb028b 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -281,7 +281,10 @@
-

{{name}}

+
+ {{name}} + {{creator}} +
{{dueDate}}
diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 9c998fc..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; } From 4d4fb0d69cbd6f36820b71df7457d4323457f5ae Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 10 Sep 2016 14:17:51 -0400 Subject: [PATCH 4/4] css fix --- hourglass/client/main/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 760bed7..26f88af 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -481,7 +481,7 @@ input, textarea { } #workDesca { - width: 17vw; + width: 15vw; } #workDatea {