Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 19... Línea 19...
19
 * @module     core/notification
19
 * @module     core/notification
20
 * @copyright  2015 Damyon Wiese <damyon@moodle.com>
20
 * @copyright  2015 Damyon Wiese <damyon@moodle.com>
21
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @since      2.9
22
 * @since      2.9
23
 */
23
 */
-
 
24
 
24
import Pending from 'core/pending';
25
import Pending from 'core/pending';
-
 
26
import ModalEvents from 'core/modal_events';
25
import Log from 'core/log';
27
import Log from 'core/log';
Línea 26... Línea 28...
26
 
28
 
Línea 27... Línea 29...
27
let currentContextId = M.cfg.contextid;
29
let currentContextId = M.cfg.contextid;
Línea 227... Línea 229...
227
} = {}) => {
229
} = {}) => {
228
    const pendingPromise = new Pending('core/notification:confirm');
230
    const pendingPromise = new Pending('core/notification:confirm');
Línea 229... Línea 231...
229
 
231
 
230
    const [
232
    const [
231
        SaveCancelModal,
-
 
232
        ModalEvents,
233
        SaveCancelModal,
233
    ] = await Promise.all([
234
    ] = await Promise.all([
234
        import('core/modal_save_cancel'),
-
 
235
        import('core/modal_events'),
235
        import('core/modal_save_cancel'),
Línea 236... Línea 236...
236
    ]);
236
    ]);
237
 
237
 
238
    const modal = await SaveCancelModal.create({
238
    const modal = await SaveCancelModal.create({
Línea 271... Línea 271...
271
} = {}) => {
271
} = {}) => {
272
    const pendingPromise = new Pending('core/notification:confirm');
272
    const pendingPromise = new Pending('core/notification:confirm');
Línea 273... Línea 273...
273
 
273
 
274
    const [
274
    const [
275
        DeleteCancelModal,
-
 
276
        ModalEvents,
275
        DeleteCancelModal,
277
    ] = await Promise.all([
276
    ] = await Promise.all([
278
        import('core/modal_delete_cancel'),
-
 
279
        import('core/modal_events'),
277
        import('core/modal_delete_cancel'),
Línea 280... Línea 278...
280
    ]);
278
    ]);
281
 
279
 
282
    const modal = await DeleteCancelModal.create({
280
    const modal = await DeleteCancelModal.create({
Línea 308... Línea 306...
308
 * @return {Promise}
306
 * @return {Promise}
309
 */
307
 */
310
export const saveCancelPromise = (title, question, saveLabel, {
308
export const saveCancelPromise = (title, question, saveLabel, {
311
    triggerElement = null,
309
    triggerElement = null,
312
} = {}) => new Promise((resolve, reject) => {
310
} = {}) => new Promise((resolve, reject) => {
313
    saveCancel(title, question, saveLabel, resolve, reject, {triggerElement});
311
    saveCancel(title, question, saveLabel, resolve, reject, {triggerElement})
-
 
312
        .then(modal => modal.getRoot().on(ModalEvents.hidden, reject));
314
});
313
});
Línea 315... Línea 314...
315
 
314
 
316
/**
315
/**
317
 * Add all of the supplied notifications.
316
 * Add all of the supplied notifications.
Línea 403... Línea 402...
403
    fetchNotifications,
402
    fetchNotifications,
404
    addNotification,
403
    addNotification,
405
    alert,
404
    alert,
406
    confirm,
405
    confirm,
407
    saveCancel,
406
    saveCancel,
-
 
407
    deleteCancel,
408
    saveCancelPromise,
408
    saveCancelPromise,
409
    deleteCancelPromise,
409
    deleteCancelPromise,
410
    exception,
410
    exception,
411
};
411
};