Merge pull request #4672 from nextcloud/fix/global-templates-filepicker-limit

fix: accepted global templates file types
This commit is contained in:
Elizabeth Danzberger 2025-04-14 15:34:52 -04:00 committed by GitHub
commit 81bb3e6c94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,10 +5,12 @@
<template>
<NcSettingsSection v-if="templatesAvailable"
:name="t('richdocuments', 'Global Templates')">
:name="t('richdocuments', 'Global Templates')"
:description="description">
<input ref="newTemplateInput"
type="file"
class="hidden-visually"
:accept="acceptedFileExtensions"
@change="selectFile">
<div class="template-buttons">
@ -66,9 +68,35 @@ export default {
return {
existingTemplates: [],
templatesAvailable: false,
templateExtensions: [
'.ott', '.otg', '.otp', '.ots',
'.dot', '.dotx',
'.xlt', '.xltx',
'.pot', '.potx',
],
}
},
computed: {
acceptedFileExtensions() {
return this.templateExtensions.join(', ')
},
description() {
return t(
'richdocuments',
'Accepted file types: {accepts}',
{
/*
* TRANSLATORS
* The file extensions will be displayed as
* .ott, .otg, .otp, .ots, and so on
*/
accepts: this.acceptedFileExtensions,
},
)
},
},
mounted() {
// Later maybe we can retrieve these settings from AdminSettings.vue`
// and pass them in as props (once AdminSettings is cleaned up)
@ -153,6 +181,10 @@ $padding: calc(var(--default-grid-baseline) * 3);
display: grid;
gap: calc(var(--default-grid-baseline) * 4);
grid-template-columns: repeat(auto-fit, 175px);
button {
padding: 0 !important;
}
}
.template-btn {