Skip to content

Commit 6eaab5a

Browse files
authored
Merge pull request #14 from bhavyaagg/fix-placeholder-issue
Fix placeholder issue
2 parents 97f3f11 + 85304a9 commit 6eaab5a

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

app/pods/components/choice-editor/component.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import { inject as service } from '@ember/service';
88
export default Component.extend({
99
notify: service(),
1010
isEditing: false,
11+
init () {
12+
this._super(...arguments)
13+
this.set('isEditing', !!this.get('choice.isNew'))
14+
},
1115
actions: {
1216
toggleEditing () {
1317
this.toggleProperty('isEditing')

app/pods/components/choice-editor/template.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<label>Choice Title:</label>
77
</div>
88
<div class="col-5 input-group">
9-
<h3> {{input type="text" class="input-text" value=choice.title}} </h3>
9+
<h3> {{input type="text" class="input-text" placeholder="*New Choice, EDIT ME" value=choice.title}} </h3>
1010
</div>
1111
<div class="col-5">
1212
{{markdown-to-html choice.title extensions='katex'}}
@@ -18,7 +18,7 @@
1818
</div>
1919
<div class="col-5 input-group">
2020
<p>
21-
{{textarea type="text" class="input-text py-4" value=choice.description}}
21+
{{textarea type="text" class="input-text py-4" placeholder="EDIT ME" value=choice.description}}
2222
</p>
2323
</div>
2424
<div class="col-5">

app/pods/components/question-editor/component.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ export default Component.extend({
1111
this.toggleProperty('isEditing')
1212
},
1313
addChoice () {
14-
const newChoice = this.get('store').createRecord('choice', {
15-
title: '*New Choice, EDIT ME',
16-
description: 'EDIT ME'
17-
})
14+
const newChoice = this.get('store').createRecord('choice', {})
1815
newChoice.set('question', this.get('question'))
1916

2017
this.get('question.choices').addObject(newChoice)

app/pods/components/question-editor/template.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
choice=choice
4545
isCorrect=(includes correctChoices choice.id)
4646
onFlagChange=(action 'markChoice')
47+
isNew=true
4748
}}
4849
</li>
4950
{{/each}}

app/pods/questions/new/route.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import { inject as service } from '@ember/service'
44
export default Route.extend({
55
currentUser: service(),
66
model () {
7-
return this.store.createRecord('question', {
8-
title: '',
9-
description: '',
10-
user: this.get('currentUser.user')
11-
})
7+
const newQuestion = this.store.createRecord('question', {})
8+
newQuestion.set('user', this.get('currentUser.user'))
9+
return newQuestion
1210
},
1311
setupController (controller, model) {
1412
controller.set("question", model)

0 commit comments

Comments
 (0)