Merge branch 'MDL-35981-master' of git://github.com/damyon/moodle

This commit is contained in:
Marina Glancy 2013-08-05 12:19:45 +10:00
commit e22e263fa0
3 changed files with 13 additions and 38 deletions

View File

@ -103,10 +103,6 @@ class behat_block_comments extends behat_base {
$deleteicon = $this->find('css', '.comment-delete a img', $deleteexception, $commentnode);
$deleteicon->click();
// Yes confirm.
$confirmnode = $this->find('xpath', "//div[@class='comment-delete-confirm']/descendant::a[contains(., '" . get_string('yes') . "')]");
$confirmnode->click();
// Wait for the AJAX request.
$this->getSession()->wait(4 * 1000, false);
}

View File

@ -55,7 +55,6 @@ Feature: Comment on a blog entry
And I follow "Save comment"
And I wait "4" seconds
When I click on ".comment-delete a" "css_element"
And I click on "Yes" "link"
And I wait "4" seconds
Then I should not see "$My own >nasty< \"string\"!"
And I follow "Blog post from user 1"

View File

@ -59,11 +59,6 @@ M.core_comment = {
}, this);
}
scope.toggle_textarea(false);
CommentHelper.confirmoverlay = new Y.Overlay({
bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-'+this.client_id+'">'+M.str.moodle.yes+'</a> <a href="#" id="canceldelete-'+this.client_id+'">'+M.str.moodle.no+'</a></div>',
visible: false
});
CommentHelper.confirmoverlay.render(document.body);
},
post: function() {
var ta = Y.one('#dlg-content-'+this.client_id);
@ -238,7 +233,6 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
dodelete: function(id) { // note: delete is a reserved word in javascript, chrome and safary do not like it at all here!
var scope = this;
var params = {'commentid': id};
scope.cancel_delete();
function remove_dom(type, anim, cmt) {
cmt.remove();
}
@ -294,37 +288,23 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
if (commentid[1]) {
Y.Event.purgeElement('#'+theid, false, 'click');
}
node.on('click', function(e, node) {
node.on('click', function(e) {
e.preventDefault();
var width = CommentHelper.confirmoverlay.bodyNode.getStyle('width');
var re = new RegExp("(\\d+).*", "i");
var result = width.match(re);
if (result[1]) {
width = Number(result[1]);
} else {
width = 0;
if (commentid[1]) {
scope.dodelete(commentid[1]);
}
//CommentHelper.confirmoverlay.set('xy', [e.pageX-(width/2), e.pageY]);
CommentHelper.confirmoverlay.set('xy', [e.pageX-width-5, e.pageY]);
CommentHelper.confirmoverlay.set('visible', true);
Y.one('#canceldelete-'+scope.client_id).on('click', function(e) {
e.preventDefault();
scope.cancel_delete();
});
Y.Event.purgeElement('#confirmdelete-'+scope.client_id, false, 'click');
Y.one('#confirmdelete-'+scope.client_id).on('click', function(e) {
e.preventDefault();
if (commentid[1]) {
scope.dodelete(commentid[1]);
}
});
}, scope, node);
});
// Also handle space/enter key.
node.on('key', function(e) {
e.preventDefault();
if (commentid[1]) {
scope.dodelete(commentid[1]);
}
}, '13,32');
// 13 and 32 are the keycodes for space and enter.
}
);
},
cancel_delete: function() {
CommentHelper.confirmoverlay.set('visible', false);
},
register_pagination: function() {
var scope = this;
// page buttons
@ -374,7 +354,7 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
if (ta) {
//toggle_textarea.apply(ta, [false]);
//// reset textarea size
ta.on('click', function() {
ta.on('focus', function() {
this.toggle_textarea(true);
}, this);
//ta.onkeypress = function() {