-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YDA-5721: add admin configuration of preservable file formats lists
- Loading branch information
1 parent
23ca082
commit ba6449a
Showing
3 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* global Option */ | ||
'use strict' | ||
|
||
$(function () { | ||
Yoda.call('vault_preservable_formats_lists').then((data) => { | ||
$('#file-formats-list').html("<option value='' disabled selected>Select file format list to delete</option>") | ||
for (const list in data) { | ||
if (Object.prototype.hasOwnProperty.call(data, list)) { | ||
$('#file-formats-list').append(new Option(data[list].name, list)) | ||
} | ||
} | ||
}) | ||
|
||
document.getElementById('upload-button').addEventListener('click', function () { | ||
document.getElementById('file').click() | ||
}) | ||
|
||
document.getElementById('file').addEventListener('change', function () { | ||
if (this.files.length > 0) { | ||
this.form.submit() | ||
} | ||
}) | ||
|
||
$('#file-formats-list').on('change', function () { | ||
if ($(this).val()) { | ||
$('#delete-format-button').prop('disabled', false) | ||
} else { | ||
$('#delete-format-button').prop('disabled', true) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters