Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/css/style.css

Large diffs are not rendered by default.

124 changes: 78 additions & 46 deletions public/js/app.js

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions src-client/scripts/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,20 @@ const ACTIONS = {
formInvstForm.set(formInfo)

formInvstForm.save().then(function(serverRes){
console.log(serverRes)
STORE.setStore('currentUser', serverRes)
formInvstForm.set(serverRes)
STORE.setStore('currentUser', formInvstForm)
})
location.hash = "/dash/investors"
},
//
handleInvestorLogin: function(usrInfo){
let InvstLogin = new InvestorLoginModel()
let invstLogin = new InvestorLoginModel()

InvstLogin.set(usrInfo)
invstLogin.set(usrInfo)

InvstLogin.save().then(function(serverRes){

console.log(serverRes)
STORE.setStore('currentUser', serverRes)
invstLogin.save().then(function(serverRes){
invstLogin.set(serverRes)
STORE.setStore('currentUser', invstLogin)
location.hash = "/dash/investors"
// localStorage.setItem("user_id", serverRes.id);
// console.log(localStorage.getItem("user_id"))
Expand Down Expand Up @@ -106,7 +105,7 @@ const ACTIONS = {
},

fetchCurrentStudent: function(){
let newModel = new StudentModel("/currentstudent")
let newModel = new StudentModel()
console.log("thisone?", newModel)
newModel.checkAuth("/currentstudent").then(function(){

Expand All @@ -116,9 +115,9 @@ const ACTIONS = {
})
},
fetchCurrentInvestor: function(){
let newModel = new InvestorAppModel("/currentstudent")
let newModel = new InvestorAppModel()
console.log("thisone?", newModel)
newModel.checkAuth("/currentinvestor").then(function(){
newModel.checkAuth().then(function(){

STORE.setStore('currentUser', newModel)
}).fail(function(){
Expand Down
38 changes: 31 additions & 7 deletions src-client/scripts/home-view.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const React = require('react')
const AppBarExampleIcon = require('./student-signup.js')
const ACTIONS = require("./actions.js")
const Modal = require('./simple-components.js')
const STORE = require('./store.js')


const HomeView = React.createClass({


const HomeView = React.createClass({

componentWillMount: function(){
// ACTIONS.fetchSchoolData()
Expand All @@ -19,11 +21,21 @@ const HomeView = React.createClass({
},

render: function(){
console.log('school data', this.props.schoolData)
console.log('data', this.props)
let modalView = function(){

if(this.props.userType.length > 2){
console.log("im tryin to changggaa")
return <Modal userType={this.props.userType}/>

}
}.bind(this)



return(
<div className="fluid-container home-view">
{modalView()}
<NavView/>
<div className="jumbotron hdr-hero">

Expand Down Expand Up @@ -69,10 +81,16 @@ const SchoolItem = React.createClass({
})


module.exports = {HomeView, NavView}

const NavView = React.createClass({

_studLogin: function(){
STORE.setStore('userType', "Student")
},

_invstLogin: function(){
STORE.setStore('userType', "Investor")
},



Expand All @@ -89,13 +107,13 @@ const NavView = React.createClass({
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
<a className="navbar-brand" href="#/login/investors">StudentStocks</a>
<a className="navbar-brand" href="">StudentStocks</a>
</div>

<div className="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul className="nav navbar-nav">
<li className="active"><a href="#/login/students">Student Login <span className="sr-only">(current)</span></a></li>
<li className="active"><a href="#/login/investors">Investor Login<span className="sr-only">(current)</span></a></li>
<li className="active" ><a href="#" onClick={this._studLogin}>Student Login</a></li>
<li className="active" ><a href="#" onClick={this._invstLogin}>Investor Login</a></li>

</ul>
{/* <form className="navbar-form navbar-left" role="search">
Expand Down Expand Up @@ -132,6 +150,12 @@ const HeaderHeros = React.createClass({

},

_handleModalView: function(evt){
console.log(evt)

STORE.setStore('showModal', true)
},




Expand All @@ -147,7 +171,7 @@ const HeaderHeros = React.createClass({
<button className="btn btn-primary" onClick={this._handleStudentForm} ref="student">Apply Now</button>
<p>or</p>
{/* page down to student about/testimonials */}
<button className="btn btn-primary">Find out more</button>
<button className="btn btn-primary" onClick={this._handleModalView}>Find out more</button>
<h4>XX Active Student Loans</h4>

</div>
Expand Down
1 change: 1 addition & 0 deletions src-client/scripts/investor-signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const InvestorForm = React.createClass({
evt.preventDefault()

let newForm = this.state;
newForm["school"] = this.refs.school.value

ACTIONS.submitInvestorForm(newForm)

Expand Down
72 changes: 33 additions & 39 deletions src-client/scripts/simple-components.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,51 @@
const React = require('react')
const ACTIONS = require("./actions.js")
const STORE = require('./store.js')

const LoginModal = React.createClass({

_handleSubmit: function(evt){
evt.preventDefault()
console.log(this.refs.userField.value)
console.log(this.refs.passField.value)
let loginInfo = {
username: this.refs.userField.value,
password: this.refs.passField.value
}
if(this.props.userType === "investor"){

// input component

const SimpleInput = React.createClass ({





render: function(){


return (
<input type={this.props.textType} className="simp-input" placeholder={this.props.content} ref={this.props.content}/>
)
}
})


const SimpleButton = React.createClass ({

render: function(){


return (
<button className="simp-button" ref={this.props.content}>{this.props.content}</button>
)
}
})


const TestView = React.createClass({
ACTIONS.handleInvestorLogin(loginInfo)
}else{
ACTIONS.handleStudentLogin(loginInfo)
}

},
_exitLogin: function(){
STORE.setStore('userType', "")
},



render: function(){


return(
<div>
<SimpleButton content="Hello"/>
<SimpleInput content="email" textType="text"/>



<div className="login-modal">
<a className="close-modal" href="#" onClick={this._exitLogin}>X</a>
<div>
<form action="">
<p>Username</p>
<input className="input-group" type="text" className="username" ref="userField"/>
<p>Password</p>
<input className="input-group" type="password" className="password" ref="passField"/>
<button onClick={this._handleSubmit} className="btn btn-primary">Login</button>
</form>
</div>
</div>

)
}
})


module.exports = {TestView}

module.exports = LoginModal
3 changes: 2 additions & 1 deletion src-client/scripts/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const STORE = {
allStudents: [],
currentUser: {},
studentsSearched: [],
currentView: "",
userType: "",
showModal: false


},
Expand Down
2 changes: 1 addition & 1 deletion src-client/scripts/student-signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const SchoolOption = React.createClass({

render: function(){
return (
<option value="">
<option value={this.props.schoolName}>
{this.props.schoolName}
</option>
)
Expand Down
2 changes: 1 addition & 1 deletion src-client/scripts/view-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const AppView = React.createClass({

switch (this.props.currentView) {
case "home":
return <HomeView schoolData={this.state.schools}/>
return <HomeView schoolData={this.state.schools} showModal={this.state.showModal} userType={this.state.userType}/>
break;
case "dash/students":
return <StudentView user={this.state.currentUser}/>
Expand Down
52 changes: 43 additions & 9 deletions src-client/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,53 @@ body{


#app-container{
.in-cont{
color: black;
background: #777;
.student-box{
width:100%;
height:100%;
overflow-x:scroll;
overflow-y:scroll;

.stud-card{
width: 300px;
height: 150px;

}
}
}





.home-view{
.login-modal {
background-color: #dbd9d9;
position: fixed;
top: 50%;
left: 50%;
width: 400px;
height: 200px;
margin-left: -200px;
margin-top: -150px;
padding: 50px;
border-radius: 5px;
z-index: 10;
box-shadow: 0 0 0 99999px rgba(0, 0, 0, 0.7);
}

.in-cont{
background: #777;
.student-box{
.close-modal {
color: #000;
text-decoration: none;
float: right;
position: absolute;
top: 10px;
right: 20px
}

.stud-card{
width: 300px;
height: 150px;

}
}
}
.hdr-hero{
background: url('https://static.pexels.com/photos/2116/money-gold-coins-finance.jpg')center,center, no-repeat;
opacity: .4;
Expand Down