From 3f931f617af9e77977cfe335a44c66ce3ef03c60 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Fri, 14 Oct 2016 01:49:08 -0400 Subject: [PATCH 01/15] New inputs for creating work, restriction and comments still needed --- hourglass/.meteor/packages | 5 +- hourglass/.meteor/versions | 3 +- hourglass/client/main/main.css | 47 +++--- hourglass/client/main/main.html | 28 ++-- hourglass/client/main/main.js | 258 ++++++++++++++++++++------------ hourglass/lib/constants.js | 9 +- 6 files changed, 208 insertions(+), 142 deletions(-) diff --git a/hourglass/.meteor/packages b/hourglass/.meteor/packages index b4f598e..f5dc3eb 100644 --- a/hourglass/.meteor/packages +++ b/hourglass/.meteor/packages @@ -9,10 +9,9 @@ mobile-experience@1.0.4 # Packages for a great mobile UX mongo@1.1.12_1 # The database Meteor supports right now blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views reactive-var@1.0.10 # Reactive variable for tracker -jquery@1.11.9 # Helpful client-side library +jquery # Helpful client-side library tracker@1.1.0 # Meteor's client-side reactive programming library -standard-minifier-css@1.2.0_1 # CSS minifier run for production mode standard-minifier-js@1.2.0_1 # JS minifier run for production mode es5-shim@4.6.14_1 # ECMAScript 5 compatibility for older browsers. ecmascript@0.5.8_1 # Enable ECMAScript2015+ syntax in app code @@ -36,7 +35,6 @@ underscore@1.0.9 ahref:dragula harrison:papa-parse pfafman:filesaver -flemay:less-autoprefixer natestrauser:select2 juliancwirko:s-alert juliancwirko:s-alert-stackslide @@ -44,3 +42,4 @@ aldeed:collection2 dburles:collection-helpers yogiben:admin-edit mfactory:admin-lte +standard-minifier-css diff --git a/hourglass/.meteor/versions b/hourglass/.meteor/versions index 14f2698..2aae236 100644 --- a/hourglass/.meteor/versions +++ b/hourglass/.meteor/versions @@ -42,7 +42,6 @@ email@1.0.16 es5-shim@4.6.14_1 eternicode:bootstrap-datepicker@1.6.0_3 fastclick@1.0.12 -flemay:less-autoprefixer@1.2.0 fortawesome:fontawesome@4.5.0 geojson-utils@1.0.9 google@1.1.14 @@ -74,7 +73,7 @@ meteor-base@1.0.4 meteorhacks:meteorx@1.4.1 meteorhacks:unblock@1.1.0 mfactory:admin-lte@0.0.2 -minifier-css@1.2.14 +minifier-css@1.2.14_1 minifier-js@1.2.14_1 minimongo@1.0.17 mizzao:autocomplete@0.5.1 diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index c3b5602..e322289 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -476,8 +476,8 @@ body { white-space: normal; word-break: break-all; - -webkit-filter: none; - filter: none; + -webkit-filter: none !important; + filter: none !important; } .mainClassHour { @@ -555,8 +555,8 @@ body { width: 50%; margin-top: 0; - -webkit-filter: none; - filter: none; + -webkit-filter: none !important; + filter: none !important; display: table-cell; white-space: normal; @@ -574,10 +574,12 @@ body { } input.clickModify, textarea.clickModify { + width: 100%; font-size: 2.2vh; font-weight: 200; background-color: rgba(0,0,0,0); border-color: rgba(0,0,0,0); + cursor: pointer; -webkit-transition: background-color 0.4s ease, border-color 0.4s ease; -moz-transition: background-color 0.4s ease, border-color 0.4s ease; @@ -586,9 +588,8 @@ input.clickModify, textarea.clickModify { } input.clickModify:hover, textarea.clickModify:hover { - cursor: pointer; - background-color: rgba(255,255,255,0.1); - border-color: rgba(255,255,255,0.1);; + background-color: rgba(0,0,0,0.1); + border-color: rgba(0,0,0,0.1);; } textarea.clickModify { @@ -657,8 +658,9 @@ textarea.clickModify { .clickModify.dropdown { font-size: 2.5vh; width: 100%; + border: 1px solid #666; - background-color: rgba(0,0,0,0.15); + background-color: rgba(0,0,0,0.07); cursor: pointer; outline: 0; @@ -669,7 +671,7 @@ textarea.clickModify { } .clickModify.dropdown:hover { - background-color: rgba(0,0,0,0.07); + background-color: rgba(0,0,0,0.03); } .clickModify.dropdown span { @@ -688,11 +690,14 @@ textarea.clickModify { .optionHolder { width: 100%; + margin-top: -1px; border: 1px solid #666; + border-top: none; + position: absolute; - z-index: 5; + display: none; opacity: 0; @@ -702,10 +707,6 @@ textarea.clickModify { transition: opacity 0.4s ease; } -.optionHolder:hover { - background-color: rgba(255,255,255,0.05); -} - .optionText { font-size: 150%; min-width: 10%; @@ -720,8 +721,8 @@ textarea.clickModify { transition: box-shadow 0.4s ease; } -.optionText:hover { - box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.1); +.selectedOption { + box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.2); } .workOptions p:hover, .prefOptions p:hover { @@ -757,7 +758,13 @@ textarea.clickModify { #wType { margin: 0 !important; - padding: 2%; +} + +#typeWrapper { + margin: 0 !important; + min-width: 56%; + position: relative; + display: inline-block; } .datepicker { @@ -768,11 +775,7 @@ textarea.clickModify { } .type { - width: 95%; - margin-left: 1%; -} -.type p { - padding: 3% 5% 3% 5%; + margin: -1px 0 0 0 !important; } #workComments h3 { diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index dc88f55..3244d86 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -148,31 +148,29 @@
{{commentLength}} - - +
Due Date:
- - +
Description:
- {{commentLength}} - - +
Type: - -
- {{#each selectOptions 'type'}} - {{> option}} - {{/each}} +
+ +
+ {{#each selectOptions 'type'}} + {{> option}} + {{/each}} +
+ {{#if inRole}} + {{> workDisplayEdit}} + {{else}} + {{> workDisplay}} + {{/if}} +
{{#unless newWork}}

Comments


- {{commentLength}} + {{restrict 'workComment'}}
Submit
@@ -273,7 +246,7 @@

Send an help request, feature, or bug report.


- {{commentLength}} + {{restrict 'requestArea'}}
Send
@@ -375,3 +348,68 @@ + + + + diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 919da75..3f3e7de 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -39,9 +39,7 @@ Session.set("calendarClasses", []); // Stores calendar classes. Session.set("sidebar", null); // Status of sidebar. Session.set("requests", false); // Status of requests. Session.set("newWork", null); // If user creating new work. -Session.set("currentWorkId",null); // Stores current work Id. Session.set("currentWork",null); -Session.set("modifying", null); // Stores current open input. Session.set("noclass", null); // If user does not have classes. Session.set("calCreWork", null); // If user is creating a work from calendar. Session.set("classDisp", []); // Stores current filter for classes. @@ -49,7 +47,7 @@ Session.set("typeFilter", []); // Stores type filters for classes. Session.set("typeFilterHover", null); // Stores current hovered type filter. Session.set("classDispHover", null); // Stores current hovered class filter. Session.set("refetchEvents", null); // Stores whether to get calendar events again. -Session.set("commentRestrict", ""); // Stores text for comment character restriction. +Session.set("restrictText", {}); // Stores text for comment character restriction. Template.login.rendered = function() { @@ -236,31 +234,30 @@ Template.registerHelper('pref', (val) => { // Obtains all user preferences. })[0].alias; }); -Template.registerHelper('commentLength', () => { // Returns characters left for comment length. - return Session.get("commentRestrict"); +Template.registerHelper('restrict', (input) => { // Returns characters left for comment length. + var restrict = Session.get("restrictText"); + $(".resText").removeClass("noneLeft"); + if(Object.keys(restrict).length === 0) return ""; + if(restrict[restrict.selected][0] === "0") $(".resText").addClass("noneLeft"); + return (restrict.selected === input) ? Session.get("restrictText")[input] : ""; }); -function startDragula() { - dragula([document.querySelector('#classesMode'), document.querySelector('#nonexistant')], { - moves: function(el, container, handle) { - // return handle.classList.contains("classInfo") || handle.classList.contains("mainClassName"); - return _.intersection(["classInfo", "mainClassName", "mainClassHour", "mainClassTeacher"], handle.classList).length > 0; - } - }) - .on('out', function(el) { - var els = document.getElementsByClassName("classWrapper"); - var final = []; - for (var i = 0; i < els.length; i++) { - var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid"); - final.push(classid); - } - }); -} - +Template.registerHelper('selectOptions', (val) => { + return options[val] +}); +Template.registerHelper('work', (value) => {// Returns the specified work value. + var thisWork = Session.get("currentWork"); + if (Session.equals("currentWork", null)) return; + if (Session.get("newWork") && (thisWork[value] === true || thisWork[value] === undefined)) { + return defaultWork[value]; + } else { + return formReadable(thisWork,value); + } +}) Template.main.helpers({ - themeName() { + /*themeName() { var vals = _.values(themeColors); var curtheme = Session.get("user").preferences.theme; for (var i = 0; i < vals.length; i++) { @@ -270,7 +267,7 @@ Template.main.helpers({ } } return "Custom"; - }, + },*/ schoolName() { // Finds the name of the user's school. if (Session.get("user").school === undefined || Session.get("user").school === null) return; return " - " + Session.get("user").school; @@ -381,7 +378,7 @@ Template.main.helpers({ }, eventClick: function(event, jsEvent, view) { // On-click for work. Session.set("newWork", false); - Session.set("currentWorkId", event.id); + Session.set("currentWork", work.findOne({_id: event.id})); openDivFade(document.getElementsByClassName("overlay")[0]); }, eventMouseover: function(event, jsEvent, view) { @@ -430,18 +427,6 @@ Template.main.helpers({ } return; }, - work(value) { // Returns the specified work value. - var thisWork = Session.get("currentWork"); - if (Session.equals("currentWork", null)) return; - if (Session.get("newWork") && (thisWork[value] === true || thisWork[value] === undefined)) { - return defaultWork[value]; - } else { - return formReadable(thisWork,value); - } - }, - selectOptions(val) { - return options[val]; - }, newWork() { // If user is creating a new work. return Session.get("newWork"); }, @@ -458,8 +443,9 @@ Template.main.helpers({ return array; }, inRole() { // Checks correct permissions. + if(Session.equals("currentWork",null)) return; var thisWork = work.findOne({ - _id: Session.get("currentWorkId") + _id: Session.get("currentWork")._id }); if (Session.get("newWork")) { return true; @@ -591,14 +577,14 @@ Template.main.events({ attr = event.target.getAttribute("classid"); } Session.set("newWork", true); - Session.set("currentWork",{"class": attr}); + Session.set("currentWork",{class: attr}); openDivFade(document.getElementsByClassName("overlay")[0]); }, 'click #dropdown' (event) { if (document.getElementById("userDropdown").style.display === "block") return; setTimeout(function() { openDivFade(document.getElementById("userDropdown")); - }, 300); + }, 100); }, 'click .workCard' (event) { // Display work information on work card click. var dom = event.target; @@ -747,6 +733,9 @@ Template.main.events({ var newSetting = Session.get("currentWork"); newSetting[modifyingInput.charAt(1).toLowerCase() + modifyingInput.slice(2)] = option.toLowerCase(); Session.set("currentWork", newSetting); + serverData = Session.get("currentWork"); + if(checkMissing()) return; + sendData("editWork") } else { var newSetting = Session.get("user"); newSetting.preferences[modifyingInput] = (function() { @@ -765,32 +754,13 @@ Template.main.events({ $(".selectedOption").removeClass("selectedOption"); }, - 'click #workComment' (event) { - var restrict = event.target.maxLength; - Session.set("commentRestrict", restrict - event.target.value.length.toString() + " characters left"); - var text = document.getElementById("commentrestrict"); - text.style.display = "initial"; - text.style.color = "#7E7E7E"; - }, 'input .restrict' (event) { var restrict = event.target.maxLength; var chars = restrict - event.target.value.length; - var text; - if (event.target.id === "workComment") { - text = document.getElementById("commentrestrict"); - } else if (event.target.id === "requestArea") { - text = document.getElementById("requestrestrict"); - } else { - text = document.getElementById(Session.get("modifying") + "restrict"); - } - text.style.color = "#7E7E7E"; - if (chars === restrict) { // Don't display if nothing in comment. - Session.set("commentRestrict", ""); - return; - } else if (chars === 0) { - text.style.color = "#FF1A1A"; // Make text red if 0 characters left. - } - Session.set("commentRestrict", chars.toString() + " characters left"); + var newSetting = Session.get("restrictText"); + newSetting[event.target.id] = (chars === restrict) ? "" : (chars.toString() + ((chars === 1) ? " character " : " characters ") + "left"); + newSetting.selected = event.target.id; + Session.set("restrictText", newSetting); }, 'focus #wDueDate' () { // Open date picker. $('#wDueDate').datepicker({ @@ -804,14 +774,14 @@ Template.main.events({ }, // WORK OVERLAY BUTTONS 'click #commentSubmit' (event) { // Click to submit a comment. - workId = Session.get("currentWorkId"); + workId = Session.get("currentWork")._id; var input = document.getElementById('workComment'); comment = input.value; input.value = ""; - Session.set("commentRestrict", null); if (comment !== "") { document.getElementById('workComment').value = ""; - Meteor.call('addComment', [comment, workId]); + serverData = [comment, workId]; + sendData("addComment"); } }, 'click #workSubmit' () { // Click submit work to create a work. @@ -822,7 +792,7 @@ Template.main.events({ closeDivFade(document.getElementsByClassName("overlay")[0]); }, 'click #workDelete' () { - serverData = Session.get("currentWorkId"); + serverData = Session.get("currentWork")._id; sendData("deleteWork"); closeDivFade(document.getElementsByClassName("overlay")[0]); }, @@ -851,7 +821,7 @@ Template.main.events({ var date = calWorkDate.split("-"); date = new Date(date[0], parseInt(date[1]) - 1, date[2], 11, 59, 59); Session.set("newWork", true); - Session.get("currentWorkId", classid); + Session.set("currentWork", {class: classid, dueDate: date}); openDivFade(document.getElementsByClassName("overlay")[0]); } else { // Normal clicking turns on filter. var array = Session.get("classDisp"); @@ -917,6 +887,8 @@ Template.main.events({ } }); +// Other Functions + function openDivFade(div) { div.style.display = "block"; div.style.opacity = "0"; @@ -942,13 +914,12 @@ function sendData(funcName) { // Call Meteor function, and do actions after func })); } }); - - } function closeInput() { // Close a changeable input and change it back to span. var data = getHomeworkFormData(); Session.set("currentWork", data); + Session.set("restrictText", {}); $("#"+modifyingInput).css('cursor','pointer'); if(!Session.get("newWork")) { serverData = Session.get("currentWork"); @@ -965,7 +936,6 @@ function getHomeworkFormData() { // Get all data relating to work creation. var title = inputs[i].charAt(1).toLowerCase() + inputs[i].slice(2); var thisData = (function() { if(title === "type") { - console.log($("#"+inputs[i]+" span")[0].childNodes[0].nodeValue.toLowerCase()) return $("#"+inputs[i]+" span")[0].childNodes[0].nodeValue.toLowerCase(); } else if (title === "dueDate") { var val = $("#"+inputs[i])[0].value; @@ -982,12 +952,10 @@ function getHomeworkFormData() { // Get all data relating to work creation. function checkMissing() { var no = false; - console.log("hi"); for(var key in serverData) { if(!_.contains(["name","dueDate","description","type"],key)) continue; var id = "w" + key.charAt(0).toUpperCase() + key.slice(1); - console.log(id); - if(serverData[key] === true) { + if(serverData[key] === true || serverData[key] === "") { no = true; $("#"+id).addClass("formInvalid"); $("#"+id)[0].value = ""; @@ -1095,3 +1063,20 @@ function formReadable(input, val) { // Makes work information readable by users. }).profile.name; } } + +function startDragula() { + dragula([document.querySelector('#classesMode'), document.querySelector('#nonexistant')], { + moves: function(el, container, handle) { + // return handle.classList.contains("classInfo") || handle.classList.contains("mainClassName"); + return _.intersection(["classInfo", "mainClassName", "mainClassHour", "mainClassTeacher"], handle.classList).length > 0; + } + }) + .on('out', function(el) { + var els = document.getElementsByClassName("classWrapper"); + var final = []; + for (var i = 0; i < els.length; i++) { + var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid"); + final.push(classid); + } + }); +} From 98e5575e3d2996035d10e66efc3824943d71cd17 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sun, 16 Oct 2016 19:55:19 -0400 Subject: [PATCH 03/15] Finished new inputs for profile page --- hourglass/client/main/main.css | 4 +- hourglass/client/main/main.js | 29 ++- hourglass/client/profile/profile.css | 90 +++----- hourglass/client/profile/profile.html | 207 +++++++++-------- hourglass/client/profile/profile.js | 319 +++++++++++++------------- hourglass/lib/constants.js | 11 +- 6 files changed, 332 insertions(+), 328 deletions(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 5e8103a..130fec7 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -154,7 +154,7 @@ body { .noScroll input, .noScroll textarea { font-family: 'Raleway'; background-color: #EBEBEB; - border: 3px solid #EBEBEB; + border: 3px solid #CECECE; border-radius: 3px; resize: none; } @@ -662,7 +662,7 @@ textarea.clickModify { .clickModify.dropdown { font-size: 2.5vh; width: 100%; - border: 1px solid #666; + border: 1px solid #999797; background-color: rgba(0,0,0,0.07); cursor: pointer; diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 3f3e7de..62816c1 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -69,6 +69,15 @@ Template.main.rendered = function() { Template.profile.rendered = function() { Accounts._loginButtonsSession.set('dropdownVisible', true); + $(".optionText").hover( + function() { + console.log("hi"); + $(this).addClass("selectedOption"); + }, + function() { + $(this).removeClass("selectedOption"); + } + ); }; Template.registerHelper('userProfile', () => { @@ -243,7 +252,23 @@ Template.registerHelper('restrict', (input) => { // Returns characters left for }); Template.registerHelper('selectOptions', (val) => { - return options[val] + if(val === "grade") { + var grade = []; + for(var i = 0; i < 5; i++) { + var year = (new Date).getFullYear() + i; + grade.push( { "val": year, "alias": year.toString() } ); + } + return grade; + } else if(val === "school") { + var school = []; + var schoolList = schools.find().fetch(); + for(var i = 0; i < schoolList.length; i++) { + school.push( { "val": schoolList[i].name, "alias": schoolList[i].name } ); + } + return school; + } else { + return options[val]; + } }); Template.registerHelper('work', (value) => {// Returns the specified work value. @@ -254,7 +279,7 @@ Template.registerHelper('work', (value) => {// Returns the specified work value. } else { return formReadable(thisWork,value); } -}) +}); Template.main.helpers({ /*themeName() { diff --git a/hourglass/client/profile/profile.css b/hourglass/client/profile/profile.css index 614119f..1f570cf 100644 --- a/hourglass/client/profile/profile.css +++ b/hourglass/client/profile/profile.css @@ -1,9 +1,3 @@ -.change { - font-size: 150%; - color: #BEBEBE; - cursor: pointer; -} - #profWrapper { width: 100%; height: 100%; @@ -11,21 +5,6 @@ overflow-y: hidden; } -#profPage .change { - font-size: 2.5vh; -} - -.radio { - cursor: pointer; -} - -.changeInput { - font-size: 100%; - padding: 0; - color: #BEBEBE; - position: relative; -} - .profTitle { font-size: 3vh; font-weight: 400; @@ -40,11 +19,6 @@ padding: 6% 6% 0 8%; } -#motda { - font-size: 100%; - width: 30% !important; -} - #profPage { width: 100%; height: 100%; @@ -102,6 +76,10 @@ color: #FFF; } +#motdBox input { + width: 50% !important; +} + .username { margin-left: 20% !important; } @@ -126,25 +104,6 @@ transition: opacity 0.4s ease; } -.profOptionText { - font-size: 150%; - min-width: 10%; - padding: 20px; - margin: 0; - - text-align: center; - cursor: pointer; - - -webkit-transition: box-shadow 0.4s ease; - -moz-transition: box-shadow 0.4s ease; - -ms-transition: box-shadow 0.4s ease; - transition: box-shadow 0.4s ease; -} - -.profOptions p:hover { - box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.1); -} - #profCards { width: 100%; height: 100%; @@ -179,6 +138,15 @@ text-align: left; } +#profWrapper .clickModify span { + width: 80%; + padding: 3.5% 5% 3.5% 5%; +} + +#profWrapper .clickModify, #profWrapper .optionHolder { + width: 90%; +} + #profInfo { margin-left: 0; border-top: 5px solid #CC4444; @@ -188,10 +156,6 @@ padding: 3% 5% 7% 14%; } -.radioContainer { - position: relative; -} - #classes { padding: 3% 5% 7% 7%; } @@ -242,11 +206,11 @@ } .profFunction i, .profFunction h4 { - padding: 1%; + padding: 1% !important; } .profFunction h4 { - font-size: 120%; + font-size: 120% !important; } #searchBar { @@ -404,19 +368,37 @@ position: relative; } +#formContainer .clickModify { + background-color: #EBEBEB; + border: 1px solid #CECECE; +} + +#formContainer .optionText:hover { + box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.2); +} + .formDiv { margin: 3% 6% 5% 6%; width: 35%; + position: relative; display: inline-block; } +.formDiv input { + width: 90%; +} + +#formContainer .optionHolder { + width: 96%; +} + .creInput { font-size: 2vh; padding: 3%; } -.creOp { - margin: 0 !important; +.classDropdown { + cursor: pointer; } .formDiv .-autocomplete-container { @@ -499,7 +481,7 @@ } #createdClasses { - width: 500px; + width: 600px; height: 73vh; padding: 30px 0 30px 30px; diff --git a/hourglass/client/profile/profile.html b/hourglass/client/profile/profile.html index d2b904e..d95160d 100644 --- a/hourglass/client/profile/profile.html +++ b/hourglass/client/profile/profile.html @@ -11,8 +11,10 @@ Avatar
{{username}} - - {{motd}} - {{commentLength}} + + {{restrict 'description'}} +
@@ -21,87 +23,98 @@

About

-
+

School Name:

- {{school}} -
+ +
+ {{#each selectOptions 'school'}} + {{> option}} + {{/each}} +
+

-
-
+

Grade:

- {{grade}} -
-
-

9th

-

10th

-

11th

-

12th

-
-
+ +
+ {{#each selectOptions 'grade'}} + {{> option}} + {{/each}} +
+

Preferences

-
-
-

Theme:

- {{themeName}} -
-
-

Light

-

Dark

-
-
-
-
-
-

Default Mode:

- {{pref 'mode'}} -
-
-

Classes

-

Calendar

-
-
-
-
-
-

Hide Homework:

- {{pref 'timeHide'}} -
-
-

1 Day

-

2 Days

-

1 Week

-

1 Month

-

Never

-
-
-
-
-
-

Hide Done:

- {{pref 'done'}} -
-
-

Yes

-

No

-
-
-
-
-
-

Hide Reported:

- {{pref 'hideReport'}} -
-
-

Yes

-

No

-
-
-
+
+

Theme:

+ +
+ {{#each selectOptions 'theme'}} + {{> option}} + {{/each}} +
+
+
+

Default Mode:

+ +
+ {{#each selectOptions 'mode'}} + {{> option}} + {{/each}} +
+
+
+

Hide Homework:

+ +
+ {{#each selectOptions 'timeHide'}} + {{> option}} + {{/each}} +
+
+
+

Hide Done:

+ +
+ {{#each selectOptions 'done'}} + {{> option}} + {{/each}} +
+
+
+

Hide Reported:

+ +
+ {{#each selectOptions 'hideReport'}} + {{> option}} + {{/each}} +
+
+
@@ -182,7 +195,7 @@

Hour:

- +

Teacher:

@@ -190,40 +203,25 @@

Class Name:

- +
-

Privacy:

- - - - - - - - - - - - - - - - - -
-

Public

-

Private

-
+

Privacy:

+ +
+ {{#each selectOptions 'privacy'}} + {{> option}} + {{/each}} +

Category:

- -
-

Class

-

Club

-

Other

-
+ +
+ {{#each selectOptions 'category'}} + {{> option}} + {{/each}} +

Submit Request

@@ -321,3 +319,4 @@ + diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index a59a763..8631f23 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -4,7 +4,7 @@ import { } from 'meteor/templating'; var openValues = { - "owned": "-540px", + "owned": "-650px", "priv": "-160px" }; @@ -25,7 +25,7 @@ Session.set("noclass", null); // If user doesn't have classes. Session.set("notfound", null); // If no results for autocomplete. Template.profile.helpers({ - themeName() { +/* themeName() { var vals = _.values(themeColors); var curtheme = Session.get("user").preferences.theme; for (var i = 0; i < vals.length; i++) { @@ -35,7 +35,7 @@ Template.profile.helpers({ } } return "Custom"; - }, + },*/ classSettings() { // Returns autocomplete array for classes. return { position: "bottom", @@ -86,7 +86,7 @@ Template.profile.helpers({ username() { //Returns current user's username return Session.get("user").name; }, - motd() { // Returns the current user's description + description() { // Returns the current user's description if (Session.get("user").description !== undefined && Session.get("user").description !== null && Session.get("user").description !== "") return Session.get("user").description; return "Say something about yourself!"; }, @@ -95,10 +95,10 @@ Template.profile.helpers({ return "Click here to edit..."; }, grade() { // Returns the current user's grade - if (Session.get("user").grade !== undefined && Session.get("user").grade !== null && Session.get("user").grade !== "") return Session.get("user").grade + "th"; + if (Session.get("user").grade !== undefined && Session.get("user").grade !== null && Session.get("user").grade !== "") return Session.get("user").grade; return "Click here to edit..."; }, - classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size ) + classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size ) ( Only your school) var array = classes.find({ status: { $eq: true @@ -107,7 +107,10 @@ Template.profile.helpers({ $eq: false }, _id: { - $nin: Meteor.user().profile.classes + $nin: Session.get("user").classes + }, + school: { + $eq: Session.get("user").school } }, { sort: { @@ -136,12 +139,12 @@ Template.profile.helpers({ return "0px"; }, profClassTabColor(status) {  // Change this [Supposed to show the current mode that's selected via color]     - if (Session.equals("profClassTab", status)) { - return Meteor.user().profile.preferences.theme.modeHighlight; - } else { - return; - } - }, + if (Session.equals("profClassTab", status)) { + return Meteor.user().profile.preferences.theme.modeHighlight; + } else { + return; + } + }, profClassTab(tab) { // Tells current class if (Session.equals("profClassTab", tab)) { return true; @@ -174,23 +177,29 @@ Template.profile.helpers({ }); Template.profile.events({ - 'click' (event) { // Whenever a click happens - var modifyingInput = Session.get("modifying"); - if (event.target.id !== modifyingInput && - event.target.id !== modifyingInput + "a" && - !Session.equals("modifying", null) && - !event.target.parentNode.className.includes("profOptions")) { - closeInput(modifyingInput); - } - if (!event.target.className.includes("radio") && - !event.target.parentNode.className.includes("profOptions") && - event.target.readOnly !== true) { - for (var i = 0; i < document.getElementsByClassName("profOptions").length; i++) { - try { - closeDivFade(document.getElementsByClassName("profOptions")[i]); - } catch (err) {} + 'click' (event) { // Whenever a click happens' + var e = event.target.className; + if(modifyingInput !== null && event.target !== document.getElementById(modifyingInput)) { + if (!(e.includes("optionHolder") || e.includes("optionText"))) { + if(document.getElementById(modifyingInput).className.includes("dropdown")) { + $(".optionHolder") + .fadeOut(250, "linear"); + + $(".selectedOption").removeClass("selectedOption"); + } else { + if(modifyingInput === "description") { + Session.set("restrictText", {}); + $("#"+modifyingInput).css('cursor','pointer'); + var newSetting = Session.get("user"); + newSetting[modifyingInput] = document.getElementById(modifyingInput).value; + serverData = newSetting; + sendData("editProfile"); + } + } + modifyingInput = null; } } + if (!document.getElementById("createdClasses").contains(event.target) && !Session.equals("code", null) && !event.target.className.includes("fa-times-circle-o")) { @@ -219,39 +228,39 @@ Template.profile.events({ } }, 'click .addClass' () {  - if (Session.equals("profClassTab", "addClass")) return;          - var functionHolder = document.getElementById("profClassInfoHolder"); - closeDivFade(functionHolder); - var div = document.getElementById("profClasses"); - div.style.height = "50%"; - setTimeout(function() {             - Session.set("profClassTab", "addClass"); - div.style.height = "90%";           - openDivFade(functionHolder);         - }, 400); - }, -     'click .manageClass' () {  - if (Session.equals("profClassTab", "manClass")) return;       - var functionHolder = document.getElementById("profClassInfoHolder"); - closeDivFade(functionHolder); - var div = document.getElementById("profClasses"); - div.style.height = "50%";      - setTimeout(function() {             - Session.set("profClassTab", "manClass");  - div.style.height = "90%";            - openDivFade(functionHolder);         - }, 400); - }, -     'click .createClass' () { + if (Session.equals("profClassTab", "addClass")) return;          + var functionHolder = document.getElementById("profClassInfoHolder"); + closeDivFade(functionHolder); + var div = document.getElementById("profClasses"); + div.style.height = "50%"; + setTimeout(function() {             + Session.set("profClassTab", "addClass"); + div.style.height = "70%";           + openDivFade(functionHolder);         + }, 400); + }, +    'click .manageClass' () {  + if (Session.equals("profClassTab", "manClass")) return;       + var functionHolder = document.getElementById("profClassInfoHolder"); + closeDivFade(functionHolder); + var div = document.getElementById("profClasses"); + div.style.height = "50%";      + setTimeout(function() {             + Session.set("profClassTab", "manClass");  + div.style.height = "70%";            + openDivFade(functionHolder);         + }, 400); + }, +    'click .createClass' () { if (Session.equals("profClassTab", "creClass")) return; var functionHolder = document.getElementById("profClassInfoHolder");         closeDivFade(functionHolder); var div = document.getElementById("profClasses"); div.style.height = "50%"; setTimeout(function() { - Session.set("profClassTab", "creClass"); - div.style.height = "90%"; - openDivFade(functionHolder); + Session.set("profClassTab", "creClass"); + div.style.height = "70%"; + openDivFade(functionHolder); }, 400); }, 'click .classBox' (event) { // When you click on a box that holds class @@ -281,6 +290,7 @@ Template.profile.events({ } else { var attribute = event.target.getAttribute("classid"); } + if(attribute === Meteor.userId()) return; Session.set("selectedClass", null); var usertype = ["moderators", "banned"]; var array = classes.findOne({ @@ -364,7 +374,7 @@ Template.profile.events({ input.className.replace(" formInvalid", ""); var value = input.value; var classid = document.getElementById("createdClasses").getAttribute("classid"); - input.value = ""; + input.value = " "; if (checkUser(value, classid)) { input.className += " formInvalid"; input.placeholder = "Not a valid user"; @@ -446,102 +456,105 @@ Template.profile.events({ confirm = null; }, // INPUT HANDLING - 'click .change' (event) { // Click changable inputs. Creates an input where the span is. - var ele = event.target; - var modifyingInput = Session.get("modifying"); - if (ele.id !== modifyingInput && modifyingInput !== null) closeInput(modifyingInput); + 'focus .clickModify' (event) { + $(".optionHolder") + .fadeOut(250, "linear"); - Session.set("modifying", ele.id); - var dim = ele.getBoundingClientRect(); - ele.style.display = "none"; - var input = document.createElement("input"); - - if (ele.getAttribute("type") !== null) { - input.type = ele.getAttribute("type"); - } else { - input.type = "text"; - } - input.value = ele.childNodes[0].nodeValue; - input.className = "changeInput"; - input.style.height = 0.9 * dim.height.toString() + "px"; - input.style.width = "55%"; - input.style.padding = "0.1%"; - input.id = ele.id + "a"; - input.setAttribute("opc", ele.getAttribute("opc")); - ele.parentNode.appendChild(input); - if (ele.getAttribute("re") == "readonly") { - input.readOnly = true; - input.className += " op"; - input.style.cursor = "pointer"; - } else { - input.select(); - } - input.focus(); - var restrict = ele.getAttribute("restrict"); - if (restrict !== null) { - input.maxLength = restrict; - input.className += " restrict"; - Session.set("commentRestrict", restrict - input.value.length.toString() + " characters left"); - var text = document.getElementById(Session.get("modifying") + "restrict"); - text.style.display = "inherit"; - text.style.color = "#7E7E7E"; + if(modifyingInput !== null) { + if(!$("#"+modifyingInput)[0].className.includes("dropdown")) closeInput(modifyingInput); + } + modifyingInput = event.target.id; + if(!$("#"+modifyingInput)[0].className.includes("dropdown")) { + event.target.select(); + event.target.style.cursor = "text"; } }, - 'click .radio' (event) { // Click dropdown input. Opens the dropdown menu. - var op = event.target; - try { - for (var i = 0; i < document.getElementsByClassName("profOptions").length; i++) { - var curr = document.getElementsByClassName("profOptions")[i]; - if (curr.childNodes[1] !== op.nextSibling.nextSibling.childNodes[1] && - curr.childNodes[1] !== op.parentNode.parentNode.childNodes[3].childNodes[1]) { - closeDivFade(document.getElementsByClassName("profOptions")[i]); + 'keydown .dropdown' (event) { + var first = $("#"+modifyingInput).next().children("p:first-child"); + var last = $("#"+modifyingInput).next().children("p:last-child"); + var next = $(".selectedOption").next(); + var prev = $(".selectedOption").prev(); + var lastSel = $(".selectedOption"); + + if (event.keyCode === 38) { + if (lastSel === undefined) { + last.addClass("selectedOption"); + } else { + if (prev.length === 0) { + last.addClass("selectedOption"); + lastSel.removeClass("selectedOption"); + } else { + prev.addClass("selectedOption"); + lastSel.removeClass("selectedOption"); } } - } catch (err) {} - - if (event.target.className.includes("op")) { - openDivFade(op.nextSibling.nextSibling); - } else { - openDivFade(op.parentNode.parentNode.childNodes[3]); + } else if (event.keyCode === 40) { + if (lastSel === undefined) { + first.addClass("selectedOption"); + last.removeClass("selectedOption"); + } else { + if (next.length === 0) { + first.addClass("selectedOption"); + lastSel.removeClass("selectedOption"); + } else { + next.addClass("selectedOption"); + lastSel.removeClass("selectedOption"); + } + } + } else if (event.keyCode === 13) { + lastSel[0].click(); } }, - 'keydown input' (event) { // Restricts characters for certain inputs. - var modifyingInput = Session.get("modifying"); - if (event.keyCode == 13) { - try { - closeInput(modifyingInput); - } catch (err) {} + 'focus .dropdown' (event) { + $(".selectedOption").removeClass("selectedOption"); + + $("#" + modifyingInput).next() + .css('opacity',0) + .slideDown(300) + .animate( + { opacity: 1 }, + { queue: false, duration: 100 } + ); + }, + 'click .optionText' (event) { // Click each preferences setting. + var option = event.target.childNodes[0].nodeValue; + var userSettings = ["description","school","grade"]; + var newSetting = Session.get("user"); + + if(modifyingInput === "privacy" || modifyingInput === "category") { + document.getElementById(modifyingInput).value = option; + $("#" + modifyingInput).next() + .fadeOut(250, "linear"); + $(".selectedOption").removeClass("selectedOption"); + return; } + + if(_.contains(userSettings, modifyingInput)) { + newSetting[modifyingInput] = (modifyingInput === "grade") ? parseInt(option) : option; + } else { + newSetting.preferences[modifyingInput] = (function() { + var value = options[modifyingInput].filter(function(entry) { + return option === entry.alias; + })[0].val; + return (modifyingInput === 'theme') ? themeColors[value] : value; + })(); + } + Session.set("user", newSetting); + serverData = Session.get("user"); + sendData("editProfile"); + + $("#" + modifyingInput).next() + .fadeOut(250, "linear"); + + $(".selectedOption").removeClass("selectedOption"); }, 'input .restrict' (event) { var restrict = event.target.maxLength; var chars = restrict - event.target.value.length; - var text = document.getElementById(Session.get("modifying") + "restrict"); - text.style.color = "#7E7E7E"; - if (chars === restrict) { // Don't display if nothing in comment. - Session.set("commentRestrict", ""); - return; - } else if (chars === 0) { - text.style.color = "#FF1A1A"; // Make text red if 0 characters left. - text.style.opacity = "0"; - } - Session.set("commentRestrict", chars.toString() + " characters left"); - }, - 'click .profOptionText' (event) { // Click each profile option setting. - var modifyingInput = Session.get("modifying"); - var p = event.target; - if (p.className.includes("cre")) { - var input = p.parentNode.parentNode.childNodes[3]; - } else { - var input = p.parentNode.parentNode.childNodes[1].childNodes[5]; - } - input.value = p.childNodes[0].nodeValue; - try { - closeInput(modifyingInput); - } catch (err) {} - - closeDivFade(p.parentNode); - input.focus(); + var newSetting = Session.get("restrictText"); + newSetting[event.target.id] = (chars === restrict) ? "" : (chars.toString() + ((chars === 1) ? " character " : " characters ") + "left"); + newSetting.selected = event.target.id; + Session.set("restrictText", newSetting); }, // AUTOCOMPLETE HANDLING 'keyup #profClassSearch' (event) { // Auto-complete updater @@ -572,10 +585,7 @@ Template.profile.events({ Session.set("autocompleteDivs", divs); } } catch (err) {} - }, - 'focus .op' (event) { // Selects input for next tabbing. - event.target.click(); - }, + } }); function openDivFade(div) { @@ -593,27 +603,6 @@ function closeDivFade(div) { }, 100); } -function closeInput(modifyingInput) { // Closes current modifying input. - var input = document.getElementById(modifyingInput + "a"); - var span = document.getElementById(modifyingInput); - input.parentNode.removeChild(input); - Session.set("commentRestrict", ""); - try { - document.getElementById("modifyingInput" + "restrict").style.display = "none"; - } catch (err) {} - - if (input.value === "") { - span.childNodes[0].nodeValue = "Click here to edit..."; - } else { - span.childNodes[0].nodeValue = input.value; - } - span.style.display = "initial"; - Session.set("modifying", null); - Session.set("user", getProfileData()); - serverData = Session.get("user"); - sendData("editProfile"); -} - function sendData(funcName) { Meteor.call(funcName, serverData, function(err, result) { if (funcName === "trackUserInClass") { diff --git a/hourglass/lib/constants.js b/hourglass/lib/constants.js index 0a68cce..58c694d 100644 --- a/hourglass/lib/constants.js +++ b/hourglass/lib/constants.js @@ -1,7 +1,7 @@ themeColors = { "light": { "background": "White.jpg", - "mainColor": "#EBEBEB", + "mainColor": "#D9D9D9", "secondaryColor": "#E8E8E8", "sidebarColor": "#65839A", "userDropdownColor": "#E6E6E6", @@ -97,6 +97,15 @@ options = { {"val": "test", "alias": "Test"}, {"val": "project", "alias": "Project"}, {"val": "other", "alias": "Other"}, + ], + "privacy": [ + {"val": true, "alias": "Private"}, + {"val": false, "alias": "Public"} + ], + "category": [ + {"val": "class", "alias": "Class"}, + {"val": "club", "alias": "Club"}, + {"val": "other", "alias": "Other"} ] } From 4e5e7bb14aeea5cab95b563d3162aa231163f3f3 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 14:14:59 -0400 Subject: [PATCH 04/15] Naming changes, css fixes, small bugs --- hourglass/client/main/main.css | 7 +++-- hourglass/client/main/main.html | 10 +++---- hourglass/client/main/main.js | 1 + hourglass/client/profile/profile.css | 24 +++------------- hourglass/client/profile/profile.html | 2 +- hourglass/client/profile/profile.js | 1 + hourglass/lib/constants.js | 40 +++++++++++++++------------ 7 files changed, 39 insertions(+), 46 deletions(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 130fec7..440795f 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -589,7 +589,7 @@ input.clickModify, textarea.clickModify { input.clickModify:hover, textarea.clickModify:hover { background-color: rgba(0,0,0,0.1); - border-color: rgba(0,0,0,0.1);; + } textarea.clickModify { @@ -608,12 +608,15 @@ textarea.clickModify { #editWorkCont { width: 100%; height: 100%; - min-height: 68vh; position: relative; display: table; } +#workInfoContainer { + min-height: 68vh; +} + #workTypeBar { background-color: rgba(0,0,0,0.1); height: 2%; diff --git a/hourglass/client/main/main.html b/hourglass/client/main/main.html index 61ed342..46c8371 100644 --- a/hourglass/client/main/main.html +++ b/hourglass/client/main/main.html @@ -151,8 +151,8 @@ {{else}} {{> workDisplay}} {{/if}} -
- {{#unless newWork}} + {{#unless newWork}} +

Comments

@@ -167,9 +167,9 @@ {{> comment}} {{/each}}
-
- {{/unless}} -
+
+
+ {{/unless}} {{#unless newWork}}
diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 62816c1..8cdf746 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -706,6 +706,7 @@ Template.main.events({ } }, 'keydown .dropdown' (event) { + event.preventDefault(); var first = $("#"+modifyingInput).next().children("p:first-child"); var last = $("#"+modifyingInput).next().children("p:last-child"); var next = $(".selectedOption").next(); diff --git a/hourglass/client/profile/profile.css b/hourglass/client/profile/profile.css index 1f570cf..d339fc8 100644 --- a/hourglass/client/profile/profile.css +++ b/hourglass/client/profile/profile.css @@ -80,30 +80,14 @@ width: 50% !important; } +#description:hover { + background-color: rgba(255,255,255,0.1); +} + .username { margin-left: 20% !important; } -#motdrestrict { - margin-right: 1% !important; - float: right; -} - -.profOptions { - box-shadow: 2px 2px 5px 3px #666; - - position: absolute; - display: none; - z-index: 5; - - opacity: 0; - - -webkit-transition: opacity 0.4s ease; - -moz-transition: opacity 0.4s ease; - -ms-transition: opacity 0.4s ease; - transition: opacity 0.4s ease; -} - #profCards { width: 100%; height: 100%; diff --git a/hourglass/client/profile/profile.html b/hourglass/client/profile/profile.html index d95160d..57fc5c2 100644 --- a/hourglass/client/profile/profile.html +++ b/hourglass/client/profile/profile.html @@ -37,7 +37,7 @@

-

Grade:

+

Graduation Year:

@@ -29,7 +27,7 @@ {{school}}
-
+
{{#each selectOptions 'school'}} {{> option}} {{/each}} From 81dc4a1b7518461b2572e13578fadfea2d078673 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 14:22:44 -0400 Subject: [PATCH 06/15] Css change --- 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 440795f..9d01d89 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -715,7 +715,7 @@ textarea.clickModify { } .optionText { - font-size: 150%; + font-size: 120%; min-width: 10%; padding: 4% 7% 4% 7%; margin: 0; From 85f9b4798e915d647d19d8631c5df0d74332c8f8 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 16:27:42 -0400 Subject: [PATCH 07/15] minor fixes --- hourglass/client/main/main.js | 3 +- hourglass/client/profile/profile.js | 2 ++ hourglass/lib/constants.js | 52 ++++++++++++++--------------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 8cdf746..e3a3a3f 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -706,7 +706,6 @@ Template.main.events({ } }, 'keydown .dropdown' (event) { - event.preventDefault(); var first = $("#"+modifyingInput).next().children("p:first-child"); var last = $("#"+modifyingInput).next().children("p:last-child"); var next = $(".selectedOption").next(); @@ -714,6 +713,7 @@ Template.main.events({ var lastSel = $(".selectedOption"); if (event.keyCode === 38) { + event.preventDefault(); if (lastSel === undefined) { last.addClass("selectedOption"); } else { @@ -726,6 +726,7 @@ Template.main.events({ } } } else if (event.keyCode === 40) { + event.preventDefault(); if (lastSel === undefined) { first.addClass("selectedOption"); last.removeClass("selectedOption"); diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index 34d8ba2..7ca6de3 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -478,6 +478,7 @@ Template.profile.events({ var lastSel = $(".selectedOption"); if (event.keyCode === 38) { + event.preventDefault(); if (lastSel === undefined) { last.addClass("selectedOption"); } else { @@ -490,6 +491,7 @@ Template.profile.events({ } } } else if (event.keyCode === 40) { + event.preventDefault(); if (lastSel === undefined) { first.addClass("selectedOption"); last.removeClass("selectedOption"); diff --git a/hourglass/lib/constants.js b/hourglass/lib/constants.js index 98f757d..71d285a 100644 --- a/hourglass/lib/constants.js +++ b/hourglass/lib/constants.js @@ -21,10 +21,10 @@ themeColors = { "classCardColor":"#46396E", "textColor": "#F6F6F6" }, - "requox": { + "requom": { "background": "RedBlack.jpg", - "mainColor": "#302c36", - "secondaryColor": "#C51313", + "mainColor": "#302C36", + "secondaryColor": "#B93A3A", "sidebarColor": "#327C5A", "userDropdownColor": "#CC3333", "iconHighlight": "#327C5A", @@ -34,36 +34,36 @@ themeColors = { }, "aequor": { "background": "Sea.jpg", - "mainColor": "#1e926c", - "secondaryColor": "#1c564f", - "sidebarColor": "#3cb08a", - "userDropdownColor": "#2ea96a", - "iconHighlight": "#61d9a3", - "modeHighlight": "#c9fe62", - "classCardColor":"#2567a1", - "textColor": "#fcf0f0" + "mainColor": "#1E926C", + "secondaryColor": "#1C564F", + "sidebarColor": "#3CB08A", + "userDropdownColor": "#2EA96A", + "iconHighlight": "#61D9A3", + "modeHighlight": "#C9FE62", + "classCardColor":"#2567A1", + "textColor": "#FCF0F0" }, "fresva": { "background": "Earth.jpg", - "mainColor": "#dea743", + "mainColor": "#DEA743", "secondaryColor": "#496234", - "sidebarColor": "#6d9957", - "userDropdownColor": "#89bb52", - "iconHighlight": "#91ee61", - "modeHighlight": "#b9f643", - "classCardColor":"#c18311", - "textColor": "#fcf0f0" + "sidebarColor": "#6D9957", + "userDropdownColor": "#89BB52", + "iconHighlight": "#91EE61", + "modeHighlight": "#B9f643", + "classCardColor":"#C18311", + "textColor": "#FCF0F0" }, "atlaneon": { "background": "NeonBlue.jpg", - "mainColor": "#1d1c23", - "secondaryColor": "#1f212f", - "sidebarColor": "#312e32", + "mainColor": "#1D1C23", + "secondaryColor": "#1F212f", + "sidebarColor": "#312E32", "userDropdownColor": "#2e312b", - "iconHighlight": "#70e6e6", - "modeHighlight": "#70e6e6", - "classCardColor":"#1faab1", - "textColor": "#fcf0f0" + "iconHighlight": "#70E6E6", + "modeHighlight": "#70E6E6", + "classCardColor":"#1FAAB1", + "textColor": "#FCF0F0" } }; @@ -71,7 +71,7 @@ options = { "theme": [ {"val": "lux", "alias": "Lux"}, {"val": "nox", "alias": "Nox"}, - {"val": "requox", "alias": "Recoum"}, + {"val": "requom", "alias": "Recoum"}, {"val": "aequor", "alias": "Aequor"}, {"val": "fresva", "alias": "Fresva"}, {"val": "atlaneon", "alias": "Atlaneon"} From 274e6f961e9abd56bb0be6d32874500fc9d8f239 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 16:30:35 -0400 Subject: [PATCH 08/15] Removed theme transitioning --- hourglass/client/main/main.css | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 9d01d89..65917f1 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -99,11 +99,6 @@ body { position: absolute; top: 0; z-index: 50; - - -webkit-transition: background-color 0.5s ease; - -moz-transition: background-color 0.5s ease; - -ms-transition: background-color 0.5s ease; - transition: background-color 0.5s ease; } #mainHeader h1, #mainHeader h2 { @@ -237,10 +232,10 @@ body { z-index: 5; overflow: hidden; - -webkit-transition: left 0.5s ease, right 0.5s ease, background-color 0.5s ease; - -moz-transition: left 0.5s ease, right 0.5s ease, background-color 0.5s ease; - -ms-transition: left 0.5s ease, right 0.5s ease, background-color 0.5s ease; - transition: left 0.5s ease, right 0.5s ease, background-color 0.5s ease; + -webkit-transition: left 0.5s ease, right 0.5s ease; + -moz-transition: left 0.5s ease, right 0.5s ease + -ms-transition: left 0.5s ease, right 0.5s ease; + transition: left 0.5s ease, right 0.5s ease; } #optionsContainer { From 1942b1511395d742cdf78f10ba591736a04edfa4 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 16:34:45 -0400 Subject: [PATCH 09/15] css fix --- hourglass/client/profile/profile.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hourglass/client/profile/profile.css b/hourglass/client/profile/profile.css index 303ee49..4684d67 100644 --- a/hourglass/client/profile/profile.css +++ b/hourglass/client/profile/profile.css @@ -149,7 +149,7 @@ } #profClasses { - height: 90%; + height: 70%; margin-right: 0; border-top: 5px solid #2E4F74; From 871ba2777ec5b4674446e1a07e156b51da2a1deb Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 23:53:20 -0400 Subject: [PATCH 10/15] change default theme name in serveR --- hourglass/server/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hourglass/server/main.js b/hourglass/server/main.js index a597063..b3462fe 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -494,7 +494,7 @@ Meteor.methods({ current.banner = "/Banners/defaultcover.jpg"; current.classes = [userId]; current.preferences = { - "theme": themeColors.light, + "theme": themeColors.lux, "mode": "classes", "timeHide": 1, "done": true, From 86eecc47eeabe94ff1db17e524600099e7206a75 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 18 Oct 2016 23:54:24 -0400 Subject: [PATCH 11/15] removed console.log --- hourglass/client/main/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index e3a3a3f..9c364f3 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -71,7 +71,6 @@ Template.profile.rendered = function() { Accounts._loginButtonsSession.set('dropdownVisible', true); $(".optionText").hover( function() { - console.log("hi"); $(this).addClass("selectedOption"); }, function() { From d08d38acdde9b8339728c8ca7a9de13de269ffb4 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 19 Oct 2016 00:15:30 -0400 Subject: [PATCH 12/15] default date for new work --- hourglass/client/main/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 9c364f3..378544e 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -274,7 +274,7 @@ Template.registerHelper('work', (value) => {// Returns the specified work value. var thisWork = Session.get("currentWork"); if (Session.equals("currentWork", null)) return; if (Session.get("newWork") && (thisWork[value] === true || thisWork[value] === undefined)) { - return defaultWork[value]; + return (value === "dueDate") ? getReadableDate(new Date((new Date()).valueOf() + 1000*3600*24)) : defaultWork[value]; } else { return formReadable(thisWork,value); } @@ -965,7 +965,7 @@ function getHomeworkFormData() { // Get all data relating to work creation. return $("#"+inputs[i]+" span")[0].childNodes[0].nodeValue.toLowerCase(); } else if (title === "dueDate") { var val = $("#"+inputs[i])[0].value; - return (val.includes(defaultWork[title].slice(0,-3))) ? val : toDate(val); + return toDate(val); } else { return $("#"+inputs[i])[0].value; } @@ -979,7 +979,7 @@ function getHomeworkFormData() { // Get all data relating to work creation. function checkMissing() { var no = false; for(var key in serverData) { - if(!_.contains(["name","dueDate","description","type"],key)) continue; + if(!_.contains(["name","dueDate","type"],key)) continue; var id = "w" + key.charAt(0).toUpperCase() + key.slice(1); if(serverData[key] === true || serverData[key] === "") { no = true; From bf025fd1a7ccfc818a5e1f31daa4ccb1d83edc26 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 19 Oct 2016 00:26:35 -0400 Subject: [PATCH 13/15] New work bug fix --- hourglass/client/main/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 378544e..0b4719c 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -760,7 +760,7 @@ Template.main.events({ newSetting[modifyingInput.charAt(1).toLowerCase() + modifyingInput.slice(2)] = option.toLowerCase(); Session.set("currentWork", newSetting); serverData = Session.get("currentWork"); - if(checkMissing()) return; + if(checkMissing() || Session.get("newWork")) return; sendData("editWork") } else { var newSetting = Session.get("user"); From 57cacea42a09e988d94664cb69761cb88181f30e Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 19 Oct 2016 01:24:14 -0400 Subject: [PATCH 14/15] Minor bug fixes --- hourglass/client/main/main.css | 4 ++++ hourglass/client/main/main.js | 37 ++++++++++++++++++++++------- hourglass/client/profile/profile.js | 7 ++++++ hourglass/lib/constants.js | 4 ++-- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/hourglass/client/main/main.css b/hourglass/client/main/main.css index 65917f1..ac289d3 100644 --- a/hourglass/client/main/main.css +++ b/hourglass/client/main/main.css @@ -779,6 +779,10 @@ textarea.clickModify { display: inline-block; } +#typeWrapper .optionText:hover { + box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.2); +} + .datepicker { box-shadow: 2px 2px 5px 3px #666; color: #000; diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index 0b4719c..1154b88 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -274,7 +274,7 @@ Template.registerHelper('work', (value) => {// Returns the specified work value. var thisWork = Session.get("currentWork"); if (Session.equals("currentWork", null)) return; if (Session.get("newWork") && (thisWork[value] === true || thisWork[value] === undefined)) { - return (value === "dueDate") ? getReadableDate(new Date((new Date()).valueOf() + 1000*3600*24)) : defaultWork[value]; + return defaultWork[value]; } else { return formReadable(thisWork,value); } @@ -532,11 +532,10 @@ Template.main.events({ if (e === "overlay") { // Overlay closing. closeDivFade(document.getElementsByClassName("overlay")[0]); + Session.set("newWork",false); if (!Session.get("newWork")) { document.getElementById("workComment").value = ""; } - $('.req').css("color", ""); - Session.set("commentRestrict", null); } if (!document.getElementById("userDropdown").contains(event.target)) closeDivFade(document.getElementById("userDropdown")); @@ -601,7 +600,7 @@ Template.main.events({ attr = event.target.getAttribute("classid"); } Session.set("newWork", true); - Session.set("currentWork",{class: attr}); + Session.set("currentWork",{class: attr, dueDate: (new Date((new Date()).valueOf() + 1000*3600*24))}); openDivFade(document.getElementsByClassName("overlay")[0]); }, 'click #dropdown' (event) { @@ -760,7 +759,12 @@ Template.main.events({ newSetting[modifyingInput.charAt(1).toLowerCase() + modifyingInput.slice(2)] = option.toLowerCase(); Session.set("currentWork", newSetting); serverData = Session.get("currentWork"); - if(checkMissing() || Session.get("newWork")) return; + + $("#" + modifyingInput).next() + .fadeOut(250, "linear"); + $(".selectedOption").removeClass("selectedOption"); + if(Session.get("newWork")) return; + if(checkMissing()) return; sendData("editWork") } else { var newSetting = Session.get("user"); @@ -776,7 +780,7 @@ Template.main.events({ } $("#" + modifyingInput).next() - .fadeOut(250, "linear");; + .fadeOut(250, "linear"); $(".selectedOption").removeClass("selectedOption"); }, @@ -931,6 +935,11 @@ function closeDivFade(div) { } function sendData(funcName) { // Call Meteor function, and do actions after function is completed depending on function. + if(funcName === "editWork" || funcName === "createWork") { + for(var key in serverData) { + if(serverData[key] === true) serverData[key] = ""; + } + } Meteor.call(funcName, serverData, function(error, result) { serverData = null; currWork = Session.get("currentWork"); @@ -971,17 +980,27 @@ function getHomeworkFormData() { // Get all data relating to work creation. } })(); // True signifies missing field to prevent missing if value is'Missing field.' - data[title] = (thisData.toString().includes(defaultWork[title].slice(0,-3)) && !_.contains(optional, title)) ? true : thisData; + data[title] = data[title] = (thisData.toString().includes(defaultWork[title].slice(0,-3)) && !_.contains(optional, title)) ? true : thisData; } return data; } function checkMissing() { + var required = ["name","dueDate","type"] var no = false; + if(serverData === null || Object.keys(serverData).length < 4) { + for(var i = 0; i < required.length; i++) { + var id = "w" + required[i].charAt(0).toUpperCase() + required[i].slice(1); + $("#"+id).addClass("formInvalid"); + $("#"+id)[0].value = ""; + $("#"+id)[0].placeholder = "Missing field"; + } + return true; + } for(var key in serverData) { - if(!_.contains(["name","dueDate","type"],key)) continue; + if(!_.contains(required, key)) continue; var id = "w" + key.charAt(0).toUpperCase() + key.slice(1); - if(serverData[key] === true || serverData[key] === "") { + if(serverData[key] === true || serverData[key] === "" || serverData[key] === undefined) { no = true; $("#"+id).addClass("formInvalid"); $("#"+id)[0].value = ""; diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index 7ca6de3..0d0c5b3 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -588,6 +588,13 @@ Template.profile.events({ Session.set("autocompleteDivs", divs); } } catch (err) {} + }, + 'mouseenter .optionText' (event) { + console.log("hi"); + event.target.className += " selectedOption"; + }, + 'mouseleave .optionText' (event) { + event.target.className.replace(" selectedOption", ""); } }); diff --git a/hourglass/lib/constants.js b/hourglass/lib/constants.js index 71d285a..2195443 100644 --- a/hourglass/lib/constants.js +++ b/hourglass/lib/constants.js @@ -103,8 +103,8 @@ options = { {"val": "other", "alias": "Other"}, ], "privacy": [ - {"val": true, "alias": "Private"}, - {"val": false, "alias": "Public"} + {"val": false, "alias": "Public"}, + {"val": true, "alias": "Private"} ], "category": [ {"val": "class", "alias": "Class"}, From 0a368eb17e3443d4cd892d00b7bcae5db340fb42 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 19 Oct 2016 01:26:24 -0400 Subject: [PATCH 15/15] removed unnecessary code --- hourglass/client/profile/profile.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index 0d0c5b3..7ca6de3 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -588,13 +588,6 @@ Template.profile.events({ Session.set("autocompleteDivs", divs); } } catch (err) {} - }, - 'mouseenter .optionText' (event) { - console.log("hi"); - event.target.className += " selectedOption"; - }, - 'mouseleave .optionText' (event) { - event.target.className.replace(" selectedOption", ""); } });