diff --git a/conf.py b/conf.py index 74701999f..b1c68209a 100644 --- a/conf.py +++ b/conf.py @@ -48,6 +48,10 @@ exclude_patterns = [ # See https://docutils.sourceforge.io/docs/ref/rst/roles.html#standard-roles for other roles. default_role = 'literal' + +# Whether scaled down images should be be wrapped in a `` tag linking to the image file or not. +html_scaled_image_link = False + # If true, '()' will be appended to :func: etc. cross-reference text add_function_parentheses = True diff --git a/extensions/odoo_theme/static/js/layout.js b/extensions/odoo_theme/static/js/layout.js index 8f995a515..d82cd0097 100644 --- a/extensions/odoo_theme/static/js/layout.js +++ b/extensions/odoo_theme/static/js/layout.js @@ -3,9 +3,29 @@ document.addEventListener('DOMContentLoaded', function () { const content = document.getElementById('o_content'); - // Enforce the presence of the `img-fluid` class on all images in the body. + let imageModalId = 0; content.querySelectorAll('img').forEach(image => { + // Enforce the presence of the `img-fluid` class on all images. image.classList.add('img-fluid'); + + // Add a modal to each image. + const modalContainer = document.createElement('div'); + modalContainer.classList.add('o_image_modal'); + modalContainer.innerHTML = ` + `; + image.parentNode.append(modalContainer); + image.setAttribute('data-bs-toggle', 'modal'); + image.setAttribute('data-bs-target', `#modal-${imageModalId}`); + imageModalId++; }); // Make all external links open in a new tab by default. diff --git a/extensions/odoo_theme/static/scss/bootstrap_overridden.scss b/extensions/odoo_theme/static/scss/bootstrap_overridden.scss index b832fe332..7094ece0c 100644 --- a/extensions/odoo_theme/static/scss/bootstrap_overridden.scss +++ b/extensions/odoo_theme/static/scss/bootstrap_overridden.scss @@ -19,6 +19,11 @@ $h6-font-size: $font-size-secondary; $btn-font-size: $font-size-secondary; $btn-font-weight: $fw_semibold; $btn-focus-box-shadow: 0 0 0 transparent; +$btn-close-bg: url('data:image/svg+xml,'); +$btn-close-width: 2rem; // Dropdowns -$dropdown-min-width: 4.5rem; \ No newline at end of file +$dropdown-min-width: 4.5rem; + +// Modals +$modal-backdrop-opacity: .7; diff --git a/extensions/odoo_theme/static/style.scss b/extensions/odoo_theme/static/style.scss index e57e20ea1..d8043ba3b 100644 --- a/extensions/odoo_theme/static/style.scss +++ b/extensions/odoo_theme/static/style.scss @@ -704,6 +704,7 @@ header { border: 1px solid $gray-lighter; background: $white; padding: .5rem; + cursor: pointer; } img:not([alt="green"]):not([alt="orange"]):not([alt="red"]), iframe { @@ -1096,6 +1097,25 @@ header { } } +//------------------------------------------------------------------------------ +// Image modals +//------------------------------------------------------------------------------ + +.o_image_modal { + .modal-dialog { + max-width: fit-content; + } + .modal-content { + background-color: transparent; + border: none; + } + .modal-body { + padding: 2.2rem; + } + .btn-close { + @include o-position-absolute($top: 0); + } +} //------------------------------------------------------------------------------ // Footer //------------------------------------------------------------------------------