Skip to content

Commit

Permalink
change .bind eventHandlers to on publiclab#8897
Browse files Browse the repository at this point in the history
  • Loading branch information
noi5e committed Jan 9, 2021
1 parent d38da1c commit fd606ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$('.comment-form').each(function() {
if(!$(this).hasClass('bound-success')) {
$(this).addClass('bound-success').bind('ajax:success', function(e, data, status, xhr){
$(this).addClass('bound-success').on('ajax:success', function(e, data, status, xhr){
$(this).find('.text-input').prop('disabled',false);
$(this).find('.text-input').val('');
$('#comments-container').append(xhr.responseText);
Expand All @@ -14,15 +14,15 @@
}

if(!$(this).hasClass('bound-beforeSend')) {
$(this).addClass('bound-beforeSend').bind('ajax:beforeSend', function(event){
$(this).addClass('bound-beforeSend').on('ajax:beforeSend', function(event){
$(this).find(".text-input").prop('disabled',true)
$(this).find('.text-input').val('');
$(this).find(".btn-primary").button('loading',true);
});
}

if(!$(this).hasClass('bound-error')) {
$(this).addClass('bound-error').bind('ajax:error', function(e,response){
$(this).addClass('bound-error').on('ajax:error', function(e,response){
notyNotification('mint', 3000, 'error', 'topRight', 'Some error occured while adding comment');
$(this).find('.text-input').prop('disabled',false);
$(this).find('.control-group').addClass('has-error')
Expand Down
6 changes: 3 additions & 3 deletions app/views/comments/_edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@
$E.initialize(args);
}

$('#c<%= comment.id%>div').bind('dragover',function(e) {
$('#c<%= comment.id%>div').on('dragover',function(e) {
e.preventDefault();
$('#c<%= comment.id%>div').addClass('hover');
});

$('#c<%= comment.id%>div').bind('dragout',function(e) {
$('#c<%= comment.id%>div').on('dragout',function(e) {
$('#c<%= comment.id%>div').removeClass('hover');
});

$('#c<%= comment.id%>div').bind('drop',function(e) {
$('#c<%= comment.id%>div').on('drop',function(e) {
e.preventDefault();
$D.selected = $(e.target).closest('div.comment-form-wrapper').eq(0);
setInit(<%= comment.id %>);
Expand Down

0 comments on commit fd606ba

Please sign in to comment.