@@ -40,6 +40,14 @@ export class ManageQuestionTab extends React.Component<IProps, IState> {
4040  private  manageQuestionTab  =  ( )  =>  { 
4141    return  ( 
4242      < div > 
43+         { controlButton ( 
44+           'Clone Current Question' , 
45+           IconNames . DOCUMENT , 
46+           this . confirmSave ( 
47+             this . makeQuestion ( ( )  =>  this . props . assessment . questions [ this . props . questionId ] ) 
48+           ) 
49+         ) } 
50+         < br  /> 
4351        { controlButton ( 
4452          'Insert Programming Question' , 
4553          IconNames . FONT , 
@@ -50,15 +58,43 @@ export class ManageQuestionTab extends React.Component<IProps, IState> {
5058          IconNames . CONFIRM , 
5159          this . confirmSave ( this . makeQuestion ( mcqTemplate ) ) 
5260        ) } 
61+         < br  /> 
5362        { controlButton ( 
5463          'Delete Current Question' , 
5564          IconNames . REMOVE , 
56-           this . confirmSave ( this . deleteQn ) 
65+           this . confirmSave ( this . deleteQuestion ) 
66+         ) } 
67+         < br  /> 
68+         { controlButton ( 
69+           'Shift Question Left' , 
70+           IconNames . CARET_LEFT , 
71+           this . confirmSave ( ( )  =>  this . shiftQuestion ( - 1 ) ) 
72+         ) } 
73+         { controlButton ( 
74+           'Shift Question Right' , 
75+           IconNames . CARET_RIGHT , 
76+           this . confirmSave ( ( )  =>  this . shiftQuestion ( 1 ) ) 
5777        ) } 
5878      </ div > 
5979    ) ; 
6080  } ; 
6181
82+   private  shiftQuestion  =  ( dir : number )  =>  { 
83+     const  assessment  =  this . props . assessment ; 
84+     const  index  =  this . props . questionId ; 
85+     const  question  =  assessment . questions [ index ] ; 
86+     let  questions  =  assessment . questions ; 
87+     questions  =  questions . slice ( 0 ,  index ) . concat ( questions . slice ( index  +  1 ) ) ; 
88+     questions  =  questions 
89+       . slice ( 0 ,  index  +  dir ) 
90+       . concat ( [ question ] ) 
91+       . concat ( questions . slice ( index  +  dir ) ) ; 
92+     assessment . questions  =  questions ; 
93+     // tslint:disable-next-line:no-console 
94+     console . log ( questions ) ; 
95+     this . props . updateAssessment ( assessment ) ; 
96+   } ; 
97+ 
6298  private  makeQuestion  =  ( template : ( )  =>  any )  =>  ( )  =>  { 
6399    const  assessment  =  this . props . assessment ; 
64100    const  index  =  this . props . questionId ; 
@@ -71,7 +107,7 @@ export class ManageQuestionTab extends React.Component<IProps, IState> {
71107    this . props . updateAssessment ( assessment ) ; 
72108  } ; 
73109
74-   private  deleteQn  =  ( )  =>  { 
110+   private  deleteQuestion  =  ( )  =>  { 
75111    const  assessment  =  this . props . assessment ; 
76112    let  questions  =  assessment . questions ; 
77113    const  index  =  this . props . questionId ; 
0 commit comments