client/src/components/SessionForm.js
changeset 106 fffefefed507
parent 101 e165aa89ac82
child 108 732adc46c8b8
equal deleted inserted replaced
105:0a1d6560acac 106:fffefefed507
   124           <FormGroup>
   124           <FormGroup>
   125             <ControlLabel>Group</ControlLabel>
   125             <ControlLabel>Group</ControlLabel>
   126             <FormControl
   126             <FormControl
   127               name="group"
   127               name="group"
   128               componentClass="select"
   128               componentClass="select"
   129               value={ this.props.group.id }
   129               value={ this.props.group ? this.props.group.id : '' }
   130               onChange={ this.onGroupChange }
   130               onChange={ this.onGroupChange }
   131               inputRef={ ref => { this.group = ref; } }>
   131               inputRef={ ref => { this.group = ref; } }>
   132               <option />
   132               <option />
   133               { this.props.groups.map((group, key) =>
   133               { this.props.groups.map((group, key) =>
   134                 <option key={ key } value={ group.id }>{ group.name }</option>
   134                 <option key={ key } value={ group.id }>{ group.name }</option>
   145 }
   145 }
   146 
   146 
   147 function mapStateToProps(state, props) {
   147 function mapStateToProps(state, props) {
   148 
   148 
   149   let group;
   149   let group;
   150   if (props.session) {
   150   if (props.session && props.session.group) {
   151     group = state.groups.find(group => props.session.group.get('id') === group.id)
   151     group = state.groups.find(group => props.session.group.get('id') === group.id)
   152   }
   152   }
   153 
   153 
   154   return {
   154   return {
   155     currentSession: props.session,
   155     currentSession: props.session,