blob: 33ead0b1b66ae9f7a31d6503716785a05c3e05e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
jQuery(document).on('paste', '.questionnaire_edit .options > li input', function(ui) {
var event = ui.originalEvent;
var text = event.clipboardData.getData('text');
text = text.split(/[\n\t]/);
if (text.length > 1) {
if (text[0]) {
this.value += text.shift().trim();
}
var current = jQuery(this).closest('li');
for (var i in text) {
if (text[i].trim()) {
var li = jQuery(
jQuery(this)
.closest('.options')
.data('optiontemplate')
);
li.find('input:text').val(text[i].trim());
li.insertAfter(current);
current = li;
}
}
STUDIP.Questionnaire.Test.updateCheckboxValues();
event.preventDefault();
}
});
jQuery(document).on('blur', '.questionnaire_edit .options > li:last-child input:text', function() {
if (this.value) {
jQuery(this)
.closest('.options')
.append(
jQuery(this)
.closest('.options')
.data('optiontemplate')
);
jQuery(this)
.closest('.options')
.find('li:last-child input')
.focus();
}
STUDIP.Questionnaire.Test.updateCheckboxValues();
});
jQuery(document).on('click', '.questionnaire_edit .options .delete', function() {
var icon = this;
STUDIP.Dialog.confirm(
jQuery(this)
.closest('.questionnaire_edit')
.find('.delete_question')
.text(),
function() {
jQuery(icon)
.closest('li')
.fadeOut(function() {
jQuery(this).remove();
STUDIP.Questionnaire.Test.updateCheckboxValues();
});
}
);
});
jQuery(document).on('click', '.questionnaire_edit .options .add', function() {
jQuery(this)
.closest('.options')
.append(
jQuery(this)
.closest('.options')
.data('optiontemplate')
);
jQuery(this)
.closest('.options')
.find('li:last-child input:text')
.focus();
STUDIP.Questionnaire.Test.updateCheckboxValues();
});
jQuery(document).on('change', '.show_validation_hints .questionnaire_answer [data-question_type=Vote] input', function() {
STUDIP.Questionnaire.Vote.validator.call($(this).closest("article")[0]);
});
|