[FIX] web: list-specific binary field design

Instead of sho-horning full buttons inside a list view cell, use inline
buttons instead.

closes odoo/odoo#129679

X-original-commit: 76a4995b5037957bb5d7b1b2e04c44267273f7fc
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
This commit is contained in:
Damien Bouvy
2023-07-26 09:22:24 +02:00
parent b7a742cc7e
commit f6dea9b6fe
2 changed files with 36 additions and 1 deletions
@@ -62,6 +62,15 @@ export class BinaryField extends Component {
}
}
export class ListBinaryField extends BinaryField {
static template = "web.ListBinaryField";
}
export const listBinaryField = {
...BinaryField,
component: ListBinaryField,
};
export const binaryField = {
component: BinaryField,
displayName: _lt("File"),
@@ -80,3 +89,4 @@ export const binaryField = {
};
registry.category("fields").add("binary", binaryField);
registry.category("fields").add("list.binary", listBinaryField);
@@ -11,7 +11,7 @@
>
<t t-if="props.record.resId">
<button
class="btn btn-secondary btn-sm lh-1"
class="btn btn-secondary btn-sm lh-1 o_download_file_button"
data-tooltip="Download"
aria-label="Download"
t-on-click="onFileDownload"
@@ -61,4 +61,29 @@
</t>
</t>
<t t-name="web.ListBinaryField" t-inherit="web.BinaryField" owl="1">
<xpath expr="//label[hasclass('o_select_file_button')]" position="replace">
<label class="o_select_file_button btn btn-sm btn-link p-0">
<FileUploader
acceptedFileExtensions="props.acceptedFileExtensions"
onUploaded.bind="update"
>
<t t-set-slot="toggler">
<i class="fa fa-upload fa-fw"/> Upload your file
</t>
</FileUploader>
</label>
</xpath>
<xpath expr="//button[hasclass('o_download_file_button')]" position="attributes">
<attribute name="class">btn btn-sm btn-link fa fa-download o_download_file_button</attribute>
</xpath>
<xpath expr="//button[hasclass('o_select_file_button')]" position="attributes">
<attribute name="class">btn btn-sm btn-link fa fa-pencil o_select_file_button</attribute>
</xpath>
<xpath expr="//button[hasclass('o_clear_file_button')]" position="attributes">
<attribute name="class">btn btn-sm btn-link fa fa-trash o_clear_file_button</attribute>
</xpath>
</t>
</templates>