| Línea 1032... |
Línea 1032... |
| 1032 |
this.edit_section_title_clear(activity);
|
1032 |
this.edit_section_title_clear(activity);
|
| 1033 |
if (newtext !== null && newtext !== oldtext) {
|
1033 |
if (newtext !== null && newtext !== oldtext) {
|
| 1034 |
var instancesection = activity.one(SELECTOR.INSTANCESECTION);
|
1034 |
var instancesection = activity.one(SELECTOR.INSTANCESECTION);
|
| 1035 |
var instancesectiontext = newtext;
|
1035 |
var instancesectiontext = newtext;
|
| 1036 |
if (newtext.trim() === '') {
|
1036 |
if (newtext.trim() === '') {
|
| 1037 |
// Add a sr-only default section heading text to make sure we don't end up with an empty section heading.
|
1037 |
// Add a visually-hidden default section heading text to make sure we don't end up with an empty section heading.
|
| 1038 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
1038 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
| 1039 |
instancesection.addClass('sr-only');
|
1039 |
instancesection.addClass('visually-hidden');
|
| 1040 |
} else {
|
1040 |
} else {
|
| 1041 |
// Show the section heading when a non-empty value is set.
|
1041 |
// Show the section heading when a non-empty value is set.
|
| 1042 |
instancesection.removeClass('sr-only');
|
1042 |
instancesection.removeClass('visually-hidden');
|
| 1043 |
}
|
1043 |
}
|
| 1044 |
instancesection.setContent(instancesectiontext);
|
1044 |
instancesection.setContent(instancesectiontext);
|
| Línea 1045... |
Línea 1045... |
| 1045 |
|
1045 |
|
| 1046 |
var data = {
|
1046 |
var data = {
|
| Línea 1053... |
Línea 1053... |
| 1053 |
if (response) {
|
1053 |
if (response) {
|
| 1054 |
// Set the content of the section heading if for some reason the response is different from the new text.
|
1054 |
// Set the content of the section heading if for some reason the response is different from the new text.
|
| 1055 |
// e.g. filters were applied, the update failed, etc.
|
1055 |
// e.g. filters were applied, the update failed, etc.
|
| 1056 |
if (newtext !== response.instancesection) {
|
1056 |
if (newtext !== response.instancesection) {
|
| 1057 |
if (response.instancesection.trim() === '') {
|
1057 |
if (response.instancesection.trim() === '') {
|
| 1058 |
// Add a sr-only default section heading text.
|
1058 |
// Add a visually-hidden default section heading text.
|
| 1059 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
1059 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
| 1060 |
instancesection.addClass('sr-only');
|
1060 |
instancesection.addClass('visually-hidden');
|
| 1061 |
} else {
|
1061 |
} else {
|
| 1062 |
instancesectiontext = response.instancesection;
|
1062 |
instancesectiontext = response.instancesection;
|
| 1063 |
// Show the section heading when a non-empty value is set.
|
1063 |
// Show the section heading when a non-empty value is set.
|
| 1064 |
instancesection.removeClass('sr-only');
|
1064 |
instancesection.removeClass('visually-hidden');
|
| 1065 |
}
|
1065 |
}
|
| 1066 |
instancesection.setContent(instancesectiontext);
|
1066 |
instancesection.setContent(instancesectiontext);
|
| 1067 |
}
|
1067 |
}
|
| Línea 1068... |
Línea 1068... |
| 1068 |
|
1068 |
|