File tree Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ import { inject as service } from '@ember/service';
88export 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' )
Original file line number Diff line number Diff line change 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' }}
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" >
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 4444 choice =choice
4545 isCorrect = (includes correctChoices choice.id )
4646 onFlagChange = (action ' markChoice' )
47+ isNew =true
4748 }}
4849 </li >
4950 {{ /each }}
Original file line number Diff line number Diff line change @@ -4,11 +4,9 @@ import { inject as service } from '@ember/service'
44export 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 )
You can’t perform that action at this time.
0 commit comments