diff --git a/hourglass/.meteor/packages b/hourglass/.meteor/packages index b378b53..bed5ffc 100644 --- a/hourglass/.meteor/packages +++ b/hourglass/.meteor/packages @@ -6,22 +6,22 @@ meteor-base@1.0.4 # Packages every Meteor app needs to have mobile-experience@1.0.4 # Packages for a great mobile UX -mongo@1.1.12 # The database Meteor supports right now +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 # Helpful client-side library +jquery@1.11.9 # Helpful client-side library tracker@1.1.0 # Meteor's client-side reactive programming library -standard-minifier-css@1.2.0 # CSS minifier run for production mode -standard-minifier-js@1.2.0 # JS minifier run for production mode -es5-shim@4.6.14 # ECMAScript 5 compatibility for older browsers. -ecmascript@0.5.8 # Enable ECMAScript2015+ syntax in app code +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 fortawesome:fontawesome session@1.1.6 proyk:meteor-cookies aldeed:simple-schema -accounts-google +accounts-google@1.0.10 accounts-ui@1.1.9 iron:router ongoworks:security @@ -31,9 +31,8 @@ rzymek:fullcalendar momentjs:moment eternicode:bootstrap-datepicker shell-server@0.2.1 -http@1.2.9 -underscore -houston:admin +http@1.2.9_1 +underscore@1.0.9 ahref:dragula harrison:papa-parse pfafman:filesaver @@ -41,3 +40,7 @@ flemay:less-autoprefixer natestrauser:select2 juliancwirko:s-alert juliancwirko:s-alert-stackslide +aldeed:collection2 +dburles:collection-helpers +twbs:bootstrap +yogiben:admin diff --git a/hourglass/.meteor/release b/hourglass/.meteor/release index 72980bc..2631a23 100644 --- a/hourglass/.meteor/release +++ b/hourglass/.meteor/release @@ -1 +1 @@ -METEOR@1.4.1.1 +METEOR@1.4.1.2 diff --git a/hourglass/.meteor/versions b/hourglass/.meteor/versions index 0767d64..5859dac 100644 --- a/hourglass/.meteor/versions +++ b/hourglass/.meteor/versions @@ -1,16 +1,19 @@ accounts-base@1.2.11 accounts-google@1.0.10 accounts-oauth@1.1.13 -accounts-password@1.3.0 accounts-ui@1.1.9 accounts-ui-unstyled@1.1.12 ahref:dragula@3.5.4 alanning:roles@1.2.15 +aldeed:autoform@5.5.1 +aldeed:collection2@2.5.0 aldeed:simple-schema@1.5.3 +aldeed:tabular@1.4.2 +aldeed:template-extension@4.0.0 allow-deny@1.0.5 autoupdate@1.3.11 -babel-compiler@6.9.1 -babel-runtime@0.1.11 +babel-compiler@6.9.1_1 +babel-runtime@0.1.11_1 base64@1.0.9 binary-heap@1.0.9 blaze@2.1.9 @@ -24,7 +27,7 @@ check@1.2.3 coffeescript@1.2.4_1 cosmos:browserify@0.9.4 dandv:caret-position@2.1.1 -dburles:mongo-collection-instances@0.3.5 +dburles:collection-helpers@1.0.4 ddp@1.2.5 ddp-client@1.3.1 ddp-common@1.2.6 @@ -32,11 +35,11 @@ ddp-rate-limiter@1.0.5 ddp-server@1.3.10 deps@1.0.12 diff-sequence@1.0.6 -ecmascript@0.5.8 -ecmascript-runtime@0.3.14 +ecmascript@0.5.8_1 +ecmascript-runtime@0.3.14_1 ejson@1.0.12 -email@1.1.17 -es5-shim@4.6.14 +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 @@ -45,10 +48,9 @@ geojson-utils@1.0.9 google@1.1.14 harrison:papa-parse@1.1.1 hot-code-push@1.0.4 -houston:admin@2.0.7 html-tools@1.0.11 htmljs@1.0.11 -http@1.2.9 +http@1.2.9_1 id-map@1.0.8 iron:controller@1.0.12 iron:core@1.0.11 @@ -61,28 +63,29 @@ iron:url@1.0.11 jquery@1.11.9 juliancwirko:s-alert@3.2.0 juliancwirko:s-alert-stackslide@3.1.3 -lai:collection-extensions@0.2.1_1 launch-screen@1.0.12 less@2.7.5 livedata@1.0.18 localstorage@1.0.11 -logging@1.1.15 +logging@1.1.15_1 mdg:validation-error@0.5.1 -meteor@1.2.17 +meteor@1.2.17_1 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-js@1.2.14 +minifier-js@1.2.14_1 minimongo@1.0.17 mizzao:autocomplete@0.5.1 mobile-experience@1.0.4 mobile-status-bar@1.0.12 -modules@0.7.6 -modules-runtime@0.7.6 +modules@0.7.6_1 +modules-runtime@0.7.6_1 momentjs:moment@2.15.1 -mongo@1.1.12 +mongo@1.1.12_1 mongo-id@1.0.5 natestrauser:select2@4.0.3 -npm-bcrypt@0.9.1 npm-mongo@1.5.49 oauth@1.1.11 oauth2@1.1.10 @@ -92,31 +95,33 @@ ordered-dict@1.0.8 pfafman:filesaver@1.3.2 promise@0.8.7 proyk:meteor-cookies@0.0.1 +raix:handlebar-helpers@0.2.5 random@1.0.10 rate-limit@1.0.5 reactive-dict@1.1.8 reactive-var@1.0.10 reload@1.1.10 retry@1.0.8 +reywood:publish-composite@1.4.2 routepolicy@1.0.11 rzymek:fullcalendar@2.7.2 service-configuration@1.0.10 session@1.1.6 -sha@1.0.8 shell-server@0.2.1 spacebars@1.0.13 spacebars-compiler@1.0.13 -srp@1.0.9 standard-minifier-css@1.2.1 -standard-minifier-js@1.2.0 +standard-minifier-js@1.2.0_1 templating@1.2.15 templating-compiler@1.2.15 templating-runtime@1.2.15 templating-tools@1.0.5 -tmeasday:paginated-subscription@0.2.4 tracker@1.1.0 +twbs:bootstrap@3.3.6 ui@1.0.12 underscore@1.0.9 url@1.0.10 -webapp@1.3.11 +webapp@1.3.11_1 webapp-hashing@1.0.9 +yogiben:admin@1.2.8 +zimme:active-route@2.3.2 diff --git a/hourglass/README.md b/hourglass/README.md index 1c42b47..ec61448 100644 --- a/hourglass/README.md +++ b/hourglass/README.md @@ -13,6 +13,8 @@ Calendar mode organizes work by due date rather than by class. Pressing on a dat Class mode allows you to organize work by the class it belongs to. ##### Work Every piece of work has a confirmed:reported ratio. This is the ratio of the number of people who confirm the presence of the work to the number of people who believe that this is a false report. The creator of a work can edit fields after creation by clicking on details needed to be changed. Lastly, by marking a work as done, it is hidden from view. To disable this, go to preferences. +##### Filters +In the left sidebar, you find options for filtering. These include filtering by class or type of assignment. ### Profile Page On this page, it is possible to edit profile details as well as create, join, and leave classes. #### Creating a class diff --git a/hourglass/client/main/main.js b/hourglass/client/main/main.js index a781b73..bcd5714 100644 --- a/hourglass/client/main/main.js +++ b/hourglass/client/main/main.js @@ -4,6 +4,7 @@ import { } from 'meteor/templating'; import './main.html'; +import './main.css'; var load = true; var calWorkOpen = null; @@ -34,10 +35,10 @@ var defaultWork = { }; // Reactive variables. -Session.set("user",{}); // Stores user preferences. +Session.set("user", {}); // Stores user preferences. Session.set("calendarClasses", []); // Stores calendar classes. Session.set("sidebar", null); // Status of sidebar. -Session.set("requests",false); // Status of requests. +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); @@ -47,7 +48,7 @@ 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. Session.set("typeFilter", []); // Stores type filters for classes. -Session.set("typeFilterHover",null); // Stores current hovered type filter. +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. @@ -67,14 +68,14 @@ Template.profile.rendered = function() { }; Template.registerHelper('userProfile', () => { - if(Meteor.user() === undefined || Meteor.user() === null) return; + if (Meteor.user() === undefined || Meteor.user() === null) return; Session.set("user", Meteor.user().profile); return; }); Template.registerHelper('screen', (multiplier, fraction) => { - if(typeof multiplier !== "string") return screen.width.toString() + "px"; - if(typeof fraction !== "string") return (screen.width * parseFloat(multiplier)).toString() + "px"; + if (typeof multiplier !== "string") return screen.width.toString() + "px"; + if (typeof fraction !== "string") return (screen.width * parseFloat(multiplier)).toString() + "px"; return ((screen.width) * parseFloat(multiplier) / parseFloat(fraction)).toString() + "px"; }); @@ -97,8 +98,8 @@ Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay co }); Template.registerHelper('myClasses', () => { // Gets all classes and respective works. - if(Session.get("user").classes.length === 0) { // Null checking. - Session.set("noclass",true); // Makes sure to display nothing. + if (Session.get("user").classes.length === 0) { // Null checking. + Session.set("noclass", true); // Makes sure to display nothing. return []; } else { var array = []; @@ -159,7 +160,7 @@ Template.registerHelper('myClasses', () => { // Gets all classes and respective thisWork[j] = "no"; } - if(thisWork[j] !== "no" && Session.get("user").preferences.hideReport && (thisWork[j].confirmations.length/thisWork[j].reports.length) <= 0.9) { + if (thisWork[j] !== "no" && Session.get("user").preferences.hideReport && (thisWork[j].confirmations.length / thisWork[j].reports.length) <= 0.9) { thisWork[j] = "no"; } @@ -188,13 +189,15 @@ 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; + thisWork[j].creator = Meteor.users.findOne({ + _id: thisWork[j].creator + }).profile.name; var conf = thisWork[j].confirmations.length; var repo = thisWork[j].reports.length; var ratio = conf / repo; var normalColor = Session.get("user").preferences.theme["text"]; if (Math.abs(conf - repo)) { - if ((conf+repo) <= 1) { + if ((conf + repo) <= 1) { thisWork[j].doneRatio = normalColor; } else { thisWork[j].doneRatio = "#F9F906"; @@ -228,21 +231,19 @@ Template.registerHelper('commentLength', () => { // Returns characters left for }); 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; - } - }) + 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++) { + for (var i = 0; i < els.length; i++) { var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid"); final.push(classid); } - Meteor.call("reorderClasses", final); }); } @@ -250,7 +251,7 @@ Template.main.helpers({ themeName() { var vals = _.values(themeColors); var curtheme = Session.get("user").preferences.theme; - for(var i = 0; i < vals.length; i++) { + for (var i = 0; i < vals.length; i++) { if (_.isEqual(vals[i], curtheme)) { var name = _.keys(themeColors)[i]; return name.charAt(0).toUpperCase() + name.slice(1); @@ -259,13 +260,13 @@ 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; + if (Session.get("user").school === undefined || Session.get("user").school === null) return; return " - " + Session.get("user").school; }, iconColor(icon) { // Sidebar status color - if (Session.equals("sidebar",icon + "Container")) { + if (Session.equals("sidebar", icon + "Container")) { return Session.get("user").preferences.theme.statusIcons; - } else if (Session.equals("sidebar","both")) { + } else if (Session.equals("sidebar", "both")) { return Session.get("user").preferences.theme.statusIcons; } else { return; @@ -278,12 +279,12 @@ Template.main.helpers({ return Session.get("user").name; }, defaultMode() { //Loads the default display mode for user. - if(load) Session.set("mode",Session.get("user").preferences.mode); + if (load) Session.set("mode", Session.get("user").preferences.mode); load = false; return; }, bgSrc() { // Returns background. - return "Backgrounds/"+ Session.get("user").preferences.theme.background; + return "Backgrounds/" + Session.get("user").preferences.theme.background; }, menuStatus() { // Status of of menu sidebar. if (Session.equals("sidebar", "menuContainer")) { @@ -308,11 +309,11 @@ Template.main.helpers({ return openValues.requests; }, modeStatus(status) { // Color status of display modes. - if (!Session.equals("mode",status)) return; + if (!Session.equals("mode", status)) return; return Session.get("user").preferences.theme.modeHighlight; }, currMode(name) { // Status of display mode. - return Session.equals("mode",name); + return Session.equals("mode", name); }, calendarOptions() { // Settings for the calendar, including work displaying. return { @@ -371,10 +372,10 @@ Template.main.helpers({ Session.set("currentWorkId", event.id); openDivFade(document.getElementsByClassName("overlay")[0]); }, - eventMouseover: function (event, jsEvent, view) { + eventMouseover: function(event, jsEvent, view) { this.style.boxShadow = "inset 0 0 0 99999px rgba(255,255,255,0.2)"; }, - eventMouseout: function (event, jsEvent, view) { + eventMouseout: function(event, jsEvent, view) { this.style.boxShadow = ""; }, dayClick: function(date, jsEvent, view) { // On-click for each day. @@ -402,25 +403,25 @@ Template.main.helpers({ highlight() { // Calendar highlight/scale option. var hoverHighlight = Session.get("classDispHover"); var typeHighlight = Session.get("typeFilterHover"); - if(Session.equals("mode","classes")) { - $(".workCard").toggleClass("scaled",false); + if (Session.equals("mode", "classes")) { + $(".workCard").toggleClass("scaled", false); try { - $(".workCard[classid=\'"+hoverHighlight+"\']").toggleClass("scaled",true); - $(".workCard[type=\'"+typeHighlight+"\']").toggleClass("scaled",true); - } catch(err) {} + $(".workCard[classid=\'" + hoverHighlight + "\']").toggleClass("scaled", true); + $(".workCard[type=\'" + typeHighlight + "\']").toggleClass("scaled", true); + } catch (err) {} } else { - $(".workevent").toggleClass("scaled",false); + $(".workevent").toggleClass("scaled", false); try { - $("."+hoverHighlight).toggleClass("scaled",true); - $("."+typeHighlight).toggleClass("scaled",true); - } catch(err) {} + $("." + hoverHighlight).toggleClass("scaled", true); + $("." + typeHighlight).toggleClass("scaled", true); + } catch (err) {} } return; }, work(value) { // Returns the specified work value. if (Session.equals("currentWork", null)) return; if (Session.get("newWork")) { - return defaultWork[value]; + return defaultWork[value]; } else { return formReadable(Session.get("currentWork"),value); } @@ -434,8 +435,8 @@ Template.main.helpers({ types() { var types = Object.keys(workColors); var array = []; - for(var i = 0; i < types.length; i++) { - array.push({ + for (var i = 0; i < types.length; i++) { + array.push({ "type": types[i], "typeName": types[i][0].toUpperCase() + types[i].slice(1), "selected": _.contains(Session.get("typeFilter"), types[i]) @@ -533,8 +534,8 @@ Template.main.events({ modifyingInput = null; } - if(!document.getElementById("userDropdown").contains(event.target)) closeDivFade(document.getElementById("userDropdown")); - if(!document.getElementById("requests").contains(event.target)) Session.set("requests",false); + if (!document.getElementById("userDropdown").contains(event.target)) closeDivFade(document.getElementById("userDropdown")); + if (!document.getElementById("requests").contains(event.target)) Session.set("requests", false); }, // MAIN MENU BUTTONS 'click .fa-bars' () { // Click menu button. @@ -562,7 +563,7 @@ Template.main.events({ } }, 'click #requests .fa-question' () { - Session.set("requests",!Session.get("requests")); + Session.set("requests", !Session.get("requests")); }, 'click .classes' () { // Click classes mode button. if (Session.equals("mode", "classes")) return; @@ -599,7 +600,7 @@ Template.main.events({ openDivFade(document.getElementsByClassName("overlay")[0]); }, 'click #dropdown' (event) { - if(document.getElementById("userDropdown").style.display === "block") return; + if (document.getElementById("userDropdown").style.display === "block") return; setTimeout(function() { openDivFade(document.getElementById("userDropdown")); }, 300); @@ -608,6 +609,7 @@ Template.main.events({ var dom = event.target; while (event.target.className !== "workCard") event.target = event.target.parentNode; var workid = event.target.getAttribute("workid"); + var thisWork = work.findOne({ _id: workid }); @@ -630,7 +632,7 @@ Template.main.events({ }, 'click #requestSubmit' () { var area = document.getElementById("requestArea"); - if(area.value === "") return; + if (area.value === "") return; var array = {}; array.content = area.value; array.info = { @@ -638,13 +640,13 @@ Template.main.events({ "userInfo": Meteor.user(), "userClasses": Session.get("calendarClasses") }; - Meteor.call("createRequest", array, function(err,result) { + Meteor.call("createRequest", array, function(err, result) { area.value = "Request sent!"; - setTimeout(function(){ + setTimeout(function() { document.getElementById("requests").style.marginBottom = "-15.5vw"; area.value = ""; - Session.set("commentRestrict",null); - },750); + Session.set("commentRestrict", null); + }, 750); }); }, // HANDLING INPUT CHANGING @@ -707,7 +709,7 @@ Template.main.events({ }, 'click #workComment' (event) { var restrict = event.target.maxLength; - Session.set("commentRestrict",restrict-event.target.value.length.toString() + " characters left"); + Session.set("commentRestrict", restrict - event.target.value.length.toString() + " characters left"); var text = document.getElementById("commentrestrict"); text.style.display = "initial"; text.style.color = "#7E7E7E"; @@ -720,11 +722,15 @@ Template.main.events({ var works = userClasses[i].thisClassWork; for (var j = 0; j < works.length; j++) { var work = works[j]; - var workclass = classes.findOne({_id: work.class}); + var workclass = classes.findOne({ + _id: work.class + }); if (work.description == defaultWork.description) work.description = ""; if (work.dueDate == defaultWork.dueDate) continue; if (work.name == defaultWork.name) work.name = ""; - if (workclass === undefined) workclass = {name: "Personal"}; + if (workclass === undefined) workclass = { + name: "Personal" + }; events.push([ workclass.name + ": " + work.name, work.realDate.toLocaleDateString(), @@ -735,8 +741,13 @@ Template.main.events({ } var JSONevents = JSON.stringify(events); - var CSVevents = Papa.unparse({fields: ["Subject", "Start Date", "Description", "All Day Event"], data: JSONevents}); - var eventBlob = new Blob([CSVevents], {type: "data:text/csv;charset=utf-8"}); + var CSVevents = Papa.unparse({ + fields: ["Subject", "Start Date", "Description", "All Day Event"], + data: JSONevents + }); + var eventBlob = new Blob([CSVevents], { + type: "data:text/csv;charset=utf-8" + }); saveAs(eventBlob, "hourglass.csv"); }, 'keydown input' (event) { // Enter to close input. @@ -751,12 +762,12 @@ Template.main.events({ var restrict = event.target.maxLength; var chars = restrict - event.target.value.length; var text; - if(event.target.id === "workComment") { + if (event.target.id === "workComment") { text = document.getElementById("commentrestrict"); - } else if(event.target.id === "requestArea") { + } else if (event.target.id === "requestArea") { text = document.getElementById("requestrestrict"); } else { - text = document.getElementById(Session.get("modifying")+"restrict"); + text = document.getElementById(Session.get("modifying") + "restrict"); } text.style.color = "#7E7E7E"; if (chars === restrict) { // Don't display if nothing in comment. @@ -826,7 +837,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.get("currentWorkId", classid); openDivFade(document.getElementsByClassName("overlay")[0]); } else { // Normal clicking turns on filter. var array = Session.get("classDisp"); @@ -881,14 +892,14 @@ Template.main.events({ } while (div.getAttribute("type") === null) div = div.parentNode; var type = div.getAttribute("type"); - Session.set("typeFilterHover", type); + Session.set("typeFilterHover", type); }, 'mouseleave .sideFilter' (event) { if (event.target.className !== "sideFilter") { var div = event.target.parentNode; if (div.contains(event.target)) return; } - Session.set("typeFilterHover", null); + Session.set("typeFilterHover", null); } }); @@ -921,10 +932,10 @@ function closeInput() { // Close a changeable input and change it back to span. color = "#BEBEBE"; } span.style.color = color; - Session.set("commentRestrict",""); + Session.set("commentRestrict", ""); try { input.parentNode.removeChild(input); - document.getElementById(modifyingInput+"restrict").style.display = "none"; + document.getElementById(modifyingInput + "restrict").style.display = "none"; } catch (err) {} if (input.value === "") { // If input has nothing. span.childNodes[0].nodeValue = "Click here to edit..."; @@ -1005,13 +1016,17 @@ function toDate(date) { // Turns formatted date back to Date constructor. } function formReadable(input, val) { // Makes work information readable by users. - if(input) - switch(val) { - case "typeColor": return input.typeColor = workColors[input.type]; - case "name": return input.name; - case "dueDate": return getReadableDate(input.dueDate); - case "description": return input.description; - case "type": return input.type[0].toUpperCase() + input.type.slice(1); + switch (val) { + case "typeColor": + return input.typeColor = workColors[input.type]; + case "name": + return input.name; + case "dueDate": + return getReadableDate(input.dueDate); + case "description": + return input.description; + case "type": + return input.type[0].toUpperCase() + input.type.slice(1); case "comments": var comments = input.comments; var resort = []; @@ -1023,7 +1038,7 @@ function formReadable(input, val) { // Makes work information readable by users. "date": null, "user": null, "avatar": null, - "email":null + "email": null }; var user = Meteor.users.findOne({ _id: comments[k].user @@ -1050,19 +1065,19 @@ function formReadable(input, val) { // Makes work information readable by users. return input.done; case "doneCol": if (Session.get("newWork")) return ""; - if (!_.contains(input.done,Meteor.userId())) return ""; + if (!_.contains(input.done, Meteor.userId())) return ""; return "#27A127"; case "doneText": if (Session.get("newWork")) return ""; - if (!_.contains(input.done,Meteor.userId())) return "Mark done"; + if (!_.contains(input.done, Meteor.userId())) return "Mark done"; return "Done!"; case "userConfirm": - if(!_.contains(input.confirmations, Meteor.userId())) return ""; + if (!_.contains(input.confirmations, Meteor.userId())) return ""; return "#27A127"; case "confirmations": return input.confirmations.length; case "userReport": - if(!_.contains(input.reports, Meteor.userId())) return ""; + if (!_.contains(input.reports, Meteor.userId())) return ""; return "#FF1A1A"; case "reports": return input.reports.length; diff --git a/hourglass/client/profile/profile.js b/hourglass/client/profile/profile.js index 9885085..a59a763 100644 --- a/hourglass/client/profile/profile.js +++ b/hourglass/client/profile/profile.js @@ -426,7 +426,7 @@ Template.profile.events({ serverData = [user._id, classid]; confirm = "changeAdmin"; Session.set("confirmText", "Are you really sure?"); - openDivFade(document.getElementsByClassName("overlay")[0]) + openDivFade(document.getElementsByClassName("overlay")[0]); document.getElementById("createdClasses").style.marginRight = "-40%"; }, // OVERLAY BUTTONS diff --git a/hourglass/lib/constants.js b/hourglass/lib/constants.js index d64aff5..9ca6a39 100644 --- a/hourglass/lib/constants.js +++ b/hourglass/lib/constants.js @@ -1,3 +1,13 @@ +AdminConfig = { + name: 'Hourglass', + collections: { + schools: {}, + classes: {}, + work: {}, + requests: {} + } +}; + themeColors = { "light": { "background": "White.jpg", @@ -93,4 +103,4 @@ options = { ] } -serverData = null; \ No newline at end of file +serverData = null; diff --git a/hourglass/server/main.js b/hourglass/server/main.js index b1ab797..b3813a6 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -6,9 +6,6 @@ import { Mongo } from 'meteor/mongo'; -Houston.add_collection(Meteor.users); -Houston.add_collection(Houston._admins); - // Defines who the admins are - not added var superadmins = [ "ybq987@gmail.com", @@ -28,9 +25,7 @@ for (var i = 0; i < superadmins.length; i++) { }); if (superadmin !== undefined && !(Roles.userIsInRole(superadmin._id, 'superadmin'))) { Roles.addUsersToRoles(superadmin._id, 'superadmin'); - Houston._admins.insert({ - user_id: superadmin._id - }); + Roles.addUsersToRoles(superadmin._id, 'admin'); } } @@ -528,11 +523,11 @@ Meteor.methods({ var prof = Meteor.user().profile; var found = classes.findOne({ _id: change, - status: true }); if (Meteor.user() !== null && found !== null && pass === found.code && + (found.status || found.admin === Meteor.userId()) && !_.contains(prof.classes, change)) { var foundsubs = found.subscribers; classes.update({