Commit c5d2ba72 authored by Saskia Schreiber's avatar Saskia Schreiber

[TASK] Move textChecker elements to corresponding class

parent 7db08184
......@@ -22,17 +22,16 @@ Ext.define('ARSnova.view.speaker.form.FreeTextQuestion', {
requires: [
'Ext.field.Toggle',
'Ext.form.FieldSet',
'ARSnova.view.speaker.form.textCheckerStricktOptionsForm'
'ARSnova.view.speaker.form.TextChecker'
],
config: {
scrollable: null,
pressed: 'free',
cls: 'centerFormTitle'
},
imageQuestion: false,
textAnswerEnabled: true,
textCheckerStricktOptionsFormPart: null,
textChecker: null,
initialize: function () {
this.callParent(arguments);
......@@ -89,127 +88,23 @@ Ext.define('ARSnova.view.speaker.form.FreeTextQuestion', {
style: 'margin-top:45px;',
items: [this.imgUploadBtn]
});
this.textCheckerStricktOptionsFormPart = Ext.create('ARSnova.view.speaker.form.textCheckerStricktOptionsForm', {
id: 'textCheckerStricktOptionsFormPart'
});
var freeButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_FREE,
handler: function () {
mainFormPanel.hide();
selectField.hide();
ratingField.hide();
me.textCheckerStricktOptionsFormPart.hide();
},
pressed: this.getPressed() === 'free'
});
var fixButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_FIX,
handler: function () {
mainFormPanel.show();
selectField.show();
ratingField.show();
},
pressed: this.getPressed() === 'fix'
});
var ffSegmentedButton = Ext.create('Ext.SegmentedButton', {
style: 'margin: auto;',
defaults: {
ui: 'action',
style: 'width: 50%'
},
items:[freeButton, fixButton]
});
var freefixField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.FREETEXT_QUESTION_TYPE,
items: [ffSegmentedButton]
});
var easyButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_EASY,
handler: function () {
me.textCheckerStricktOptionsFormPart.hide();
},
pressed: true
});
var strictButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_STRICT,
handler: function () {
me.textCheckerStricktOptionsFormPart.show();
},
pressed: this.getPressed() === 'strict'
});
var esSegmentedButton = Ext.create('Ext.SegmentedButton', {
style: 'margin: auto;',
defaults: {
ui: 'action',
style: 'width: 50%'
},
items:[easyButton, strictButton]
});
var selectField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.FREETEXT_CHECK,
items: [esSegmentedButton],
hidden: true
});
var rating = Ext.create("ARSnova.view.CustomSliderField", {
minValue: 0,
maxValue: 10,
value: 0,
increment: 1
});
var ratingField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.ANSWER_POINTS,
items: [rating],
hidden: true
});
// Eingabefeld
var textarea = Ext.create('Ext.plugins.ResizableTextArea', {
name: 'text',
placeHolder: Messages.FORMAT_PLACEHOLDER
});
var sizearea = Ext.create('Ext.field.Text', {
name: 'size',
placeHolder: Messages.FREETEXT_SIZE
});
var mainFormPanel = Ext.create('Ext.form.FormPanel', {
cls: 'newTest',
scrollable: null,
items: [{
xtype: 'fieldset',
title: Messages.CORRECT_PLACEHOLDER,
items: [textarea, sizearea]
}],
hidden: true
this.textChecker = Ext.create('ARSnova.view.speaker.form.TextChecker', {
id: 'textChecker'
});
this.add([answerFieldset,
this.textAnswerFieldSet,
freefixField,
mainFormPanel,
selectField,
this.textCheckerStricktOptionsFormPart,
ratingField]);
this.textAnswerFieldSet,
this.textChecker]);
},
getQuestionValues: function () {
var result = {};
result.imageQuestion = this.imageQuestion;
result.textAnswerEnabled = this.textAnswerEnabled;
result.ignoreCaseSensitive = this.textCheckerStricktOptionsFormPart.getIgnoreCaseSensitive();
result.ignoreWhitespaces = this.textCheckerStricktOptionsFormPart.getIgnoreWhitespaces();
result.ignorePunctuation = this.textCheckerStricktOptionsFormPart.getIgnorePunctuation();
result.ignoreCaseSensitive = this.textChecker.textCheckerStricktOptionsFormPart.getIgnoreCaseSensitive();
result.ignoreWhitespaces = this.textChecker.textCheckerStricktOptionsFormPart.getIgnoreWhitespaces();
result.ignorePunctuation = this.textChecker.textCheckerStricktOptionsFormPart.getIgnorePunctuation();
return result;
}
......
......@@ -18,10 +18,10 @@
*/
Ext.define('ARSnova.view.speaker.form.TextChecker', {
extend: 'Ext.form.FormPanel',
requires: ['ARSnova.view.speaker.form.textCheckerStricktOptionsForm'],
config: {
freetextAnswer: true,
pressed: 'free',
scrollable: null,
cls: 'newQuestionOptions centerFormTitle'
},
......@@ -29,32 +29,117 @@ Ext.define('ARSnova.view.speaker.form.TextChecker', {
constructor: function () {
this.callParent(arguments);
this.add([{
var textCheckerStricktOptionsFormPart = Ext.create('ARSnova.view.speaker.form.textCheckerStricktOptionsForm', {
id: 'textCheckerStricktOptionsFormPart'
});
var freeButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_FREE,
handler: function () {
mainFormPanel.hide();
selectField.hide();
ratingField.hide();
textCheckerStricktOptionsFormPart.hide();
},
pressed: this.getPressed() === 'free'
});
var fixButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_FIX,
handler: function () {
mainFormPanel.show();
selectField.show();
ratingField.show();
},
pressed: this.getPressed() === 'fix'
});
var ffSegmentedButton = Ext.create('Ext.SegmentedButton', {
style: 'margin: auto;',
defaults: {
ui: 'action',
style: 'width: 50%'
},
items:[freeButton, fixButton]
});
var freefixField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.FREETEXT_QUESTION_TYPE,
items: [ffSegmentedButton]
});
var easyButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_EASY,
handler: function () {
textCheckerStricktOptionsFormPart.hide();
},
pressed: true
});
var strictButton = Ext.create('Ext.Button', {
text: Messages.FREETEXT_BUTTON_STRICT,
handler: function () {
textCheckerStricktOptionsFormPart.show();
},
pressed: this.getPressed() === 'strict'
});
var esSegmentedButton = Ext.create('Ext.SegmentedButton', {
style: 'margin: auto;',
defaults: {
ui: 'action',
style: 'width: 50%'
},
items:[easyButton, strictButton]
});
var selectField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.FREETEXT_CHECK,
items: [esSegmentedButton],
hidden: true
});
var rating = Ext.create("ARSnova.view.CustomSliderField", {
minValue: 0,
maxValue: 10,
value: 0,
increment: 1
});
var ratingField = Ext.create('Ext.form.FieldSet', {
xtype: 'fieldset',
title: Messages.TEXT_CHECKER_TITLE,
title: Messages.ANSWER_POINTS,
items: [rating],
hidden: true
});
// Eingabefeld
var textarea = Ext.create('Ext.plugins.ResizableTextArea', {
name: 'text',
placeHolder: Messages.FORMAT_PLACEHOLDER
});
var sizearea = Ext.create('Ext.field.Text', {
name: 'size',
placeHolder: Messages.FREETEXT_SIZE
});
var mainFormPanel = Ext.create('Ext.form.FormPanel', {
cls: 'newTest',
scrollable: null,
items: [{
xtype: 'segmentedbutton',
style: 'margin: auto',
cls: 'yesnoOptions',
defaults: {
ui: 'action'
},
items: [{
text: Messages.TEXT_CHECKER_FREETEXT,
pressed: this.getFreetextAnswer(),
scope: this,
handler: function () {
this.setFreetextAnswer(true);
}
}, {
text: Messages.TEXT_CHECKER_ADD_SOLUTION,
pressed: !this.getFreetextAnswer(),
scope: this,
handler: function () {
this.setFreetextAnswer(false);
}
}]
}]
}]);
xtype: 'fieldset',
title: Messages.CORRECT_PLACEHOLDER,
items: [textarea, sizearea]
}],
hidden: true
});
this.add([
freefixField,
mainFormPanel,
selectField,
textCheckerStricktOptionsFormPart,
ratingField
]);
}
});
Markdown is supported
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