Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ export class DeploymentTab extends React.Component<

const globals = deployment.globals.map((symbol, i) => (
<tr key={i}>
<td className="col-xs-3" style={{ height: '2rem', width: '10rem', overflow: 'auto' }}>
<div style={{ height: '2rem', width: '10rem', overflow: 'auto' }}>
<td className="col-xs-3" style={{ width: '10rem' }}>
<div style={{ width: '10rem' }}>
{this.textareaContent(deploymentPath.concat(['globals', i, 0]))}
</div>
</td>
<td className="col-xs-7" style={{ height: '2rem', width: '20rem', overflow: 'auto' }}>
<div style={{ height: '2rem', width: '20rem', overflow: 'auto' }}>
{this.globalValueTextareaContent(i)}
</div>
<td className="col-xs-7" style={{ width: '20rem' }}>
<div style={{ width: '20rem' }}>{this.globalValueTextareaContent(i)}</div>
</td>
<td className="col-xs-2">
{controlButton('Delete', IconNames.MINUS, this.handleGlobalDelete(i))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export class ManageQuestionTab extends React.Component<IProps, IState> {
private manageQuestionTab = () => {
return (
<div>
{controlButton(
'Clone Current Question',
IconNames.DOCUMENT,
this.confirmSave(
this.makeQuestion(() => this.props.assessment.questions[this.props.questionId])
)
)}
<br />
{controlButton(
'Insert Programming Question',
IconNames.FONT,
Expand All @@ -50,15 +58,43 @@ export class ManageQuestionTab extends React.Component<IProps, IState> {
IconNames.CONFIRM,
this.confirmSave(this.makeQuestion(mcqTemplate))
)}
<br />
{controlButton(
'Delete Current Question',
IconNames.REMOVE,
this.confirmSave(this.deleteQn)
this.confirmSave(this.deleteQuestion)
)}
<br />
{controlButton(
'Shift Question Left',
IconNames.CARET_LEFT,
this.confirmSave(() => this.shiftQuestion(-1))
)}
{controlButton(
'Shift Question Right',
IconNames.CARET_RIGHT,
this.confirmSave(() => this.shiftQuestion(1))
)}
</div>
);
};

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;
Expand All @@ -71,7 +107,7 @@ export class ManageQuestionTab extends React.Component<IProps, IState> {
this.props.updateAssessment(assessment);
};

private deleteQn = () => {
private deleteQuestion = () => {
const assessment = this.props.assessment;
let questions = assessment.questions;
const index = this.props.questionId;
Expand Down