Skip to content

Commit 23f3a54

Browse files
committedFeb 18, 2016
save location update
1 parent fa69a0b commit 23f3a54

File tree

1 file changed

+38
-40
lines changed

1 file changed

+38
-40
lines changed
 

‎src/js/routes/Settings/Location.jsx

+38-40
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import React, { Component } from 'react';
2-
import { Button, ButtonToolbar } from 'react-bootstrap';
3-
import HeaderBackNavigation from '../../components/Navigation/HeaderBackNavigation';
4-
import VoterStore from '../../stores/VoterStore';
1+
import React, { Component } from "react";
2+
import { Button, ButtonToolbar } from "react-bootstrap";
3+
import HeaderBackNavigation from "../../components/Navigation/HeaderBackNavigation";
4+
import VoterStore from "../../stores/VoterStore";
55

66
export default class Location extends Component {
7-
constructor(props) {
7+
constructor (props) {
88
super(props);
9-
this.state = {}
9+
this.state = {};
1010
}
1111

12-
componentDidMount() {
13-
VoterStore.getLocation( location => {
12+
componentDidMount () {
13+
VoterStore.getLocation( (err, location) => {
1414
this.setState({ location });
15-
})
15+
});
1616
}
1717

1818
updateLocation (e) {
@@ -21,49 +21,47 @@ export default class Location extends Component {
2121
});
2222
}
2323

24-
saveLocation (e) {
24+
saveLocation () {
2525
var { location } = this.state;
26-
VoterStore.saveLocation ( location, (err, location) => {
26+
VoterStore.saveLocation( location, (err) => {
2727
if (err) return console.error(err);
2828

29-
window.location.href="/ballot"
29+
window.location.href = "/ballot";
3030

3131
});
3232
}
3333

34-
render() {
34+
render () {
3535
var { location } = this.state;
3636

37-
return (
38-
<div>
39-
<div className="container-fluid well well-90">
40-
<h2 className="text-center">
41-
Change Location
42-
</h2>
43-
<div>
44-
<span className="small">
45-
Please enter the address (or just the city) where you registered to
46-
vote. The more location information you can provide, the more ballot information will
47-
be visible.
48-
</span>
37+
return <div>
38+
<div className="container-fluid well well-90">
39+
<h2 className="text-center">
40+
Change Location
41+
</h2>
42+
<div>
43+
<span className="small">
44+
Please enter the address (or just the city) where you registered to
45+
vote. The more location information you can provide, the more ballot information will
46+
be visible.
47+
</span>
4948

50-
<input
51-
type="text"
52-
onChange={this.updateLocation.bind(this)}
53-
name="address"
54-
value={location}
55-
className="form-control"
56-
defaultValue="Oakland, CA" />
49+
<input
50+
type="text"
51+
onChange={this.updateLocation.bind(this)}
52+
name="address"
53+
value={location}
54+
className="form-control"
55+
defaultValue="Oakland, CA" />
5756

58-
<ButtonToolbar>
59-
<Button
60-
onClick={this.saveLocation.bind(this)}
61-
bsStyle="primary">Save Location</Button>
57+
<ButtonToolbar>
58+
<Button
59+
onClick={this.saveLocation.bind(this)}
60+
bsStyle="primary">Save Location</Button>
6261

63-
</ButtonToolbar>
64-
</div>
65-
</div>
62+
</ButtonToolbar>
63+
</div>
6664
</div>
67-
);
65+
</div>;
6866
}
6967
}

0 commit comments

Comments
 (0)
Please sign in to comment.