[IMP] web_widget_progressbar_color: Rename to web_widget_progressbar_gradient

This commit is contained in:
Denis Roussel
2024-11-14 13:33:49 +01:00
parent 9289bc8776
commit d09b4aabb8
20 changed files with 72 additions and 58 deletions

View File

@@ -0,0 +1,15 @@
/** @odoo-module
* Copyright 2024 ACSONE SA/NV
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
* **/
import {ProgressBarField} from "@web/views/fields/progress_bar/progress_bar_field";
import {registry} from "@web/core/registry";
export class ProgressBarFieldGradient extends ProgressBarField {
setup() {
super.setup();
}
}
ProgressBarFieldGradient.template =
"web_widget_progressbar_color.ProgressBarFieldGradient";
registry.category("fields").add("progressbar_gradient", ProgressBarFieldGradient);

View File

@@ -0,0 +1,19 @@
div:has(div.o_progressbar_gradient) .o_progressbar .o_progress {
position: relative;
}
.o_progressbar .o_progress .o_progressbar_gradient {
height: 100%;
/* this will do the magic for masking the gradient */
-webkit-mask: linear-gradient(#fff 0 0);
mask: linear-gradient(#fff 0 0);
}
.o_progressbar .o_progress .o_progressbar_gradient::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: linear-gradient(to right, #198754, #ffc107, #dc3545);
}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2024 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<templates xml:space="preserve">
<t
t-name="web_widget_progressbar_color.ProgressBarFieldGradient"
t-inherit="web.ProgressBarField"
t-inherit-mode="primary"
owl="1"
>
<xpath expr="//div[@t-attf-class]" position="attributes">
<attribute
name="t-attf-class"
add="{{'o_progressbar_gradient'}}"
separator=" "
/>
</xpath>
</t>
</templates>