diff --git a/app/pods/components/choice-editor/component.js b/app/pods/components/choice-editor/component.js index 0ac3c46..2c234b5 100644 --- a/app/pods/components/choice-editor/component.js +++ b/app/pods/components/choice-editor/component.js @@ -8,6 +8,10 @@ import { inject as service } from '@ember/service'; export default Component.extend({ notify: service(), isEditing: false, + init () { + this._super(...arguments) + this.set('isEditing', !!this.get('choice.isNew')) + }, actions: { toggleEditing () { this.toggleProperty('isEditing') diff --git a/app/pods/components/choice-editor/template.hbs b/app/pods/components/choice-editor/template.hbs index d8c4155..2d683c6 100644 --- a/app/pods/components/choice-editor/template.hbs +++ b/app/pods/components/choice-editor/template.hbs @@ -6,7 +6,7 @@
-

{{input type="text" class="input-text" value=choice.title}}

+

{{input type="text" class="input-text" placeholder="*New Choice, EDIT ME" value=choice.title}}

{{markdown-to-html choice.title extensions='katex'}} @@ -18,7 +18,7 @@

- {{textarea type="text" class="input-text py-4" value=choice.description}} + {{textarea type="text" class="input-text py-4" placeholder="EDIT ME" value=choice.description}}

diff --git a/app/pods/components/question-editor/component.js b/app/pods/components/question-editor/component.js index 1231733..40e2ea5 100644 --- a/app/pods/components/question-editor/component.js +++ b/app/pods/components/question-editor/component.js @@ -11,10 +11,7 @@ export default Component.extend({ this.toggleProperty('isEditing') }, addChoice () { - const newChoice = this.get('store').createRecord('choice', { - title: '*New Choice, EDIT ME', - description: 'EDIT ME' - }) + const newChoice = this.get('store').createRecord('choice', {}) newChoice.set('question', this.get('question')) this.get('question.choices').addObject(newChoice) diff --git a/app/pods/components/question-editor/template.hbs b/app/pods/components/question-editor/template.hbs index 0fda8e3..965917a 100644 --- a/app/pods/components/question-editor/template.hbs +++ b/app/pods/components/question-editor/template.hbs @@ -44,6 +44,7 @@ choice=choice isCorrect=(includes correctChoices choice.id) onFlagChange=(action 'markChoice') + isNew=true }} {{/each}} diff --git a/app/pods/questions/new/route.js b/app/pods/questions/new/route.js index a13ef21..beb3c8d 100644 --- a/app/pods/questions/new/route.js +++ b/app/pods/questions/new/route.js @@ -4,11 +4,9 @@ import { inject as service } from '@ember/service' export default Route.extend({ currentUser: service(), model () { - return this.store.createRecord('question', { - title: '', - description: '', - user: this.get('currentUser.user') - }) + const newQuestion = this.store.createRecord('question', {}) + newQuestion.set('user', this.get('currentUser.user')) + return newQuestion }, setupController (controller, model) { controller.set("question", model)