From 8041cdee1a56e3f3959ee0ac85a96c4f8b57e3f7 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 5 Dec 2025 10:27:29 +0100 Subject: [PATCH 1/2] Fix dialog for iframe --- htdocs/public/webportal/css/btn.css | 56 ++++++++++++ htdocs/public/webportal/css/dialog.css | 90 +++++++++++++++++++ htdocs/public/webportal/css/style.css.php | 2 + htdocs/public/webportal/tpl/footer.tpl.php | 62 ++++++++----- htdocs/public/webportal/tpl/header.tpl.php | 16 +++- .../abstractcard.controller.class.php | 5 +- 6 files changed, 206 insertions(+), 25 deletions(-) create mode 100644 htdocs/public/webportal/css/btn.css create mode 100644 htdocs/public/webportal/css/dialog.css diff --git a/htdocs/public/webportal/css/btn.css b/htdocs/public/webportal/css/btn.css new file mode 100644 index 00000000000..035d55a143f --- /dev/null +++ b/htdocs/public/webportal/css/btn.css @@ -0,0 +1,56 @@ + +/* + * BUTTON With Low emphasis + */ + +button.btn-low-emphasis{ + text-align: center; + display: inline-block; + border: none; + outline: none; + cursor: pointer; + margin: 0; + padding: 0; + width: auto; + min-width: 1.5em; + min-height: 1.5em; + line-height: 1.5em; + + overflow: visible; + background: transparent; + background-position: center; /* used for hover ripple effect */ + background-size: 0%; + color: var(--colortextlink, inherit); + font: inherit; + line-height: normal; + + /* Corrects font smoothing for webkit */ + -webkit-font-smoothing: inherit; + -moz-osx-font-smoothing: inherit; + + /* Corrects inability to style clickable input types in iOS */ + -webkit-appearance: none; + + + transition: background 0.8s;/* used for hover ripple effect */ + background: transparent radial-gradient(circle, transparent 1%, hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1) 1%, transparent 10%) center/15000%; +} + +button.btn-low-emphasis.--btn-icon{ + border-radius: 100%; +} + +button.btn-low-emphasis :is(.fa, .fas){ + color: var(--colortextlink, inherit); + opacity: 0.4; +} + +button.btn-low-emphasis:is(:focus,:hover) :is(.fa, .fas){ + opacity: 0.8; +} + +button.btn-low-emphasis.--btn-icon:active { + background-color: hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1); + background-size: 100%; + transition: background 0s;/* used for hover ripple effect */ +} diff --git a/htdocs/public/webportal/css/dialog.css b/htdocs/public/webportal/css/dialog.css new file mode 100644 index 00000000000..1a84db8b600 --- /dev/null +++ b/htdocs/public/webportal/css/dialog.css @@ -0,0 +1,90 @@ +/* Dialog container */ +.dialog-full-screen article { + width: 80vw; + max-width: 95vw; + height: 90vh; + max-height: 95vh; + + position: fixed; + margin: 0 auto; + + display: flex; + flex-direction: column; + flex-wrap: nowrap; + justify-content: normal; + align-items: normal; + align-content: normal; +} + +.dialog-full-screen article:has(.dialog-header) { + padding: 0; +} + + +.dialog-full-screen article .dialog-body { + display: block; + flex-grow: 2; + flex-shrink: 1; + flex-basis: auto; + align-self: auto; + order: 0; +} + +@media (min-width: 576px) { + dialog.dialog-full-screen article { + max-width: 95%; + } +} +@media (min-width: 768px) { + dialog.dialog-full-screen article { + max-width: 95%; + } +} + +/* Iframe */ +.dialog-iframe { + border: none; + width: 100%; + height: 100%; +} + + + +/*!* Header *!*/ +.dialog-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0.5em 1em; + border-bottom: 1px solid rgba(0,0,0,0.1); +} + +.dialog-header-title-container { + flex: 1; + overflow: hidden; +} + +.dialog-header-title { + margin: 0; + text-overflow: ellipsis; + overflow: hidden; +} + +.dialog-header-action-container { + flex: 0 0 auto; + white-space: nowrap; + display: flex; + flex-direction: row-reverse; + gap: 0.5em; +} + +/* Header title */ +.dialog-header h2 { + margin: 0; + font-size: 1.2em; +} + +/* Close button */ +.dialog-header-btn.dialog-close-btn { + font-size: 1.2em; +} diff --git a/htdocs/public/webportal/css/style.css.php b/htdocs/public/webportal/css/style.css.php index 84b52b4c378..1e034f2ae97 100644 --- a/htdocs/public/webportal/css/style.css.php +++ b/htdocs/public/webportal/css/style.css.php @@ -99,6 +99,8 @@ if (empty($dolibarr_nocache)) { @import "badges.css"; @import "title-buttons.css"; @import "nav.css"; +@import "dialog.css"; +@import "btn.css"; /** This file can overwrite default pico css */ diff --git a/htdocs/public/webportal/tpl/footer.tpl.php b/htdocs/public/webportal/tpl/footer.tpl.php index 75f0a7e1c3d..48634cd4656 100644 --- a/htdocs/public/webportal/tpl/footer.tpl.php +++ b/htdocs/public/webportal/tpl/footer.tpl.php @@ -117,44 +117,60 @@ if (empty($conf->browser->layout) || $conf->browser->layout != 'phone') { ?> jQuery(document).ready(function () { jQuery(".modal_card").click(function (event) { console.log("We click on card link for element with href=" + $(this).attr('href')); - modal_card($(this).attr('href')); + const modalTitle = $(this).data('modal-title') || $(this).attr('title') || ''; + modal_card($(this).attr('href'), modalTitle); event.preventDefault(); return false; }); }); /** - * Function show modal card. It uses the "modal" function. + * Show modal card using Pico.css modal system * - * @param url Url - * @param title Dialog box title - * @return void - * @see newpopup() + * @param {string} url - URL to load in the iframe + * @param {string} title - Modal title */ - function modal_card(url, title) { - console.log("modal_card A click was done: url=" + url); + function modal_card(url, title = '') { + console.log("modal_card called: url=" + url); - let width = "85%"; - let object_width = '100%'; - let height = ($(window).height() - 60) * 0.90; - let object_height = '98%'; - let newElem = ''; + const modal = document.getElementById('modalforcard'); // Pico.css modal container + if (!modal) { + console.error('Modal container not found'); + return; + } - $('#modalforcard article').css('width', width).css('height', height).html(newElem); - let modal = document.getElementById('modalforcard'); + // Insert structured modal content + modal.querySelector('article').innerHTML = ` +