diff options
author | Julien Veyssier <julien-nc@posteo.net> | 2023-08-01 11:43:13 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2023-08-09 10:28:00 +0200 |
commit | 52a1748a0b5663a3e6acaa68ae8ed082f226a502 (patch) | |
tree | 6e30bb31a8386d0c0ca3875a44fa61b4d97b08aa /apps/settings | |
parent | 8dee7d082ce3eacbb1bc2e0c4ed9d4333565eb5f (diff) | |
download | nextcloud-server-52a1748a0b5663a3e6acaa68ae8ed082f226a502.tar.gz nextcloud-server-52a1748a0b5663a3e6acaa68ae8ed082f226a502.zip |
move long click handlers into methods
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
(cherry picked from commit 577640663b649836731ea4fb2ab60f6b6e156553)
Diffstat (limited to 'apps/settings')
-rw-r--r-- | apps/settings/src/components/AdminAI.vue | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue index 70c9c548615..51e5c5cede6 100644 --- a/apps/settings/src/components/AdminAI.vue +++ b/apps/settings/src/components/AdminAI.vue @@ -4,9 +4,9 @@ :description="t('settings', 'Machine translation can be implemented by different apps. Here you can define the precedence of the machine translation apps you have installed at the moment.')"> <draggable v-model="settings['ai.translation_provider_preferences']" @change="saveChanges"> <div v-for="(providerClass, i) in settings['ai.translation_provider_preferences']" :key="providerClass" class="draggable__item"> - <DragVerticalIcon /> <span class="draggable__number">{{ i+1 }}</span> {{ translationProviders.find(p => p.class === providerClass)?.name }} - <NcButton aria-label="Move up" type="tertiary" @click="settings['ai.translation_provider_preferences'].splice(Math.min(i-1,0), 0, ...settings['ai.translation_provider_preferences'].splice(i, 1)); saveChanges()"><template #icon><ArrowUpIcon /></template></NcButton> - <NcButton aria-label="Move down" type="tertiary" @click="settings['ai.translation_provider_preferences'].splice(i+1, 0, ...settings['ai.translation_provider_preferences'].splice(i, 1)); saveChanges()"><template #icon><ArrowDownIcon /></template></NcButton> + <DragVerticalIcon /> <span class="draggable__number">{{ i + 1 }}</span> {{ translationProviders.find(p => p.class === providerClass)?.name }} + <NcButton aria-label="Move up" type="tertiary" @click="moveUp(i)"><template #icon><ArrowUpIcon /></template></NcButton> + <NcButton aria-label="Move down" type="tertiary" @click="moveDown(i)"><template #icon><ArrowDownIcon /></template></NcButton> </div> </draggable> </NcSettingsSection> @@ -96,6 +96,22 @@ export default { } }, methods: { + moveUp(i) { + this.settings['ai.translation_provider_preferences'].splice( + Math.min(i - 1, 0), + 0, + ...this.settings['ai.translation_provider_preferences'].splice(i, 1) + ) + this.saveChanges() + }, + moveDown(i) { + this.settings['ai.translation_provider_preferences'].splice( + i + 1, + 0, + ...this.settings['ai.translation_provider_preferences'].splice(i, 1) + ) + this.saveChanges() + }, async saveChanges() { this.loading = true const data = { settings: this.settings } |