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

Fix Image Drag & Drop Cross-Wiring in Edit Comment Form #8897

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
63d200c
add test for comment image crosswiring
noi5e Dec 27, 2020
f34bc6b
wrap everything in comment-form-wrapper, assign .selected in drop lis…
noi5e Dec 29, 2020
68f820c
delete defunct function, fix indentation & spacing #8670
noi5e Dec 29, 2020
9814c32
rewrite tests that rely on comment-form-wrapper
noi5e Dec 29, 2020
2892710
remove deprecated code, comments; fix indent
noi5e Dec 30, 2020
24589fa
initialize on pageload (#8670)
noi5e Dec 30, 2020
fc8b950
rewrite for multiple file inputs
noi5e Dec 30, 2020
5a6a114
change test to focus on image drag & drop #8670
noi5e Dec 30, 2020
b9b8182
Merge branch 'main' into bug/edit-comment-select-image-crosswiring
noi5e Jan 6, 2021
5972fe8
restore E.initialize call in drop #8670
noi5e Jan 6, 2021
540f112
undo E.initialize call #8670
noi5e Jan 6, 2021
43139a4
assign unique IDs to comment form textareas #8670
noi5e Jan 7, 2021
5e1baea
change ID selectors to class ones to match new IDs #8670
noi5e Jan 7, 2021
20017fb
fix indentation #8670
noi5e Jan 7, 2021
bd6d4ef
change ID reference to class reference #8670
noi5e Jan 7, 2021
3a7a213
initialize E with parameters in drop listener #8670
noi5e Jan 7, 2021
5adc893
update tests for new text-input selectors #8670
noi5e Jan 7, 2021
f095373
Merge branch 'main' into bug/edit-comment-select-image-crosswiring
noi5e Jan 7, 2021
8eece2e
change ID text-input reference to class ref #8670
noi5e Jan 8, 2021
3ad1a7d
change text-input ID to class #8670
noi5e Jan 8, 2021
364beba
drop: initialize E with params #8670
noi5e Jan 8, 2021
8e67269
Merge remote-tracking branch 'origin/bug/edit-comment-select-image-cr…
noi5e Jan 8, 2021
42f2e05
remove semicolon
noi5e Jan 8, 2021
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
2 changes: 1 addition & 1 deletion app/assets/javascripts/atwho_autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
limit: 100
}

$('textarea#text-input')
$('textarea.text-input')
.atwho(at_config)
.atwho(hashtags_config)
.atwho(emojis_config);
Expand Down
16 changes: 8 additions & 8 deletions app/assets/javascripts/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
$('.comment-form').each(function() {
if(!$(this).hasClass('bound-success')) {
$(this).addClass('bound-success').bind('ajax:success', function(e, data, status, xhr){
$(this).find('#text-input').prop('disabled',false);
$(this).find('#text-input').val('');
$(this).find('.text-input').prop('disabled',false);
$(this).find('.text-input').val('');
$('#comments-container').append(xhr.responseText);
$(this).find(".btn-primary").button('reset');
$(this).find('#preview').hide();
$(this).find('#text-input').show();
$(this).find('.text-input').show();
$(this).find('#preview-btn').button('toggle');
});
}

if(!$(this).hasClass('bound-beforeSend')) {
$(this).addClass('bound-beforeSend').bind('ajax:beforeSend', function(event){
$(this).find("#text-input").prop('disabled',true)
$(this).find('#text-input').val('');
$(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){
notyNotification('mint', 3000, 'error', 'topRight', 'Some error occured while adding comment');
$(this).find('#text-input').prop('disabled',false);
$(this).find('.text-input').prop('disabled',false);
$(this).find('.control-group').addClass('has-error')
$(this).find('.control-group .help-block ').remove()
$(this).find('#text-input').val('');
$(this).find('.text-input').val('');
$(this).find('.control-group').append('<span class="help-block ">Error: there was a problem.</span>')
});
}

if(!$(this).hasClass('bound-keypress')) {
$(this).addClass('bound-keypress');

$(this).find('#text-input').val('');
$(this).find('.text-input').val('');
$(this).on('keypress', function (e) {
var isPostCommentShortcut = (e.ctrlKey && e.keyCode === 10) || (e.metaKey && e.keyCode === 13);

Expand Down
Loading