Finished profile page, fixed minor bugs, css fixes
This commit is contained in:
parent
7b8a0c43c6
commit
cf082c40d9
@ -1264,7 +1264,6 @@ textarea.clickModify {
|
|||||||
|
|
||||||
#userFunctions {
|
#userFunctions {
|
||||||
margin-bottom: 1%;
|
margin-bottom: 1%;
|
||||||
border-bottom: 2px solid #666;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.userFunction {
|
.userFunction {
|
||||||
|
|||||||
@ -69,6 +69,7 @@ Template.registerHelper('screen', (multiplier, fraction) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in themeColors.
|
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in themeColors.
|
||||||
|
if(Session.get("user") === null) return;
|
||||||
return (Object.keys(Session.get("user")).length === 0) ? themeColors["lux"][div] : Session.get("user").preferences.theme[div];
|
return (Object.keys(Session.get("user")).length === 0) ? themeColors["lux"][div] : Session.get("user").preferences.theme[div];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#colRight {
|
#colRight {
|
||||||
border-left: 1px solid #666;
|
border-left: 1px solid #9C9C9C;
|
||||||
float: right;
|
float: right;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.2);
|
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.2);
|
||||||
@ -549,13 +549,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#creRules p {
|
#creRules p {
|
||||||
|
font-size: 2vh;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formDiv {
|
.formDiv {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 2%;
|
padding: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline;
|
display: inline;
|
||||||
@ -580,6 +581,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.profTitle {
|
.profTitle {
|
||||||
|
font-size: 2vh;
|
||||||
|
margin: 1% !important;
|
||||||
padding-left: 0 !important;
|
padding-left: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,7 +592,7 @@
|
|||||||
|
|
||||||
#creSubmit {
|
#creSubmit {
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
width: 30%;
|
width: 50%;
|
||||||
padding: 2%;
|
padding: 2%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-top: 2%;
|
margin-top: 2%;
|
||||||
|
|||||||
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
.opTitle {
|
.opTitle {
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
margin: 0;
|
margin: 1%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#basicNext {
|
#basicNext {
|
||||||
@ -230,6 +230,7 @@
|
|||||||
|
|
||||||
#profPageWrapper #createWrapper {
|
#profPageWrapper #createWrapper {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
margin-top: -1%;
|
||||||
padding: 3%;
|
padding: 3%;
|
||||||
padding-bottom: 2%;
|
padding-bottom: 2%;
|
||||||
width: 30%;
|
width: 30%;
|
||||||
@ -237,12 +238,8 @@
|
|||||||
background-color: rgba(255,255,255,0.2);
|
background-color: rgba(255,255,255,0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.formDiv {
|
#profPageWrapper .-autocomplete-container {
|
||||||
width: 100%;
|
margin-top: -6%;
|
||||||
margin: 0;
|
|
||||||
padding: 2%;
|
|
||||||
background-color: transparent;
|
|
||||||
display: inline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#profPageWrapper #creSubmit {
|
#profPageWrapper #creSubmit {
|
||||||
@ -253,10 +250,6 @@
|
|||||||
margin-bottom: 1%;
|
margin-bottom: 1%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#createWrapper p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profPageWrapper input {
|
#profPageWrapper input {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 2%;
|
padding: 2%;
|
||||||
|
|||||||
@ -72,7 +72,7 @@
|
|||||||
<div id="createInfo">
|
<div id="createInfo">
|
||||||
<div id="createWrapper">
|
<div id="createWrapper">
|
||||||
<div id="creRules">
|
<div id="creRules">
|
||||||
<p>Submit a request for a class to be approved by an administrator.<br>
|
<p>Submit a request for a class to be approved by an administrator.
|
||||||
You can have up to 8 unapproved classes at once.</p>
|
You can have up to 8 unapproved classes at once.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="formContainer">
|
<div id="formContainer">
|
||||||
|
|||||||
@ -215,22 +215,7 @@ Template.profile.events({
|
|||||||
});
|
});
|
||||||
Session.set("newClasses", newClasses);
|
Session.set("newClasses", newClasses);
|
||||||
$(".creInput").each(function(){$(this).val('');});
|
$(".creInput").each(function(){$(this).val('');});
|
||||||
/*if (!teachers.findOne({
|
|
||||||
name: values.teacher
|
|
||||||
})) {
|
|
||||||
Meteor.call("createTeacher", values.teacher, values.school, function(error, result) {
|
|
||||||
if (error !== undefined) {
|
|
||||||
sAlert.error(error.message, {
|
|
||||||
effect: 'stackslide',
|
|
||||||
position: 'top'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
sendData("createClass");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
sendData("createClass");
|
|
||||||
}*/
|
|
||||||
},
|
},
|
||||||
'click #backArrow' () {
|
'click #backArrow' () {
|
||||||
slideToField(Session.get("sections")[1]-1);
|
slideToField(Session.get("sections")[1]-1);
|
||||||
@ -343,9 +328,10 @@ Template.profile.events({
|
|||||||
}
|
}
|
||||||
} catch(err) {}
|
} catch(err) {}
|
||||||
},
|
},
|
||||||
'click .classBox .fa-plus' (event) {
|
'click .classBox .fa-plus, click #classBody .classBox' (event) {
|
||||||
var profile = Session.get("profile");
|
var profile = Session.get("profile");
|
||||||
var id = event.target.parentNode.getAttribute("classid");
|
while(event.target.getAttribute("classid") === null) event.target = event.target.parentNode;
|
||||||
|
var id = event.target.getAttribute("classid");
|
||||||
if(profile.classes.indexOf(id) === -1) {
|
if(profile.classes.indexOf(id) === -1) {
|
||||||
profile.classes.push(id);
|
profile.classes.push(id);
|
||||||
Session.set("profile", profile);
|
Session.set("profile", profile);
|
||||||
@ -382,6 +368,74 @@ Template.profile.events({
|
|||||||
return b.subscribers - a.subscribers;
|
return b.subscribers - a.subscribers;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'click #profileSubmit' () {
|
||||||
|
// clear html and make page uninteractable
|
||||||
|
var myClasses = Session.get("profile").classes;
|
||||||
|
var newClasses = Session.get("newClasses");
|
||||||
|
var message = "Sorry, your profile couldn't be created. Please try again!";
|
||||||
|
|
||||||
|
_.each(myClasses, function(myClass) {
|
||||||
|
Meteor.call("joinClass", [myClass, ""], function(err, result) {
|
||||||
|
if(err !== undefined) {
|
||||||
|
sAlert.error(message, {
|
||||||
|
effect: 'stackslide',
|
||||||
|
position: 'top'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
_.each(newClasses, function(newClass) {
|
||||||
|
if (!teachers.findOne({
|
||||||
|
name: newClass.teacher
|
||||||
|
})) {
|
||||||
|
Meteor.call("createTeacher", newClass.teacher, newClass.school, function(error, result) {
|
||||||
|
if (error !== undefined) {
|
||||||
|
sAlert.error(message, {
|
||||||
|
effect: 'stackslide',
|
||||||
|
position: 'top'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Meteor.call("createClass", newClass, function(error, result) {
|
||||||
|
if(error !== undefined) {
|
||||||
|
sAlert.error(message, {
|
||||||
|
effect: 'stackslide',
|
||||||
|
position: 'top'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Meteor.call("createClass", newClass, function(error, result) {
|
||||||
|
if(error !== undefined) {
|
||||||
|
sAlert.error(message, {
|
||||||
|
effect: 'stackslide',
|
||||||
|
position: 'top'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var profile = Session.get("profile");
|
||||||
|
profile.complete = true;
|
||||||
|
profile.preferences = Meteor.user().profile.preferences;
|
||||||
|
profile.classes.push(Meteor.userId());
|
||||||
|
Meteor.call("editProfile", profile, function(err, result) {
|
||||||
|
if(err !== undefined) {
|
||||||
|
sAlert.error(message, {
|
||||||
|
effect: 'stackslide',
|
||||||
|
position: 'top'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Meteor.subscribe('classes');
|
||||||
|
Meteor.subscribe('schools');
|
||||||
|
Meteor.subscribe('teachers');
|
||||||
|
Meteor.subscribe('work');
|
||||||
|
Meteor.subscribe('requests');
|
||||||
|
Meteor.subscribe("personalUser");
|
||||||
|
Meteor.subscribe('users');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -77,6 +77,7 @@ AdminConfig = {
|
|||||||
{ label: 'Name', name: 'profile.name' },
|
{ label: 'Name', name: 'profile.name' },
|
||||||
{ label: 'School', name: 'profile.school' },
|
{ label: 'School', name: 'profile.school' },
|
||||||
{ label: 'Graduation Year', name:'profile.grade' },
|
{ label: 'Graduation Year', name:'profile.grade' },
|
||||||
|
{ label: 'Complete', name:'profile.complete'},
|
||||||
{ label: 'Icon', name: '_id', template: 'adminUserDisplay' },
|
{ label: 'Icon', name: '_id', template: 'adminUserDisplay' },
|
||||||
],
|
],
|
||||||
templates: {
|
templates: {
|
||||||
@ -98,6 +99,7 @@ AdminConfig = {
|
|||||||
{ label: 'Name', name: 'profile.name' },
|
{ label: 'Name', name: 'profile.name' },
|
||||||
{ label: 'School', name: 'profile.school' },
|
{ label: 'School', name: 'profile.school' },
|
||||||
{ label: 'Graduation Year', name:'profile.grade' },
|
{ label: 'Graduation Year', name:'profile.grade' },
|
||||||
|
{ label: 'Complete', name:'profile.complete'},
|
||||||
{ label: 'Icon', name: '_id', template: 'adminUserDisplay' },
|
{ label: 'Icon', name: '_id', template: 'adminUserDisplay' },
|
||||||
],
|
],
|
||||||
templates: {
|
templates: {
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
themeColors = {
|
themeColors = {
|
||||||
"lux": {
|
"lux": {
|
||||||
"background": "White.jpg",
|
"background": "White.jpg",
|
||||||
"mainColor": "#DBDBDB",
|
"mainColor": "#4D82AC",
|
||||||
"secondaryColor": "#567393",
|
"secondaryColor": "#4C75A2",
|
||||||
"sidebarColor": "#6C94B4",
|
"sidebarColor": "#5E88A8",
|
||||||
"userDropdownColor": "#E6E6E6",
|
"userDropdownColor": "#427EB4",
|
||||||
"iconHighlight": "#FFF",
|
"iconHighlight": "#39CAFF",
|
||||||
"modeHighlight": "#D34949",
|
"modeHighlight": "#F02C2C",
|
||||||
"classCardColor":"#EBEBEB",
|
"classCardColor":"#5D86A8",
|
||||||
"textColor": "#000"
|
"textColor": "#FFF"
|
||||||
},
|
},
|
||||||
"nox": {
|
"nox": {
|
||||||
"background": "Black.jpg",
|
"background": "Black.jpg",
|
||||||
|
|||||||
@ -8,26 +8,30 @@ function completeProfile() {
|
|||||||
|
|
||||||
Router.route('/', {
|
Router.route('/', {
|
||||||
waitOn: function() {
|
waitOn: function() {
|
||||||
|
if(!Meteor.userId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
Meteor.subscribe('classes', this.params._id),
|
||||||
|
Meteor.subscribe('schools', this.params._id),
|
||||||
|
Meteor.subscribe('teachers', this.params._id),
|
||||||
|
Meteor.subscribe('work', this.params._id),
|
||||||
|
Meteor.subscribe('requests', this.params._id),
|
||||||
|
Meteor.subscribe('personalUser', this.params._id),
|
||||||
|
Meteor.subscribe('users', this.params._id)
|
||||||
|
];
|
||||||
|
},
|
||||||
|
action: function() {
|
||||||
if (!Meteor.userId() || !completeProfile()) {
|
if (!Meteor.userId() || !completeProfile()) {
|
||||||
this.redirect('/login');
|
this.redirect('/login');
|
||||||
} else {
|
} else {
|
||||||
return [
|
if(_.contains([null, undefined, ""], Meteor.user().profile.school ||
|
||||||
Meteor.subscribe('classes', this.params._id),
|
_.contains([null, undefined, ""], Meteor.user().profile.grade))) {
|
||||||
Meteor.subscribe('schools', this.params._id),
|
this.redirect('/profile');
|
||||||
Meteor.subscribe('teachers', this.params._id),
|
} else {
|
||||||
Meteor.subscribe('work', this.params._id),
|
Session.set("user", Meteor.user().profile);
|
||||||
Meteor.subscribe('requests', this.params._id),
|
this.render("main");
|
||||||
Meteor.subscribe('users', this.params._id)
|
}
|
||||||
];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
action: function() {
|
|
||||||
if(_.contains([null, undefined, ""], Meteor.user().profile.school ||
|
|
||||||
_.contains([null, undefined, ""], Meteor.user().profile.grade))) {
|
|
||||||
this.redirect('/profile');
|
|
||||||
} else {
|
|
||||||
Session.set("user", Meteor.user().profile);
|
|
||||||
this.render("main");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -37,10 +41,8 @@ Router.route('/login', {
|
|||||||
if (!Meteor.userId()) {
|
if (!Meteor.userId()) {
|
||||||
this.render("login");
|
this.render("login");
|
||||||
} else if (!completeProfile()) {
|
} else if (!completeProfile()) {
|
||||||
Session.set("user", Meteor.user().profile);
|
|
||||||
this.redirect('/profile');
|
this.redirect('/profile');
|
||||||
} else {
|
} else {
|
||||||
Session.set("user", Meteor.user().profile);
|
|
||||||
this.redirect('/');
|
this.redirect('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,21 +50,22 @@ Router.route('/login', {
|
|||||||
|
|
||||||
Router.route('/profile', {
|
Router.route('/profile', {
|
||||||
waitOn: function() {
|
waitOn: function() {
|
||||||
|
return [
|
||||||
|
Meteor.subscribe('classes', this.params._id),
|
||||||
|
Meteor.subscribe('schools', this.params._id),
|
||||||
|
Meteor.subscribe('teachers', this.params._id),
|
||||||
|
Meteor.subscribe('work', this.params._id),
|
||||||
|
Meteor.subscribe('requests', this.params._id),
|
||||||
|
Meteor.subscribe('personalUser', this.params._id),
|
||||||
|
Meteor.subscribe('users', this.params._id)
|
||||||
|
];
|
||||||
|
},
|
||||||
|
action: function() {
|
||||||
if (!Meteor.userId() || completeProfile()) {
|
if (!Meteor.userId() || completeProfile()) {
|
||||||
this.redirect('/login');
|
this.redirect('/login');
|
||||||
} else {
|
} else {
|
||||||
return [
|
this.render("profile");
|
||||||
Meteor.subscribe('classes', this.params._id),
|
|
||||||
Meteor.subscribe('schools', this.params._id),
|
|
||||||
Meteor.subscribe('teachers', this.params._id),
|
|
||||||
Meteor.subscribe('work', this.params._id),
|
|
||||||
Meteor.subscribe('requests', this.params._id),
|
|
||||||
Meteor.subscribe('users', this.params._id)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
action: function() {
|
|
||||||
this.render("profile");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,23 @@ Meteor.publish('classes', function() {
|
|||||||
} else {
|
} else {
|
||||||
Meteor.call('createProfile', this.userId);
|
Meteor.call('createProfile', this.userId);
|
||||||
return classes.find({
|
return classes.find({
|
||||||
_id: null
|
privacy: false,
|
||||||
|
status: true,
|
||||||
|
}, {
|
||||||
|
// Return non-sensitive fields
|
||||||
|
fields: {
|
||||||
|
school: 1,
|
||||||
|
name: 1,
|
||||||
|
hour: 1,
|
||||||
|
teacher: 1,
|
||||||
|
admin: 1,
|
||||||
|
status: 1,
|
||||||
|
privacy: 1,
|
||||||
|
category: 1,
|
||||||
|
moderators: 1,
|
||||||
|
banned: 1,
|
||||||
|
subscribers: 1
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,6 +124,15 @@ Meteor.publish('requests', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Meteor.publish("personalUser", function() {
|
||||||
|
return Meteor.users.find({_id: this.userId}, {
|
||||||
|
fields: {
|
||||||
|
'services': 1,
|
||||||
|
'profile': 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
//Publishes every-persons email and user-ids
|
//Publishes every-persons email and user-ids
|
||||||
|
|
||||||
Meteor.publish('users', function() {
|
Meteor.publish('users', function() {
|
||||||
@ -119,9 +144,7 @@ Meteor.publish('users', function() {
|
|||||||
fields: {
|
fields: {
|
||||||
'services.google.email': 1,
|
'services.google.email': 1,
|
||||||
'services.google.picture': 1,
|
'services.google.picture': 1,
|
||||||
'profile.banner': 1,
|
|
||||||
'profile.grade': 1,
|
'profile.grade': 1,
|
||||||
'profile.description': 1,
|
|
||||||
'profile.name': 1,
|
'profile.name': 1,
|
||||||
'profile.school': 1
|
'profile.school': 1
|
||||||
}
|
}
|
||||||
@ -129,7 +152,6 @@ Meteor.publish('users', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Allows only superadmins to edit collections from client
|
// Allows only superadmins to edit collections from client
|
||||||
Security.permit(['insert', 'update', 'remove']).collections([schools, classes, work]).ifHasRole('superadmin');
|
Security.permit(['insert', 'update', 'remove']).collections([schools, classes, work]).ifHasRole('superadmin');
|
||||||
|
|
||||||
@ -595,7 +617,6 @@ Meteor.methods({
|
|||||||
throw new Meteor.Error(errors[security]);
|
throw new Meteor.Error(errors[security]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// User Functions
|
// User Functions
|
||||||
'editProfile': function(change) {
|
'editProfile': function(change) {
|
||||||
var refyear = new Date().getUTCFullYear();
|
var refyear = new Date().getUTCFullYear();
|
||||||
@ -605,15 +626,11 @@ Meteor.methods({
|
|||||||
"school": change.school,
|
"school": change.school,
|
||||||
"grade": change.grade,
|
"grade": change.grade,
|
||||||
"classes": current.classes,
|
"classes": current.classes,
|
||||||
"description": change.description,
|
|
||||||
"banner": change.banner,
|
|
||||||
"preferences": change.preferences,
|
"preferences": change.preferences,
|
||||||
"name": current.name,
|
"name": current.name,
|
||||||
"complete": current.complete
|
"complete": change.complete
|
||||||
};
|
};
|
||||||
if (current.description && current.description.length > 50) {
|
|
||||||
current.description = current.description.slice(0, 50);
|
|
||||||
}
|
|
||||||
if ((current.grade <= refyear || current.grade >= refyear + 4) && current.grade !== 0) {
|
if ((current.grade <= refyear || current.grade >= refyear + 4) && current.grade !== 0) {
|
||||||
current.grade = refyear;
|
current.grade = refyear;
|
||||||
}
|
}
|
||||||
@ -646,7 +663,6 @@ Meteor.methods({
|
|||||||
_id: userId
|
_id: userId
|
||||||
});
|
});
|
||||||
var current = currentuser.profile;
|
var current = currentuser.profile;
|
||||||
current.banner = "/Banners/defaultcover.jpg";
|
|
||||||
current.classes = [userId];
|
current.classes = [userId];
|
||||||
current.preferences = {
|
current.preferences = {
|
||||||
"theme": themeColors.lux,
|
"theme": themeColors.lux,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user