Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge comments/edit & comments/form Partials #9183

Merged
merged 6 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions app/assets/javascripts/comment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$(function() {
// attach AJAX eventHandlers to comment forms for form submission
// EXCEPT for edit comment forms (those don't use AJAX form submission)
$('.comment-form').each(function() {
if(!$(this).hasClass('bound-success')) {
if(!$(this).hasClass('bound-success') && !$(this).hasClass('edit-comment-form')) {
$(this).addClass('bound-success').on('ajax:success', function(e, data, status, xhr){
$(this).find('.text-input').prop('disabled',false);
$(this).find('.text-input').val('');
Expand All @@ -12,15 +14,15 @@ $(function() {
});
}

if(!$(this).hasClass('bound-beforeSend')) {
if(!$(this).hasClass('bound-beforeSend') && !$(this).hasClass('edit-comment-form')) {
$(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')) {
if(!$(this).hasClass('bound-error') && !$(this).hasClass('edit-comment-form')) {
$(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);
Expand All @@ -31,7 +33,7 @@ $(function() {
});
}

if(!$(this).hasClass('bound-keypress')) {
if(!$(this).hasClass('bound-keypress') && !$(this).hasClass('edit-comment-form')) {
$(this).addClass('bound-keypress');

$(this).find('.text-input').val('');
Expand Down
104 changes: 0 additions & 104 deletions app/views/comments/_edit.html.erb

This file was deleted.

Loading