Skip to content

Commit

Permalink
save location update
Browse files Browse the repository at this point in the history
  • Loading branch information
fi0rini committed Feb 18, 2016
1 parent fa69a0b commit 23f3a54
Showing 1 changed file with 38 additions and 40 deletions.
78 changes: 38 additions & 40 deletions src/js/routes/Settings/Location.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { Component } from 'react';
import { Button, ButtonToolbar } from 'react-bootstrap';
import HeaderBackNavigation from '../../components/Navigation/HeaderBackNavigation';
import VoterStore from '../../stores/VoterStore';
import React, { Component } from "react";
import { Button, ButtonToolbar } from "react-bootstrap";
import HeaderBackNavigation from "../../components/Navigation/HeaderBackNavigation";
import VoterStore from "../../stores/VoterStore";

export default class Location extends Component {
constructor(props) {
constructor (props) {
super(props);
this.state = {}
this.state = {};
}

componentDidMount() {
VoterStore.getLocation( location => {
componentDidMount () {
VoterStore.getLocation( (err, location) => {
this.setState({ location });
})
});
}

updateLocation (e) {
Expand All @@ -21,49 +21,47 @@ export default class Location extends Component {
});
}

saveLocation (e) {
saveLocation () {
var { location } = this.state;
VoterStore.saveLocation ( location, (err, location) => {
VoterStore.saveLocation( location, (err) => {
if (err) return console.error(err);

window.location.href="/ballot"
window.location.href = "/ballot";

});
}

render() {
render () {
var { location } = this.state;

return (
<div>
<div className="container-fluid well well-90">
<h2 className="text-center">
Change Location
</h2>
<div>
<span className="small">
Please enter the address (or just the city) where you registered to
vote. The more location information you can provide, the more ballot information will
be visible.
</span>
return <div>
<div className="container-fluid well well-90">
<h2 className="text-center">
Change Location
</h2>
<div>
<span className="small">
Please enter the address (or just the city) where you registered to
vote. The more location information you can provide, the more ballot information will
be visible.
</span>

<input
type="text"
onChange={this.updateLocation.bind(this)}
name="address"
value={location}
className="form-control"
defaultValue="Oakland, CA" />
<input
type="text"
onChange={this.updateLocation.bind(this)}
name="address"
value={location}
className="form-control"
defaultValue="Oakland, CA" />

<ButtonToolbar>
<Button
onClick={this.saveLocation.bind(this)}
bsStyle="primary">Save Location</Button>
<ButtonToolbar>
<Button
onClick={this.saveLocation.bind(this)}
bsStyle="primary">Save Location</Button>

</ButtonToolbar>
</div>
</div>
</ButtonToolbar>
</div>
</div>
);
</div>;
}
}

0 comments on commit 23f3a54

Please # to comment.