更新静态文件

This commit is contained in:
ngfchl
2022-09-10 15:11:00 +08:00
parent 0fd9ae19d6
commit 804963760c
8 changed files with 188 additions and 53 deletions

View File

@@ -65,7 +65,7 @@ body {
margin: 0;
padding: 0;
font-size: 0.875rem;
font-family: "Roboto", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;
color: var(--body-fg);
background: var(--body-bg);
}
@@ -922,7 +922,7 @@ a.deletelink:focus, a.deletelink:hover {
background: none;
border: 0;
cursor: pointer;
font-family: "Roboto", "Lucida Grande", "DejaVu Sans", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;
}
#user-tools {
@@ -931,7 +931,7 @@ a.deletelink:focus, a.deletelink:hover {
text-align: right;
}
#user-tools, #logout-form button {
#user-tools, #logout-form button{
padding: 0;
font-weight: 300;
font-size: 0.6875rem;

View File

@@ -1,33 +1,33 @@
@media (prefers-color-scheme: dark) {
:root {
--primary: #264b5d;
--primary-fg: #f7f7f7;
--body-fg: #eeeeee;
--body-bg: #121212;
--body-quiet-color: #e0e0e0;
--body-loud-color: #ffffff;
--breadcrumbs-link-fg: #e0e0e0;
--breadcrumbs-bg: var(--primary);
--link-fg: #81d4fa;
--link-hover-color: #4ac1f7;
--link-selected-fg: #6f94c6;
--hairline-color: #272727;
--border-color: #353535;
--error-fg: #e35f5f;
--message-success-bg: #006b1b;
--message-warning-bg: #583305;
--message-error-bg: #570808;
--darkened-bg: #212121;
--selected-bg: #1b1b1b;
--selected-row: #00363a;
--close-button-bg: #333333;
--close-button-hover-bg: #666666;
--primary: #264b5d;
--primary-fg: #f7f7f7;
--body-fg: #eeeeee;
--body-bg: #121212;
--body-quiet-color: #e0e0e0;
--body-loud-color: #ffffff;
--breadcrumbs-link-fg: #e0e0e0;
--breadcrumbs-bg: var(--primary);
--link-fg: #81d4fa;
--link-hover-color: #4ac1f7;
--link-selected-fg: #6f94c6;
--hairline-color: #272727;
--border-color: #353535;
--error-fg: #e35f5f;
--message-success-bg: #006b1b;
--message-warning-bg: #583305;
--message-error-bg: #570808;
--darkened-bg: #212121;
--selected-bg: #1b1b1b;
--selected-row: #00363a;
--close-button-bg: #333333;
--close-button-hover-bg: #666666;
}
}
}

View File

@@ -248,6 +248,7 @@ input[type="submit"], button {
}
/* Related widget */
.related-widget-wrapper {
float: none;
}

View File

@@ -8,18 +8,18 @@
const relatedWindows = [];
function dismissChildPopups() {
relatedWindows.forEach(function (win) {
if (!win.closed) {
relatedWindows.forEach(function(win) {
if(!win.closed) {
win.dismissChildPopups();
win.close();
win.close();
}
});
}
function setPopupIndex() {
if (document.getElementsByName("_popup").length > 0) {
if(document.getElementsByName("_popup").length > 0) {
const index = window.name.lastIndexOf("__") + 2;
popupIndex = parseInt(window.name.substring(index));
popupIndex = parseInt(window.name.substring(index));
} else {
popupIndex = 0;
}
@@ -78,7 +78,7 @@
}
const value = $this.val();
if (value) {
siblings.each(function () {
siblings.each(function() {
const elm = $(this);
elm.attr('href', elm.attr('data-href-template').replace('__fk__', value));
});
@@ -98,7 +98,7 @@
const modelName = path.split('/')[path.split('/').length - (objId ? 4 : 3)];
const selectsRelated = document.querySelectorAll(`[data-model-ref="${modelName}"] select`);
selectsRelated.forEach(function (select) {
selectsRelated.forEach(function(select) {
if (currentSelect === select) {
return;
}
@@ -150,14 +150,14 @@
const id = removePopupIndex(win.name.replace(/^edit_/, ''));
const selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
const selects = $(selectsSelector);
selects.find('option').each(function () {
selects.find('option').each(function() {
if (this.value === objId) {
this.textContent = newRepr;
this.value = newId;
}
}).trigger('change');
updateRelatedSelectsOptions(selects[0], win, objId, newRepr, newId);
selects.next().find('.select2-selection__rendered').each(function () {
selects.next().find('.select2-selection__rendered').each(function() {
// The element can have a clear button as a child.
// Use the lastChild to modify only the displayed value.
this.lastChild.textContent = newRepr;
@@ -174,7 +174,7 @@
const id = removePopupIndex(win.name.replace(/^delete_/, ''));
const selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
const selects = $(selectsSelector);
selects.find('option').each(function () {
selects.find('option').each(function() {
if (this.value === objId) {
$(this).remove();
}
@@ -199,17 +199,17 @@
window.showAddAnotherPopup = showRelatedObjectPopup;
window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
window.addEventListener('unload', function (evt) {
window.addEventListener('unload', function(evt) {
window.dismissChildPopups();
});
$(document).ready(function () {
$(document).ready(function() {
setPopupIndex();
$("a[data-popup-opener]").on('click', function (event) {
$("a[data-popup-opener]").on('click', function(event) {
event.preventDefault();
opener.dismissRelatedLookupPopup(window, $(this).data("popup-opener"));
});
$('body').on('click', '.related-widget-wrapper-link[data-popup="yes"]', function (e) {
$('body').on('click', '.related-widget-wrapper-link[data-popup="yes"]', function(e) {
e.preventDefault();
if (this.href) {
const event = $.Event('django:show-related', {href: this.href});

View File

@@ -21,7 +21,7 @@
return this;
};
$(function () {
$(function() {
// Initialize all autocomplete widgets except the one in the template
// form used when a new formset is added.
$('.admin-autocomplete').not('[name*=__prefix__]').djangoAdminSelect2();

View File

@@ -12,11 +12,8 @@
event.preventDefault();
if (submitted) {
const answer = window.confirm(gettext('You have already submitted this form. Are you sure you want to submit it again?'));
if (!answer) {
return;
}
}
;
if (!answer) {return;}
};
event.target.submit();
submitted = true;
});

View File

@@ -0,0 +1,22 @@
(function($) {
$(document).ready(function() {
var $actionsSelect, $formatsElement;
if ($('body').hasClass('grp-change-list')) {
// using grappelli
$actionsSelect = $('#grp-changelist-form select[name="action"]');
$formatsElement = $('#grp-changelist-form select[name="file_format"]');
} else {
// using default admin
$actionsSelect = $('#changelist-form select[name="action"]');
$formatsElement = $('#changelist-form select[name="file_format"]').parent();
}
$actionsSelect.change(function() {
if ($(this).val() === 'export_admin_action') {
$formatsElement.show();
} else {
$formatsElement.hide();
}
});
$actionsSelect.change();
});
})(django.jQuery);

115
static/import_export/import.css vendored Normal file
View File

@@ -0,0 +1,115 @@
.import-preview .errors {
position: relative;
}
.validation-error-count {
display: inline-block;
background-color: #e40000;
border-radius: 6px;
color: white;
font-size: 0.9em;
position: relative;
font-weight: bold;
margin-top: -2px;
padding: 0.2em 0.4em;
}
.validation-error-container {
position: absolute;
opacity: 0;
pointer-events: none;
background-color: #ffc1c1;
padding: 14px 15px 10px;
top: 25px;
margin: 0 0 20px 0;
width: 200px;
z-index: 2;
}
table.import-preview tr.skip {
background-color: #d2d2d2;
}
table.import-preview tr.new {
background-color: #bdd8b2;
}
table.import-preview tr.delete {
background-color: #f9bebf;
}
table.import-preview tr.update {
background-color: #fdfdcf;
}
.import-preview td:hover .validation-error-count {
z-index: 3;
}
.import-preview td:hover .validation-error-container {
opacity: 1;
pointer-events: auto;
}
.validation-error-list {
margin: 0;
padding: 0;
}
.validation-error-list li {
list-style: none;
margin: 0;
}
.validation-error-list > li > ul {
margin: 8px 0;
padding: 0;
}
.validation-error-list > li > ul > li {
padding: 0;
margin: 0 0 10px;
line-height: 1.28em;
}
.validation-error-field-label {
display: block;
border-bottom: 1px solid #e40000;
color: #e40000;
text-transform: uppercase;
font-weight: bold;
font-size: 0.85em;
}
@media (prefers-color-scheme: dark) {
table.import-preview tr.skip {
background-color: #2d2d2d;
}
table.import-preview tr.new {
background-color: #42274d;
}
table.import-preview tr.delete {
background-color: #064140;
}
table.import-preview tr.update {
background-color: #020230;
}
.validation-error-container {
background-color: #003e3e;
}
/*
these declarations are necessary to forcibly override the
formatting applied by the diff-match-patch python library
*/
table.import-preview td ins {
background-color: #190019 !important;
}
table.import-preview td del {
background-color: #001919 !important;
}
}