-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
6 changed files
with
90 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// /** @odoo-module **/ | ||
import {_t} from "@web/core/l10n/translation"; | ||
import {humanNumber} from "@web/core/utils/numbers"; | ||
import publicWidget from "@web/legacy/js/public/public_widget"; | ||
|
||
publicWidget.registry.NewTicket = publicWidget.Widget.extend({ | ||
selector: "form[action='/submitted/ticket']", | ||
events: { | ||
'change input[name="attachment"]': "_onChangeAttachment", | ||
}, | ||
_onChangeAttachment(ev) { | ||
ev.preventDefault(); | ||
const attachment_input = document.getElementById("attachment"); | ||
const information_input = document.getElementById("attachment_information"); | ||
information_input.style.display = "none"; | ||
const max_upload_size = parseInt( | ||
attachment_input.getAttribute("max_upload_size"), | ||
10 | ||
); | ||
const dt = new DataTransfer(); | ||
for (const file of attachment_input.files) { | ||
if (file.size > max_upload_size) { | ||
information_input.textContent = _t( | ||
"The selected file (%sB) is over the maximum allowed file size (%sB).", | ||
humanNumber(file.size), | ||
humanNumber(max_upload_size) | ||
); | ||
information_input.style.display = ""; | ||
} else { | ||
dt.items.add(file); | ||
} | ||
} | ||
attachment_input.files = dt.files; | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters