toodego: make compatible custom widget file preview with native preview (#84688)
gitea/publik-base-theme/pipeline/head This commit looks good Details

This commit is contained in:
Thomas Jund 2024-02-15 10:21:28 +01:00 committed by Thomas Jund
parent 5e0c2084dd
commit 62932d7a38
2 changed files with 6 additions and 20 deletions

View File

@ -9,6 +9,7 @@ div.file-upload-widget {
} }
} }
&.has-file div.file-button { &.has-file div.file-button {
background-image: linear-gradient(rgba(250, 250, 250, 0.8), rgba(250, 250, 250, 0.8)), var(--image-preview-url);
background-size: contain; background-size: contain;
} }
div.file-button.file-image { div.file-button.file-image {
@ -19,15 +20,15 @@ div.file-upload-widget {
&::before { &::before {
content: ""; content: "";
background: url(img/photo-add.png) 50% 0px no-repeat; background: url(img/photo-add.png) 50% 0px no-repeat;
box-sizing: content-box; height: 70px;
height: 40px; }
&.upload-done {
background-color: transparent;
padding-top: 30px;
} }
} }
} }
&.has-file div.file-button.file-image { &.has-file div.file-button.file-image {
div.widget-message {
background: rgba(250, 250, 250, 0.8);
}
div.widget-message::before { div.widget-message::before {
background-image: url(img/photo-done.png); background-image: url(img/photo-done.png);
} }
@ -40,9 +41,6 @@ div.file-upload-widget {
background: $red; background: $red;
} }
} }
div.fileinfo {
background: rgba(250, 250, 250, 0.8);
}
} }
div.xtemplate-photo { div.xtemplate-photo {
div.hint { div.hint {

View File

@ -898,18 +898,6 @@ $(function() {
$('div.buttons div.cancel-button button').text('Continuer').css('margin-right', '0'); $('div.buttons div.cancel-button button').text('Continuer').css('margin-right', '0');
} }
/* photo upload, add a preview */
$('.file-button.file-image').on('wcs:image-blob', function(ev, file) {
var $widget = $(this);
if (file) {
var reader = new FileReader();
reader.onload = function(e) {
$widget[0].style.backgroundImage = 'url(' + e.target.result + ')';
}
reader.readAsDataURL(file);
}
});
/* custom checkboxes intertitles for publik notification */ /* custom checkboxes intertitles for publik notification */
$('.template-pn-thematiques').each(function(idx, elem) { $('.template-pn-thematiques').each(function(idx, elem) {
const titles = Array(); const titles = Array();