Skip to content

Mission editing slang #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c4fe884
Removed previous button on first question, added divider
ZiHawkEye Mar 24, 2019
15d8749
Yarn format
ZiHawkEye Mar 24, 2019
079b843
Changeded help description
ZiHawkEye Mar 24, 2019
4b074f9
Merge pull request #12 from source-academy/mission-editing
gerhean Mar 24, 2019
f09f97c
fix import for firefox
gerhean Mar 24, 2019
0547d1f
max width for globals
ZiHawkEye Mar 24, 2019
eeeac40
merge
ZiHawkEye Mar 24, 2019
19044bb
symbols aligned
ZiHawkEye Mar 24, 2019
0cf76f4
increase abstraction
gerhean Mar 24, 2019
a254845
Merge pull request #13 from source-academy/mission-editing
gerhean Mar 24, 2019
01ffb72
manage questions give warning
gerhean Mar 24, 2019
22b7d80
Merge branch 'missionEditing-slang' of https://github.com/gerhean/cad…
gerhean Mar 24, 2019
1138294
UI change for deployment tab
ZiHawkEye Mar 24, 2019
03bdaa9
merge changes
gerhean Mar 24, 2019
de9f70a
Merge pull request #15 from source-academy/mission-editing
gerhean Mar 24, 2019
fb1353d
fixed maxGrade and maxXP calculation
gerhean Mar 24, 2019
6a173f2
added local/global switch
gerhean Mar 25, 2019
a7ee16c
adjust mcq options
gerhean Mar 25, 2019
60a7f64
split question template tab
gerhean Mar 25, 2019
c1cb2a7
swap answer and solutionTemplate
gerhean Mar 25, 2019
7460f3c
add reading
gerhean Mar 25, 2019
6ffe9cb
add grading deployment
gerhean Mar 25, 2019
a0f1237
Merge pull request #16 from source-academy/mission-editing
gerhean Mar 25, 2019
05dd14a
clone question shift question added
ZiHawkEye Mar 25, 2019
8aeb9ba
Merge branch 'missionEditing-slang' of https://github.com/gerhean/cad…
ZiHawkEye Mar 25, 2019
ab2976d
Merge pull request #17 from ZiHawkEye/mission-editing
gerhean Mar 25, 2019
9dce47b
fixed symbol formating
gerhean Mar 25, 2019
c45734c
Merge branch 'missionEditing-slang' of https://github.com/gerhean/cad…
ZiHawkEye Mar 26, 2019
de75912
changed manage questions ui
ZiHawkEye Mar 26, 2019
74dbeda
yarn format
ZiHawkEye Mar 26, 2019
ffde4ee
added more overview options
gerhean Mar 26, 2019
47e7da6
add editing persist
gerhean Mar 26, 2019
32bfb6a
Merge pull request #18 from ZiHawkEye/mission-editing
gerhean Mar 27, 2019
695eb8b
Update ManageQuestionTab.tsx
gerhean Mar 27, 2019
1fe386c
Merge branch 'mission-editing' into missionEditing-slang
gerhean Mar 27, 2019
1fcf63f
Merge pull request #19 from source-academy/mission-editing
gerhean Mar 27, 2019
c5e1344
small updates
gerhean Mar 31, 2019
4aa49ee
temp remove editor functionalites
gerhean Apr 2, 2019
b52dd08
yarn format
gerhean Apr 2, 2019
e8f2c35
remove edit persist
gerhean Apr 9, 2019
e04a436
Merge branch 'mission-editing' into missionEditing-slang
gerhean Apr 9, 2019
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
37 changes: 12 additions & 25 deletions src/components/incubator/EditingWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ interface IState {
assessment: IAssessment | null;
activeTab: number;
editingMode: string;
editorPersist: boolean;
hasUnsavedChanges: boolean;
showResetOverlay: boolean;
originalMaxGrade: number;
Expand All @@ -95,7 +94,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
assessment: retrieveLocalAssessment(),
activeTab: 0,
editingMode: 'question',
editorPersist: false,
hasUnsavedChanges: false,
showResetOverlay: false,
originalMaxGrade: 0,
Expand Down Expand Up @@ -222,7 +220,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
originalMaxXp: this.getMaxMarks('maxXp')
});
this.handleRefreshLibrary();
this.resetEditorValue();
},
{ minimal: false, intent: Intent.DANGER }
)}
Expand All @@ -249,7 +246,7 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
this.props.storedAssessmentId !== assessmentId ||
this.props.storedQuestionId !== questionId
) {
this.resetEditorValue(false);
this.resetEditorValue();
this.props.handleUpdateCurrentAssessmentId(assessmentId, questionId);
this.props.handleUpdateHasUnsavedChanges(false);
if (this.state.hasUnsavedChanges) {
Expand Down Expand Up @@ -284,22 +281,20 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
this.props.handleClearContext(library);
};

private resetEditorValue = (checkPersist: boolean = true) => {
if (checkPersist || !this.state.editorPersist) {
const question: IQuestion = this.state.assessment!.questions[this.formatedQuestionId()];
let editorValue: string;
if (question.type === QuestionTypes.programming) {
if (question.editorValue) {
editorValue = question.editorValue;
} else {
editorValue = (question as IProgrammingQuestion).solutionTemplate as string;
}
private resetEditorValue = () => {
const question: IQuestion = this.state.assessment!.questions[this.formatedQuestionId()];
let editorValue: string;
if (question.type === QuestionTypes.programming) {
if (question.editorValue) {
editorValue = question.editorValue;
} else {
editorValue = '//If you see this, this is a bug. Please report bug.';
editorValue = (question as IProgrammingQuestion).solutionTemplate as string;
}
this.props.handleResetWorkspace({ editorValue });
this.props.handleEditorValueChange(editorValue);
} else {
editorValue = '//If you see this, this is a bug. Please report bug.';
}
this.props.handleResetWorkspace({ editorValue });
this.props.handleEditorValueChange(editorValue);
};

private handleSave = () => {
Expand Down Expand Up @@ -374,12 +369,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
});
};

// private toggleEditorPersist = () => {
// this.setState({
// editorPersist: !this.state.editorPersist
// });
// };

/** Pre-condition: IAssessment has been loaded */
private sideContentProps: (p: AssessmentWorkspaceProps, q: number) => SideContentProps = (
props: AssessmentWorkspaceProps,
Expand Down Expand Up @@ -565,8 +554,6 @@ class AssessmentWorkspace extends React.Component<AssessmentWorkspaceProps, ISta
sourceChapter: this.state.assessment!.questions[questionId].library.chapter,
editingMode: this.state.editingMode,
toggleEditMode: this.toggleEditingMode
// isEditorPersist: this.state.editorPersist,
// handleToggleEditorPersist: this.toggleEditorPersist
};
};
}
Expand Down
11 changes: 0 additions & 11 deletions src/components/workspace/ControlBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ export type ControlBarProps = {
handleReplEval: () => void;
handleReplOutputClear: () => void;
handleToggleEditorAutorun?: () => void;
handleToggleEditorPersist?: () => void;
hasChapterSelect: boolean;
hasEditorAutorunButton: boolean;
hasSaveButton: boolean;
hasShareButton: boolean;
hasUnsavedChanges?: boolean;
isEditorPersist?: boolean;
isEditorAutorun?: boolean;
isRunning: boolean;
editingMode?: string;
Expand Down Expand Up @@ -146,22 +144,13 @@ class ControlBar extends React.PureComponent<ControlBarProps, {}> {
this.props.onClickReset !== null
? controlButton('Reset', IconNames.REPEAT, this.props.onClickReset)
: undefined;
const editorPersistSwitch =
this.props.handleToggleEditorPersist !== undefined
? controlButton(
'Editor Persistence ' + (this.props.isEditorPersist ? 'Enabled' : 'Disabled'),
this.props.isEditorPersist ? IconNames.TICK : IconNames.CROSS,
this.props.handleToggleEditorPersist
)
: undefined;
return (
<div className="ControlBar_editor pt-button-group">
{this.props.isEditorAutorun ? undefined : this.props.isRunning ? stopButton : runButton}
{saveButton}
{shareButton} {chapterSelectButton} {externalSelectButton}
{this.props.isEditorAutorun ? stopAutorunButton : startAutorunButton}
{resetButton}
{editorPersistSwitch}
</div>
);
}
Expand Down