Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 70... Línea 70...
70
                    }, '13,32', this);
70
                    }, '13,32', this);
71
                }
71
                }
72
                scope.toggle_textarea(false);
72
                scope.toggle_textarea(false);
73
            },
73
            },
74
            post: function() {
74
            post: function() {
-
 
75
                var container = Y.one('#comment-list-'+this.client_id);
75
                var ta = Y.one('#dlg-content-'+this.client_id);
76
                var ta = Y.one('#dlg-content-'+this.client_id);
76
                var scope = this;
77
                var scope = this;
77
                var value = ta.get('value');
78
                var value = ta.get('value');
78
                if (value && value != M.util.get_string('addcomment', 'moodle')) {
79
                if (value && value != M.util.get_string('addcomment', 'moodle')) {
79
                    ta.set('disabled', true);
80
                    ta.set('disabled', true);
80
                    ta.setStyles({
-
 
81
                        'backgroundImage': 'url(' + M.util.image_url('i/loading_small', 'core') + ')',
-
 
82
                        'backgroundRepeat': 'no-repeat',
-
 
83
                        'backgroundPosition': 'center center'
81
                    var spinner = M.util.add_spinner(Y, container);
84
                    });
82
                    spinner.show();
85
                    var params = {'content': value};
83
                    var params = {'content': value};
86
                    this.request({
84
                    this.request({
87
                        action: 'add',
85
                        action: 'add',
88
                        scope: scope,
86
                        scope: scope,
89
                        params: params,
87
                        params: params,
Línea 91... Línea 89...
91
                            var scope = args.scope;
89
                            var scope = args.scope;
92
                            var cid = scope.client_id;
90
                            var cid = scope.client_id;
93
                            var ta = Y.one('#dlg-content-'+cid);
91
                            var ta = Y.one('#dlg-content-'+cid);
94
                            ta.set('value', '');
92
                            ta.set('value', '');
95
                            ta.set('disabled', false);
93
                            ta.set('disabled', false);
96
                            ta.setStyle('backgroundImage', 'none');
94
                            spinner.remove();
97
                            scope.toggle_textarea(false);
95
                            scope.toggle_textarea(false);
98
                            var container = Y.one('#comment-list-'+cid);
96
                            var container = Y.one('#comment-list-'+cid);
99
                            var result = await scope.render([obj], true);
97
                            var result = await scope.render([obj], true);
100
                            var newcomment = Y.Node.create(result.html);
98
                            var newcomment = Y.Node.create(result.html);
101
                            container.appendChild(newcomment);
99
                            container.appendChild(newcomment);
Línea 399... Línea 397...
399
                    // hide
397
                    // hide
400
                    container.setStyle('display', 'none');
398
                    container.setStyle('display', 'none');
401
                    var collapsedimage = 't/collapsed'; // ltr mode
399
                    var collapsedimage = 't/collapsed'; // ltr mode
402
                    if ( Y.one(document.body).hasClass('dir-rtl') ) {
400
                    if ( Y.one(document.body).hasClass('dir-rtl') ) {
403
                        collapsedimage = 't/collapsed_rtl';
401
                        collapsedimage = 't/collapsed_rtl';
404
                    } else {
-
 
405
                        collapsedimage = 't/collapsed';
-
 
406
                    }
402
                    }
407
                    if (img) {
403
                    if (img) {
408
                        img.set('src', M.util.image_url(collapsedimage, 'core'));
404
                        img.set('src', M.util.image_url(collapsedimage, 'core'));
409
                    }
405
                    }
410
                    if (ta) {
406
                    if (ta) {
Línea 449... Línea 445...
449
                    }
445
                    }
450
                }
446
                }
451
            },
447
            },
452
            wait: function() {
448
            wait: function() {
453
                var container = Y.one('#comment-list-'+this.client_id);
449
                var container = Y.one('#comment-list-'+this.client_id);
454
                container.set('innerHTML', '<div class="mdl-align"><img src="'+M.util.image_url('i/loading_small', 'core')+'" /></div>');
450
                container.set('innerHTML', '');
-
 
451
                M.util.add_spinner(Y, container).show();
455
            }
452
            }
456
        });
453
        });
Línea 457... Línea 454...
457
 
454
 
458
        new CommentHelper(options);
455
        new CommentHelper(options);