Skip to content

Commit

Permalink
Show Pastebin Attachment if File/Input Already Uploaded (#22813)
Browse files Browse the repository at this point in the history
* Show proper pastebin attachment input if it already contains data

* lint

* simplify
  • Loading branch information
chrstinalin authored Nov 1, 2024
1 parent f4da852 commit 0175d22
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions static/js/zamboni/reviewers.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,19 +303,22 @@ function initExtraReviewActions() {
}),
);

$('#toggle_attachment_file').on('click', function (e) {
e.preventDefault();
$('#attachment-type-toggle').addClass('hidden');
$('#attachment_input_wrapper').addClass('hidden');
const showFileWrapper = (e) => {
e?.preventDefault();
$('#attachment-type-toggle, #attachment_input_wrapper').addClass('hidden');
$('#attachment_file_wrapper').removeClass('hidden');
});

$('#toggle_attachment_input').on('click', function (e) {
e.preventDefault();
$('#attachment-type-toggle').addClass('hidden');
$('#attachment_file_wrapper').addClass('hidden');
};
const showInputWrapper = (e) => {
e?.preventDefault();
$('#attachment-type-toggle, #attachment_file_wrapper').addClass('hidden');
$('#attachment_input_wrapper').removeClass('hidden');
});
};

$('#id_attachment_file').prop('files').length && showFileWrapper();
$('#id_attachment_input').val() && showInputWrapper();

$('#toggle_attachment_file').on('click', showFileWrapper);
$('#toggle_attachment_input').on('click', showInputWrapper);

// One-off-style buttons.
$('.more-actions button.oneoff[data-api-url]').click(
Expand Down

0 comments on commit 0175d22

Please sign in to comment.