| Línea 211... |
Línea 211... |
| 211 |
this.edit_section_title_clear(activity);
|
211 |
this.edit_section_title_clear(activity);
|
| 212 |
if (newtext !== null && newtext !== oldtext) {
|
212 |
if (newtext !== null && newtext !== oldtext) {
|
| 213 |
var instancesection = activity.one(SELECTOR.INSTANCESECTION);
|
213 |
var instancesection = activity.one(SELECTOR.INSTANCESECTION);
|
| 214 |
var instancesectiontext = newtext;
|
214 |
var instancesectiontext = newtext;
|
| 215 |
if (newtext.trim() === '') {
|
215 |
if (newtext.trim() === '') {
|
| 216 |
// Add a sr-only default section heading text to make sure we don't end up with an empty section heading.
|
216 |
// Add a visually-hidden default section heading text to make sure we don't end up with an empty section heading.
|
| 217 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
217 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
| 218 |
instancesection.addClass('sr-only');
|
218 |
instancesection.addClass('visually-hidden');
|
| 219 |
} else {
|
219 |
} else {
|
| 220 |
// Show the section heading when a non-empty value is set.
|
220 |
// Show the section heading when a non-empty value is set.
|
| 221 |
instancesection.removeClass('sr-only');
|
221 |
instancesection.removeClass('visually-hidden');
|
| 222 |
}
|
222 |
}
|
| 223 |
instancesection.setContent(instancesectiontext);
|
223 |
instancesection.setContent(instancesectiontext);
|
| Línea 224... |
Línea 224... |
| 224 |
|
224 |
|
| 225 |
var data = {
|
225 |
var data = {
|
| Línea 232... |
Línea 232... |
| 232 |
if (response) {
|
232 |
if (response) {
|
| 233 |
// Set the content of the section heading if for some reason the response is different from the new text.
|
233 |
// Set the content of the section heading if for some reason the response is different from the new text.
|
| 234 |
// e.g. filters were applied, the update failed, etc.
|
234 |
// e.g. filters were applied, the update failed, etc.
|
| 235 |
if (newtext !== response.instancesection) {
|
235 |
if (newtext !== response.instancesection) {
|
| 236 |
if (response.instancesection.trim() === '') {
|
236 |
if (response.instancesection.trim() === '') {
|
| 237 |
// Add a sr-only default section heading text.
|
237 |
// Add a visually-hidden default section heading text.
|
| 238 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
238 |
instancesectiontext = M.util.get_string('sectionnoname', 'quiz');
|
| 239 |
instancesection.addClass('sr-only');
|
239 |
instancesection.addClass('visually-hidden');
|
| 240 |
} else {
|
240 |
} else {
|
| 241 |
instancesectiontext = response.instancesection;
|
241 |
instancesectiontext = response.instancesection;
|
| 242 |
// Show the section heading when a non-empty value is set.
|
242 |
// Show the section heading when a non-empty value is set.
|
| 243 |
instancesection.removeClass('sr-only');
|
243 |
instancesection.removeClass('visually-hidden');
|
| 244 |
}
|
244 |
}
|
| 245 |
instancesection.setContent(instancesectiontext);
|
245 |
instancesection.setContent(instancesectiontext);
|
| 246 |
}
|
246 |
}
|
| Línea 247... |
Línea 247... |
| 247 |
|
247 |
|