diff --git a/src/components/incubator/editingWorkspaceSideContent/DeploymentTab.tsx b/src/components/incubator/editingWorkspaceSideContent/DeploymentTab.tsx index ee51e6c447..18d25082f3 100644 --- a/src/components/incubator/editingWorkspaceSideContent/DeploymentTab.tsx +++ b/src/components/incubator/editingWorkspaceSideContent/DeploymentTab.tsx @@ -75,15 +75,13 @@ export class DeploymentTab extends React.Component< const globals = deployment.globals.map((symbol, i) => ( - -
+ +
{this.textareaContent(deploymentPath.concat(['globals', i, 0]))}
- -
- {this.globalValueTextareaContent(i)} -
+ +
{this.globalValueTextareaContent(i)}
{controlButton('Delete', IconNames.MINUS, this.handleGlobalDelete(i))} diff --git a/src/components/incubator/editingWorkspaceSideContent/ManageQuestionTab.tsx b/src/components/incubator/editingWorkspaceSideContent/ManageQuestionTab.tsx index fb41a04f26..7036d48951 100644 --- a/src/components/incubator/editingWorkspaceSideContent/ManageQuestionTab.tsx +++ b/src/components/incubator/editingWorkspaceSideContent/ManageQuestionTab.tsx @@ -40,6 +40,14 @@ export class ManageQuestionTab extends React.Component { private manageQuestionTab = () => { return (
+ {controlButton( + 'Clone Current Question', + IconNames.DOCUMENT, + this.confirmSave( + this.makeQuestion(() => this.props.assessment.questions[this.props.questionId]) + ) + )} +
{controlButton( 'Insert Programming Question', IconNames.FONT, @@ -50,15 +58,43 @@ export class ManageQuestionTab extends React.Component { IconNames.CONFIRM, this.confirmSave(this.makeQuestion(mcqTemplate)) )} +
{controlButton( 'Delete Current Question', IconNames.REMOVE, - this.confirmSave(this.deleteQn) + this.confirmSave(this.deleteQuestion) + )} +
+ {controlButton( + 'Shift Question Left', + IconNames.CARET_LEFT, + this.confirmSave(() => this.shiftQuestion(-1)) + )} + {controlButton( + 'Shift Question Right', + IconNames.CARET_RIGHT, + this.confirmSave(() => this.shiftQuestion(1)) )}
); }; + private shiftQuestion = (dir: number) => { + const assessment = this.props.assessment; + const index = this.props.questionId; + const question = assessment.questions[index]; + let questions = assessment.questions; + questions = questions.slice(0, index).concat(questions.slice(index + 1)); + questions = questions + .slice(0, index + dir) + .concat([question]) + .concat(questions.slice(index + dir)); + assessment.questions = questions; + // tslint:disable-next-line:no-console + console.log(questions); + this.props.updateAssessment(assessment); + }; + private makeQuestion = (template: () => any) => () => { const assessment = this.props.assessment; const index = this.props.questionId; @@ -71,7 +107,7 @@ export class ManageQuestionTab extends React.Component { this.props.updateAssessment(assessment); }; - private deleteQn = () => { + private deleteQuestion = () => { const assessment = this.props.assessment; let questions = assessment.questions; const index = this.props.questionId;