mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
feature: allow users to manage ssh keys
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
/*global showAddAnotherPopup, showRelatedObjectLookupPopup showRelatedObjectPopup updateRelatedObjectLinks*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
$(document).ready(function() {
|
||||
var modelName = $('#django-admin-form-add-constants').data('modelName');
|
||||
$('body').on('click', '.add-another', function(e) {
|
||||
e.preventDefault();
|
||||
var event = $.Event('django:add-another-related');
|
||||
$(this).trigger(event);
|
||||
if (!event.isDefaultPrevented()) {
|
||||
showAddAnotherPopup(this);
|
||||
'use strict';
|
||||
{
|
||||
const inputTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
|
||||
const modelName = document.getElementById('django-admin-form-add-constants').dataset.modelName;
|
||||
if (modelName) {
|
||||
const form = document.getElementById(modelName + '_form');
|
||||
for (const element of form.elements) {
|
||||
// HTMLElement.offsetParent returns null when the element is not
|
||||
// rendered.
|
||||
if (inputTags.includes(element.tagName) && !element.disabled && element.offsetParent) {
|
||||
element.focus();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (modelName) {
|
||||
$('form#' + modelName + '_form :input:visible:enabled:first').focus();
|
||||
}
|
||||
});
|
||||
})(django.jQuery);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user