Skip to content

Commit

Permalink
feat: auto detect upload file extension for packtype (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiichi3227 authored May 21, 2024
1 parent 1d35c86 commit aa867b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/static/templ/manage/pro/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@
});
});

j_form.find('input.file').on('change', function(e) {
let pack_type_select = j_form.find('select.packtype');
let filename = $(this)[0].files[0].name;

if (filename.endsWith(".tar.xz")) {
pack_type_select.val('1');
} else if (filename.endsWith(".html")) {
pack_type_select.val('2');
} else if (filename.endsWith(".pdf")) {
pack_type_select.val('3');
}
});

j_form.find('button.submit').on('click', function(e) {
var name = j_form.find('input.name').val();
var tags = j_form.find('input.tags').val();
Expand Down

0 comments on commit aa867b4

Please sign in to comment.