File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
app/pods/components/question-editor Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { inject as service } from '@ember/service';
33import { task , timeout } from 'ember-concurrency' ;
44
55export default Component . extend ( {
6+ currentUser : service ( ) ,
67 store : service ( ) ,
78 api : service ( ) ,
89 notify : service ( ) ,
@@ -60,8 +61,18 @@ export default Component.extend({
6061 } ) . then ( ( ) => {
6162 this . set ( 'correctChoices' , [ ...correctChoices ] )
6263 } )
63-
64+ } ,
65+ createNewTag ( ) {
66+ const onSuccess = ( ) => this . get ( 'notify' ) . success ( 'New Tag Created' )
67+
68+ let newTag = this . store . createRecord ( 'tag' , {
69+ title : this . get ( 'tagTitle' ) ,
70+ } )
6471
72+ newTag . set ( 'user' , this . get ( 'currentUser.user' ) )
73+ console . log ( newTag . user )
74+ newTag . save ( )
75+ . then ( onSuccess )
6576 }
6677 }
6778} ) ;
Original file line number Diff line number Diff line change 6565 {{ /power-select-multiple }}
6666 </div >
6767 </div >
68-
68+ <div class =" row" ></div >
69+ <div class =" row justify-content-center align-items-center" >
70+ <div class =" col-2" >
71+ <label >Create New Tag: </label >
72+ </div >
73+ <div class =" col-5 input-group" >
74+ {{ input type =" text" class =" input-text" placeholder =" Enter Tag's Title" value =tagTitle }}
75+ </div >
76+ <div class =" col-5" >
77+ <span {{ action ' createNewTag' }} >
78+ Save
79+ <i class =" far fa-save" ></i >
80+ </span ></div >
81+ </div >
6982 Created By: <mark >{{ question.user.firstname }} </mark >
7083
7184 {{ /unless }}
You can’t perform that action at this time.
0 commit comments