|
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<!-- |
| 3 | + Copyright 2020 Creu Blanca |
| 4 | + Copyright 2017-2019 MuK IT GmbH |
| 5 | + Copyright 2024 Subteno - Timothée Vannier (https://www.subteno.com). |
| 6 | + License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
| 7 | +--> |
2 | 8 | <templates> |
| 9 | + <!-- |
| 10 | + Restores the mobile-first Scan + desktop Upload affordance that lived |
| 11 | + in the 18.0 `dms.KanbanButtons` template. The 19.0 migration deleted |
| 12 | + the prior wire-up; this template is registered as |
| 13 | + `FileKanbanView.buttonTemplate` so the toolbar still ships an upload |
| 14 | + path even when drag-and-drop is unavailable (touch devices). |
| 15 | +
|
| 16 | + Refs/handlers come from `createFileUploadExtension()` patched onto |
| 17 | + `KanbanController.prototype` in `file_kanban_view.esm.js`: |
| 18 | +
|
| 19 | + - `fileInput` — hidden <input type="file"> |
| 20 | + - `uploadDocument()` — programmatically clicks the input |
| 21 | + - `onChangeFileInput()` — uploads the picked files |
| 22 | + --> |
3 | 23 | <t |
4 | 24 | t-name="dms.FileKanbanView.Buttons" |
5 | 25 | t-inherit="web.KanbanView.Buttons" |
6 | 26 | t-inherit-mode="primary" |
7 | 27 | > |
8 | | - <div role="toolbar" position="inside"> |
9 | | - <input |
10 | | - type="file" |
11 | | - multiple="true" |
12 | | - t-ref="uploadFileInput" |
13 | | - class="o_input_file o_hidden" |
14 | | - t-on-change.stop="onFileInputChange" |
15 | | - /> |
16 | | - <button |
17 | | - type="button" |
18 | | - t-attf-class="btn btn-primary o_file_kanban_upload" |
19 | | - t-on-click.stop.prevent="() => this.uploadFileInputRef.el.click()" |
20 | | - > |
21 | | - Upload |
22 | | - </button> |
23 | | - </div> |
| 28 | + <xpath expr="//div" position="inside"> |
| 29 | + <t t-if="props.archInfo.activeActions.create"> |
| 30 | + <button |
| 31 | + type="button" |
| 32 | + class="d-inline d-md-none btn btn-primary mx-1" |
| 33 | + t-on-click.prevent="uploadDocument" |
| 34 | + > |
| 35 | + Scan |
| 36 | + </button> |
| 37 | + <input |
| 38 | + type="file" |
| 39 | + name="ufile" |
| 40 | + class="d-none" |
| 41 | + t-ref="fileInput" |
| 42 | + multiple="1" |
| 43 | + accept="*" |
| 44 | + t-on-change="onChangeFileInput" |
| 45 | + /> |
| 46 | + <button |
| 47 | + type="button" |
| 48 | + class="d-none d-md-inline btn btn-primary mx-1" |
| 49 | + t-on-click.prevent="uploadDocument" |
| 50 | + > |
| 51 | + Upload |
| 52 | + </button> |
| 53 | + </t> |
| 54 | + </xpath> |
24 | 55 | </t> |
25 | 56 | </templates> |
0 commit comments