js: Add `.impact` to `.content` if a control is automatically submitted

This commit is contained in:
Johannes Meyer 2020-10-15 17:41:57 +02:00
parent 6197d5f0af
commit 46769b9be2
2 changed files with 33 additions and 13 deletions

View File

@ -187,7 +187,8 @@ td, th {
}
.container {
&:before {
&:before,
> .content:before {
content: "";
display: block;
@ -195,26 +196,31 @@ td, th {
background-size: 4em 4em;
opacity: 0;
z-index: -10;
z-index: -1;
pointer-events: none;
.transition(none);
}
&.impact {
&.impact,
> .content.impact {
overflow: hidden;
position: relative;
&:before {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: .7;
z-index: 1;
pointer-events: all;
.transition(opacity 1s 2s linear);
}
}
&.impact:before {
position: absolute;
top: 2.5em;
right: 0;
bottom: 0;
left: 0;
opacity: .7;
z-index: 10;
pointer-events: all;
.transition(opacity 1s 2s linear);
}
}

View File

@ -181,10 +181,19 @@
}
}
var req = this.loadUrl(url, $target, data, method);
var req = this.loadUrl(url, $target, data, method, undefined, !! $autoSubmittedBy);
req.forceFocus = $autoSubmittedBy ? $autoSubmittedBy : $button.length ? $button : null;
req.addToHistory = method === 'GET';
req.progressTimer = progressTimer;
if ($autoSubmittedBy) {
if ($autoSubmittedBy.closest('.controls').length) {
$('.content', req.$target).addClass('impact');
} else {
req.$target.addClass('impact');
}
}
return req;
},
@ -851,6 +860,11 @@
// Remove 'impact' class if there was such
if (req.$target.hasClass('impact')) {
req.$target.removeClass('impact');
} else {
var $impact = req.$target.find('.impact').first();
if ($impact.length) {
$impact.removeClass('impact');
}
}
if (! req.autorefresh) {