Skip to content
Snippets Groups Projects
Commit 6f95403f authored by chris's avatar chris
Browse files

add new tool

parent acf344ae
No related branches found
No related tags found
1 merge request!349Multiple single
......@@ -6,6 +6,7 @@ import QuestionComponent from './components/QuestionComponent';
import MultipleChoiceNodeView from './MultipleChoiceNodeView';
import MultipleChoiceSingleCorrectQuestionService from './MultipleChoiceSingleCorrectQuestionService/MultipleChoiceSingleCorrectQuestionService';
import TrueFalseQuestionService from './TrueFalseQuestionService/TrueFalseQuestionService';
import TrueFalseSingleCorrectQuestionService from './TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestionService';
class MultipleChoiceQuestionService extends Service {
register() {
......@@ -31,6 +32,7 @@ class MultipleChoiceQuestionService extends Service {
dependencies = [
new MultipleChoiceSingleCorrectQuestionService(),
new TrueFalseQuestionService(),
new TrueFalseSingleCorrectQuestionService(),
];
}
......
......@@ -11,7 +11,7 @@ import helpers from '../helpers/helpers';
import Tools from '../../lib/Tools';
@injectable()
class MultipleChoiceQuestion extends Tools {
class TrueFalseQuestion extends Tools {
title = 'Add True False Question';
icon = 'multipleChoice';
name = 'TrueFalse';
......@@ -66,4 +66,4 @@ class MultipleChoiceQuestion extends Tools {
}
}
export default MultipleChoiceQuestion;
export default TrueFalseQuestion;
......@@ -23,7 +23,6 @@ export default class TrueFalseSingleCorrectNodeView extends AbstractNodeView {
}
update(node) {
// if (!node.sameMarkup(this.node)) return false;
this.node = node;
if (this.context.view[node.attrs.id]) {
const { state } = this.context.view[node.attrs.id];
......
import Service from '../../Service';
import TrueFalseSingleCorrectQuestion from './TrueFalseSingleCorrectQuestion';
import trueFalseSingleCorrectNode from './schema/trueFalseSingleCorrectNode';
import trueFalseSingleCorrectContainerNode from './schema/trueFalseSingleCorrectContainerNode';
import QuestionComponent from './components/QuestionComponent';
import TrueFalseSingleCorrectNodeView from './TrueFalseSingleCorrectNodeView';
class TrueFalseSingleCorrectQuestionService extends Service {
register() {
this.container
.bind('TrueFalseSingleCorrectQuestion')
.to(TrueFalseSingleCorrectQuestion);
const createNode = this.container.get('CreateNode');
const addPortal = this.container.get('AddPortal');
createNode({
true_false_single_correct: trueFalseSingleCorrectNode,
});
createNode({
true_false_single_correct_container: trueFalseSingleCorrectContainerNode,
});
addPortal({
nodeView: TrueFalseSingleCorrectNodeView,
component: QuestionComponent,
context: this.app,
});
}
}
export default TrueFalseSingleCorrectQuestionService;
......@@ -16,12 +16,14 @@ class MultipleDropDown extends ToolGroup {
@inject('MultipleChoiceSingleCorrectQuestion')
multipleChoiceSingleCorrectQuestion,
@inject('TrueFalseQuestion') trueFalseQuestion,
@inject('TrueFalseSingleCorrectQuestion') trueFalseSingleCorrectQuestion,
) {
super();
this.tools = [
multipleChoiceQuestion,
multipleChoiceSingleCorrectQuestion,
trueFalseQuestion,
trueFalseSingleCorrectQuestion,
];
}
......@@ -67,7 +69,7 @@ class MultipleDropDown extends ToolGroup {
view: { main },
} = context;
const { state } = view;
console.log(this._tools);
const dropDownOptions = [
{
label: 'Multiple Choice',
......@@ -84,11 +86,11 @@ class MultipleDropDown extends ToolGroup {
value: '2',
item: this._tools[2],
},
// {
// label: 'True/False (single correct)',
// value: '3',
// item: this._tools[0],
// },
{
label: 'True/False (single correct)',
value: '3',
item: this._tools[3],
},
];
const isDisabled = this._tools[0].select(state, activeView);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment