@@ -1,28 +1,15 @@
angular.module("buckleDown", ["ngRoute", "ngAnimate"])
.controller("students",
studentController)
.controller("mentors",
mentorController)
.controller("newStudent",
newStudentController)
.controller("newMentor",
newMentorController)
.controller("signup",
signupController)
.controller("face",
facebookController)
// .controller("authCtrl",
// aControl)
.controller('module.auth.controller',
Auth)
.controller("profile",
profileController)
.factory("SFactory", studentFactory)
.factory("MFactory", mentorFactory)
.config(Router);

studentController.$inject = ["SFactory"]
newStudentController.$inject = ["SFactory"]
mentorController.$inject = ["MFactory"]
newMentorController.$inject = ["MFactory"]
profileController.$inject = ["SFactory", "MFactory"]

Router.$inject = ["$routeProvider"];

@@ -68,166 +55,152 @@ function Router ($routeProvider){

.when("/students", {
templateUrl: "html/templates/students.html",
controller: "students as sCtrl"
controller: "profile as pCtrl"
})
.when("/mentors", {
templateUrl: "html/templates/mentors.html",
controller: "mentors as mCtrl"
controller: "profile as pCtrl"
})
.when("/signup", {
templateUrl: "html/templates/signup.html",
controller: "module.auth.controller as auth"
})
.when("/profile", {
templateUrl: "html/templates/profile.html"
templateUrl: "html/templates/profile.html",
controller: "profile as pCtrl"
})
.when("/contact", {
templateUrl: "html/templates/contact.html"

});
}

function studentController (SFactory) {
function profileController (SFactory, MFactory) {

var sCtrl = this;
var pCtrl = this;

sCtrl.studentFound = false;
pCtrl.studentFound = false;

sCtrl.studentIndex = -1;
pCtrl.studentIndex = -1;

var studentArray = SFactory.getStudentsLocal();

sCtrl.searchStudent = function (name) {
sCtrl.studentFound = false;
pCtrl.searchStudent = function (name) {
pCtrl.studentFound = false;
for (var i = 0; i < studentArray.length; i++){
if(studentArray[i].name == name){
sCtrl.nameText = studentArray[i].name;
sCtrl.bioText = studentArray[i].bio;
sCtrl.goalsText = studentArray[i].goals;
sCtrl.studentFound = true;
sCtrl.studentIndex = i;
pCtrl.menteeName = studentArray[i].name;
pCtrl.bioText = studentArray[i].bio;
pCtrl.goalsText = studentArray[i].goals;
pCtrl.studentFound = true;
pCtrl.studentIndex = i;
}
}

}

sCtrl.myVar1 = false;
pCtrl.myVar = false;

console.log('hello');

sCtrl.updateProfile = function(){
sCtrl.myVar1 = !sCtrl.myVar1;
pCtrl.updateProfile = function(){
pCtrl.myVar = !pCtrl.myVar;
console.log('hi');
console.log(sCtrl.studentIndex);
if (sCtrl.studentIndex != -1) {
studentArray[sCtrl.studentIndex].name = sCtrl.nameText;
studentArray[sCtrl.studentIndex].bio = sCtrl.bioText;
studentArray[sCtrl.studentIndex].goals = sCtrl.goalsText;
console.log(pCtrl.studentIndex);
if (pCtrl.studentIndex != -1) {
studentArray[pCtrl.studentIndex].name = pCtrl.nameText;
studentArray[pCtrl.studentIndex].bio = pCtrl.bioText;
studentArray[pCtrl.studentIndex].goals = pCtrl.goalsText;
SFactory.setStudentsLocal(studentArray);
}
console.log('hello');

}

};

function mentorController () {

var mCtrl = this;
pCtrl.mentorName = "Rob Gordon";

mCtrl.nameText = "Rob Gordon";

mCtrl.bioText = "Scenester DIY shoreditch deep v tote bag, street art paleo. Before they sold out blog salvia listicle, beard keytar in art party est readymade kale chips +1 crucifix id try-hard.Sustainable mixtape fingerstache, pitchfork banjo meditation hashtag artisan kitsch. Sustainable 3 wolf moon helvetica food truck art party, tote bag celiac. Dreamcatcher man bun YOLO butcher, literally banjo jean shorts twee next level drinking vinegar squid yuccie PBR&B art party brooklyn."
pCtrl.bioText = "Scenester DIY shoreditch deep v tote bag, street art paleo. Before they sold out blog salvia listicle, beard keytar in art party est readymade kale chips +1 crucifix id try-hard.Sustainable mixtape fingerstache, pitchfork banjo meditation hashtag artisan kitsch. Sustainable 3 wolf moon helvetica food truck art party, tote bag celiac. Dreamcatcher man bun YOLO butcher, literally banjo jean shorts twee next level drinking vinegar squid yuccie PBR&B art party brooklyn."

mCtrl.qualificationsText = "Hammock 8-bit lo-fi ullamco kombucha craft beer. Gentrify tempor wayfarers roof party pop-up. Ugh everyday carry semiotics tattooed nisi actually. Yuccie chia four dollar toast sint photo booth. Street art meggings synth, knausgaard fingerstache tofu lo-fi. Ennui letterpress flexitarian polaroid"
pCtrl.qualificationsText = "Hammock 8-bit lo-fi ullamco kombucha craft beer. Gentrify tempor wayfarers roof party pop-up. Ugh everyday carry semiotics tattooed nisi actually. Yuccie chia four dollar toast sint photo booth. Street art meggings synth, knausgaard fingerstache tofu lo-fi. Ennui letterpress flexitarian polaroid"

mCtrl.myVar1 = false;
pCtrl.myVar1 = false;

console.log('hello');

mCtrl.updateProfile = function(){
mCtrl.myVar1 = !mCtrl.myVar1;
pCtrl.updateProfile = function(){
pCtrl.myVar1 = !pCtrl.myVar1;
console.log('hi');

console.log('hello');
/*I need to make the updates to the user profiles permanent.
Will do this at a later date. I have it completed for students. Just keep this as an example of a user's page.*/
}
/*I need to make the updates to the user profiles permanent.
Will do this at a later date. I have it completed for students. Just keep this as an example of a user's page.*/
}

};
function signupController(){}

function newStudentController (SFactory){ //Make form for new student info
var nSCtrl = this;

nSCtrl.myVar = false;
pCtrl.myVar2 = false;

console.log(SFactory);
//nSCtrl.studentList = SFactory.studentList;
nSCtrl.newStudentObject = {
//pCtrl.studentList = SFactory.studentList;
pCtrl.newStudentObject = {
name: '',
bio: '',
goals: '',
}
}

nSCtrl.newStudent = function(){
nSCtrl.myVar = !nSCtrl.myVar;
pCtrl.newStudent = function(){
pCtrl.myVar2 = !pCtrl.myVar2;
console.log('hi');
}


nSCtrl.studentArray = JSON.parse(localStorage.getItem('studentArray')) || [];
pCtrl.studentArray = JSON.parse(localStorage.getItem('studentArray')) || [];

nSCtrl.addStudent = function (){ //I need to eventually time this in with the facebook comment stream. Each new user should have a fb comment section from the start.
SFactory.addStudent(nSCtrl.newStudentObject);
nSCtrl.studentArray.push(nSCtrl.newStudentObject);
localStorage.setItem('studentArray', JSON.stringify(nSCtrl.studentArray));
nSCtrl.newStudentObject = {
pCtrl.addStudent = function (){ //I need to eventually time this in with the facebook comment stream. Each new user should have a fb comment section from the start.
SFactory.addStudent(pCtrl.newStudentObject);
pCtrl.studentArray.push(pCtrl.newStudentObject);
localStorage.setItem('studentArray', JSON.stringify(pCtrl.studentArray));
pCtrl.newStudentObject = {
name: '',
bio: '',
goals: '',
}
console.log('Hello from ', nSCtrl.newStudentObject);
}
console.log('Hello from ', pCtrl.newStudentObject);
console.log('my students ', SFactory.getStudents());
}
}

function newMentorController (MFactory) { //Make form for new mentor info
var nMCtrl = this;

nMCtrl.myVar = false;

pCtrl.myVar3 = false;

console.log(MFactory);

nMCtrl.newMentorObject = {
name: '',
bio: '',
qualificaions: '',
}
pCtrl.newMentorObject = {
name: '',
bio: '',
qualificaions: '',
}

nMCtrl.newMentor = function(){
nMCtrl.myVar = !nMCtrl.myVar;
pCtrl.newMentor = function(){
pCtrl.myVar3 = !pCtrl.myVar3;
console.log('hi');
}

nMCtrl.mentorArray = JSON.parse(localStorage.getItem('mentorArray')) || [];
pCtrl.mentorArray = JSON.parse(localStorage.getItem('mentorArray')) || [];

nMCtrl.addMentor = function (){ //I need to eventually time this in with the facebook comment stream. Each new user should have a fb comment section from the start.
MFactory.addMentor(nMCtrl.newMentorObject);
nMCtrl.mentorArray.push(nMCtrl.newMentorObject);
localStorage.setItem('mentorArray', JSON.stringify(nMCtrl.mentorArray));
nMCtrl.newMentorObject = {
pCtrl.addMentor = function (){ //I need to eventually time this in with the facebook comment stream. Each new user should have a fb comment section from the start.
MFactory.addMentor(pCtrl.newMentorObject);
pCtrl.mentorArray.push(pCtrl.newMentorObject);
localStorage.setItem('mentorArray', JSON.stringify(pCtrl.mentorArray));
pCtrl.newMentorObject = {
name: '',
bio: '',
qualifications: '',
}

console.log('Hello from ', nMCtrl.newMentorObject);
console.log('Hello from ', pCtrl.newMentorObject);
console.log('mentors ', MFactory.getMentors());
}
}


};

function studentFactory () {

This file was deleted.

This file was deleted.

This file was deleted.