format code

This commit is contained in:
Simon Vieille
2025-04-13 20:33:03 +02:00
parent fdd8f8850d
commit b835bbb34d
7 changed files with 74 additions and 56 deletions
+20 -18
View File
@@ -3,25 +3,20 @@
<NcButton
variant="success"
@click="save"
>
<template v-if="!loading">
{{ t('side_menu', 'Save') }}
</template>
<NcLoadingIcon v-else />
>
<template v-if="!loading">
{{ t('side_menu', 'Save') }}
</template>
<NcLoadingIcon v-else />
</NcButton>
<div v-if="error" id="error">
</div>
<div
v-if="error"
id="error"
></div>
</div>
</template>
<style scoped>
#error {
padding-top: 10px;
color: red;
}
</style>
<script setup>
import { NcButton, NcLoadingIcon } from '@nextcloud/vue'
import { ref } from 'vue'
@@ -56,7 +51,7 @@ const save = async () => {
error.value = null
const update = () => {
++counter;
++counter
if (counter === size) {
loading.value = false
@@ -70,9 +65,9 @@ const save = async () => {
for (let key in data) {
let value = data[key]
if (Array.isArray(value) || typeof(value) === 'object') {
if (Array.isArray(value) || typeof value === 'object') {
value = JSON.stringify(value)
} else if (typeof(value) === 'boolean') {
} else if (typeof value === 'boolean') {
value = value ? 1 : 0
}
@@ -83,8 +78,15 @@ const save = async () => {
error() {
error.value = `Error while saving ${key}`
update()
}
},
})
}
}
</script>
<style scoped>
#error {
padding-top: 10px;
color: red;
}
</style>
+8 -8
View File
@@ -17,24 +17,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template>
<div
class="side-menu-setting-row"
:class="{'side-menu-setting-row--disabled': disabled }"
:class="{ 'side-menu-setting-row--disabled': disabled }"
>
<slot></slot>
</div>
</template>
<style scoped>
.disabled {
display: block;
}
</style>
<script setup>
const { disabled } = defineProps({
disabled: {
type: Boolean,
required: false,
default: false,
}
},
})
</script>
<style scoped>
.disabled {
display: block;
}
</style>
+19 -17
View File
@@ -3,25 +3,20 @@
<NcButton
variant="success"
@click="save"
>
<template v-if="!loading">
{{ t('side_menu', 'Save') }}
</template>
<NcLoadingIcon v-else />
>
<template v-if="!loading">
{{ t('side_menu', 'Save') }}
</template>
<NcLoadingIcon v-else />
</NcButton>
<div v-if="error" id="error">
</div>
<div
v-if="error"
id="error"
></div>
</div>
</template>
<style scoped>
#error {
padding-top: 10px;
color: red;
}
</style>
<script setup>
import { NcButton, NcLoadingIcon } from '@nextcloud/vue'
import { ref } from 'vue'
@@ -56,7 +51,7 @@ const save = async () => {
error.value = null
const update = () => {
++counter;
++counter
if (counter === size) {
loading.value = false
@@ -71,9 +66,9 @@ const save = async () => {
let value = data[key]
let formData = []
if (Array.isArray(value) || typeof(value) === 'object') {
if (Array.isArray(value) || typeof value === 'object') {
value = JSON.stringify(value)
} else if (typeof(value) === 'boolean') {
} else if (typeof value === 'boolean') {
value = value ? 1 : 0
}
@@ -95,3 +90,10 @@ const save = async () => {
}
}
</script>
<style scoped>
#error {
padding-top: 10px;
color: red;
}
</style>
+4 -1
View File
@@ -35,7 +35,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
@end="update"
>
<template #item="{ element }">
<div class="draggable" v-if="element.name !== ''">
<div
v-if="element.name !== ''"
class="draggable"
>
<span class="arrow">⇅</span>
{{ element.name }}
</div>