equal
deleted
inserted
replaced
19 title: title, |
19 title: title, |
20 description: description |
20 description: description |
21 }); |
21 }); |
22 } |
22 } |
23 |
23 |
|
24 componentDidMount = () => { |
|
25 this.props.notesActions.loadNotesBySession({ _id: this.props.match.params.id }); |
|
26 } |
|
27 |
24 render() { |
28 render() { |
25 return ( |
29 return ( |
26 <div> |
30 <div> |
27 <Navbar history={this.props.history} /> |
31 <Navbar history={this.props.history} /> |
28 <Grid fluid> |
32 <Grid fluid> |
32 <form> |
36 <form> |
33 <FormGroup> |
37 <FormGroup> |
34 <ControlLabel>Title</ControlLabel> |
38 <ControlLabel>Title</ControlLabel> |
35 <FormControl |
39 <FormControl |
36 type="text" |
40 type="text" |
37 defaultValue={this.props.currentSession.title} |
41 defaultValue={this.props.currentSession ? this.props.currentSession.title : ''} |
38 placeholder="Enter a title for this session" |
42 placeholder="Enter a title for this session" |
39 inputRef={ref => { this.title = ref; }} |
43 inputRef={ref => { this.title = ref; }} |
40 /> |
44 /> |
41 </FormGroup> |
45 </FormGroup> |
42 <FormGroup> |
46 <FormGroup> |
43 <ControlLabel>Description</ControlLabel> |
47 <ControlLabel>Description</ControlLabel> |
44 <FormControl |
48 <FormControl |
45 componentClass="textarea" |
49 componentClass="textarea" |
46 defaultValue={this.props.currentSession.description} |
50 defaultValue={this.props.currentSession ? this.props.currentSession.description : ''} |
47 placeholder="Enter a description for this session" |
51 placeholder="Enter a description for this session" |
48 inputRef={ref => { this.description = ref; }} |
52 inputRef={ref => { this.description = ref; }} |
49 /> |
53 /> |
50 </FormGroup> |
54 </FormGroup> |
51 <Button bsStyle="primary" onClick={this.saveSession}>Save session</Button> |
55 <Button bsStyle="primary" onClick={this.saveSession}>Save session</Button> |
68 |
72 |
69 const sessionId = props.match.params.id; |
73 const sessionId = props.match.params.id; |
70 |
74 |
71 const sessions = state.get('sessions'); |
75 const sessions = state.get('sessions'); |
72 const notes = state.get('notes'); |
76 const notes = state.get('notes'); |
73 |
77 const currentSession = sessions.find(session => session._id === sessionId); |
74 const currentSession = sessions.find(session => session.id === sessionId); |
|
75 const notesBySession = notes.filter(note => note.session === sessionId); |
|
76 |
78 |
77 return { |
79 return { |
78 currentSession: currentSession, |
80 currentSession: currentSession, |
79 sessions: sessions, |
81 sessions: sessions, |
80 notes: notesBySession |
82 notes: notes |
81 }; |
83 }; |
82 } |
84 } |
83 |
85 |
84 function mapDispatchToProps(dispatch) { |
86 function mapDispatchToProps(dispatch) { |
85 return { |
87 return { |