Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 29... Línea 29...
29
import {getString} from 'core/str';
29
import {getString} from 'core/str';
30
import * as ModalEvents from 'core/modal_events';
30
import * as ModalEvents from 'core/modal_events';
31
import Pending from 'core/pending';
31
import Pending from 'core/pending';
32
import SaveCancelModal from 'core/modal_save_cancel';
32
import SaveCancelModal from 'core/modal_save_cancel';
33
import Config from 'core/config';
33
import Config from 'core/config';
-
 
34
import {eventTypes as inplaceEditableEvents} from 'core/local/inplace_editable/events';
34
import * as reportSelectors from 'core_reportbuilder/local/selectors';
35
import * as reportSelectors from 'core_reportbuilder/local/selectors';
Línea 35... Línea 36...
35
 
36
 
36
const getTagIndex = (tagindex) => fetchMany([{
37
const getTagIndex = (tagindex) => fetchMany([{
37
    methodname: 'core_tag_get_tagindex',
38
    methodname: 'core_tag_get_tagindex',
Línea 321... Línea 322...
321
 *
322
 *
322
 * @method initManagePage
323
 * @method initManagePage
323
 */
324
 */
324
export const initManagePage = () => {
325
export const initManagePage = () => {
325
    // Toggle row class when updating flag.
326
    // Toggle row class when updating flag.
326
    $('body').on('updated', '[data-inplaceeditable][data-itemtype=tagflag]', function(e) {
327
    $('body').on(inplaceEditableEvents.elementUpdated, '[data-inplaceeditable][data-itemtype=tagflag]', function(e) {
327
        var row = $(e.target).closest('tr');
328
        var row = $(e.target).closest('tr');
328
        row.toggleClass('table-warning', e.ajaxreturn.value === '1');
329
        row.toggleClass('table-warning', e.detail.ajaxreturn.value === '1');
329
    });
330
    });
Línea 330... Línea 331...
330
 
331
 
331
    // Confirmation for bulk tag combine button.
332
    // Confirmation for bulk tag combine button.
332
    document.addEventListener('click', async(e) => {
333
    document.addEventListener('click', async(e) => {
Línea 353... Línea 354...
353
            deleteSelectedTag(rowDeleteButton);
354
            deleteSelectedTag(rowDeleteButton);
354
        }
355
        }
355
    });
356
    });
Línea 356... Línea 357...
356
 
357
 
357
    // When user changes tag name to some name that already exists suggest to combine the tags.
358
    // When user changes tag name to some name that already exists suggest to combine the tags.
358
    $('body').on('updatefailed', '[data-inplaceeditable][data-itemtype=tagname]', async(e) => {
359
    $('body').on(inplaceEditableEvents.elementUpdateFailed, '[data-inplaceeditable][data-itemtype=tagname]', async(e) => {
359
        var exception = e.exception; // The exception object returned by the callback.
360
        var exception = e.detail.exception; // The exception object returned by the callback.
360
        var newvalue = e.newvalue; // The value that user tried to udpated the element to.
361
        var newvalue = e.detail.newvalue; // The value that user tried to udpated the element to.
361
        var tagid = $(e.target).attr('data-itemid');
362
        var tagid = $(e.target).attr('data-itemid');
362
        if (exception.errorcode !== 'namesalreadybeeingused') {
363
        if (exception.errorcode !== 'namesalreadybeeingused') {
363
            return;
364
            return;
364
        }
365
        }
Línea 390... Línea 391...
390
 * Initialises tag collection management page.
391
 * Initialises tag collection management page.
391
 *
392
 *
392
 * @method initManageCollectionsPage
393
 * @method initManageCollectionsPage
393
 */
394
 */
394
export const initManageCollectionsPage = () => {
395
export const initManageCollectionsPage = () => {
395
    $('body').on('updated', '[data-inplaceeditable]', function(e) {
396
    $('body').on(inplaceEditableEvents.elementUpdated, '[data-inplaceeditable]', function(e) {
396
        var pendingPromise = new Pending('core/tag:initManageCollectionsPage-updated');
397
        var pendingPromise = new Pending('core/tag:initManageCollectionsPage-updated');
Línea 397... Línea 398...
397
 
398
 
398
        var ajaxreturn = e.ajaxreturn,
399
        var ajaxreturn = e.detail.ajaxreturn,
399
            areaid, collid, isenabled;
400
            areaid, collid, isenabled;
400
        if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') {
401
        if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') {
401
            areaid = $(this).attr('data-itemid');
402
            areaid = $(this).attr('data-itemid');
402
            $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").hide();
403
            $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").hide();