Skip to content

Commit

Permalink
fix(qna): linked label to checkbox and added null check
Browse files Browse the repository at this point in the history
  • Loading branch information
allardy committed Nov 21, 2018
1 parent c8dd33e commit 8f0f727
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions modules/qna/src/views/FormModal.jsx
Expand Up @@ -201,8 +201,13 @@ export default class FormModal extends Component {
<span className={style.qnaReplyTitle}>Reply with:</span>
<div className={style.qnaAnswer}>
<span className={style.qnaAnswerCheck}>
<input type="checkbox" checked={this.state.isText} onChange={this.changeItemAction('isText')} />
&nbsp; Type your answer
<input
id="reply"
type="checkbox"
checked={this.state.isText}
onChange={this.changeItemAction('isText')}
/>
<label htmlFor="reply">&nbsp; Type your answer</label>
</span>
<FormControl
className={classnames(style.qnaAnswerTextarea, {
Expand All @@ -222,12 +227,13 @@ export default class FormModal extends Component {
<div className={style.qnaRedirectToFlow}>
<span className={style.qnaRedirectToFlowCheck}>
<input
id="redirect"
type="checkbox"
checked={this.state.isRedirect}
onChange={this.changeItemAction('isRedirect')}
className={style.qnaRedirectToFlowCheckCheckbox}
/>
&nbsp;Redirect to flow
<label htmlFor="redirect">&nbsp;Redirect to flow</label>
</span>
<Select
className={classnames(style.qnaRedirectToFlowCheckSelect, {
Expand Down
9 changes: 5 additions & 4 deletions modules/qna/src/views/index.jsx
Expand Up @@ -79,9 +79,10 @@ export default class QnaAdmin extends Component {

fetchCategories() {
this.props.bp.axios.get('/mod/qna/categories').then(({ data: { categories } }) => {
const categoryOptions = categories.map(category => ({ label: category, value: category }))

this.setState({ categoryOptions })
if (categories) {
const categoryOptions = categories.map(category => ({ label: category, value: category }))
this.setState({ categoryOptions })
}
})
}

Expand Down Expand Up @@ -310,7 +311,7 @@ export default class QnaAdmin extends Component {
const isRedirect = item.redirectFlow && item.redirectNode

return (
<Well className={style.qnaItem} bsSize="small">
<Well className={style.qnaItem} bsSize="small" key={id}>
<div className={style.itemContainer}>
<div className={style.itemQuestions}>
<span className={style.itemQuestionsTitle}>Q: </span>
Expand Down

0 comments on commit 8f0f727

Please sign in to comment.