Move DN export to its own modal, leveraging page-modal
This commit is contained in:
37
resources/views/modals/entry-export.blade.php
Normal file
37
resources/views/modals/entry-export.blade.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<div class="modal-header bg-dark text-white">
|
||||
<h1 class="modal-title fs-5">
|
||||
LDIF for {{ Crypt::decryptString($dn) }}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div id="entry_export"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<x-modal.close/>
|
||||
<button id="entry_export-download" type="button" class="btn btn-sm btn-primary">Download</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function download(filename,text) {
|
||||
var element = document.createElement('a');
|
||||
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('button[id=entry_export-download]').on('click',function(item) {
|
||||
item.preventDefault();
|
||||
|
||||
let ldif = $('#entry_export').find('pre:first');
|
||||
download('ldap-export.ldif',ldif.html());
|
||||
});
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user