Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/pods/components/question-editor/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export default Component.extend({

this.get('question.choices').addObject(newChoice)
},
setSelection: function(selected) {
this.get('question').set('difficulty', selected)
},
saveQuestion () {
const onSuccess = () => this.get('notify').success('Saved Successfully')

Expand Down
17 changes: 16 additions & 1 deletion app/pods/components/question-editor/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,22 @@
</div>
</div>


<div class="row align-items-center">
<div class="col-2">
<label>Question Difficulty:</label>
</div>
{{#if true }}
<div class="col-5 input-group">
<div class="form-group filterDropDown">
<select onchange={{action "setSelection" value="target.value"}} class="col-12" >
{{#each difficultyLevels as |item|}}
<option value="{{item}}" selected={{if (eq question.difficulty item) 'true'}}>{{item}}</option>
{{/each}}
</select>
</div>
</div>
{{/if}}
</div>

{{#unless question.isNew}}

Expand Down
1 change: 1 addition & 0 deletions app/pods/questions/id/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export default Route.extend({
setupController (controller, model) {
controller.set("question", model.question)
controller.set("correctChoices", model.answers.correctAnswers)
controller.set("difficultyLevels", ['EASY' , 'MEDIUM', 'HARD'])
}
});
2 changes: 1 addition & 1 deletion app/pods/questions/id/template.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{question-editor question=question correctChoices=correctChoices}}
{{question-editor question=question correctChoices=correctChoices difficultyLevels=difficultyLevels}}
1 change: 1 addition & 0 deletions app/pods/questions/new/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default Route.extend({
},
setupController (controller, model) {
controller.set("question", model)
controller.set("difficultyLevels", ['EASY' , 'MEDIUM', 'HARD'])
}
});
2 changes: 1 addition & 1 deletion app/pods/questions/new/template.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{question-editor question=question onSave=(action 'saveCourse')}}
{{question-editor question=question onSave=(action 'saveCourse') difficultyLevels=difficultyLevels}}