format code

This commit is contained in:
Simon Vieille
2025-04-13 15:19:12 +02:00
parent 89ca510897
commit 0bf7eada4c
4 changed files with 36 additions and 17 deletions
@@ -47,9 +47,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div> </div>
<div v-if="section === 'cats'"> <div v-if="section === 'cats'">
<table width="100%" v-if="!newCustomCategory && editCustomCategoryKey === null"> <table
v-if="!newCustomCategory && editCustomCategoryKey === null"
width="100%"
>
<tbody> <tbody>
<tr v-for="(item, key) in categoriesCustom" :key="key"> <tr
v-for="(item, key) in categoriesCustom"
:key="key"
>
<td>{{ item[langs[0]] }}</td> <td>{{ item[langs[0]] }}</td>
<td width="50px"> <td width="50px">
<NcActions> <NcActions>
@@ -66,10 +72,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div v-else class="form"> <div
v-else
class="form"
>
<template v-if="newCustomCategory"> <template v-if="newCustomCategory">
<NcTextField <NcTextField
v-for="lang in langs" v-for="lang in langs"
:key="lang"
v-model="newCustomCategory[lang]" v-model="newCustomCategory[lang]"
:label="lang" :label="lang"
/> />
@@ -77,6 +87,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template v-if="editCustomCategoryKey !== null"> <template v-if="editCustomCategoryKey !== null">
<NcTextField <NcTextField
v-for="lang in langs" v-for="lang in langs"
:key="lang"
v-model="categoriesCustom[editCustomCategoryKey][lang]" v-model="categoriesCustom[editCustomCategoryKey][lang]"
:label="lang" :label="lang"
/> />
@@ -87,7 +98,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div v-if="section === 'apps'"> <div v-if="section === 'apps'">
<table width="100%"> <table width="100%">
<tbody> <tbody>
<tr v-for="item in apps" :key="key"> <tr
v-for="item in apps"
:key="item.id"
>
<td> <td>
<img <img
:src="item.icon" :src="item.icon"
@@ -135,21 +149,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<NcActions> <NcActions>
<NcActionButton <NcActionButton
v-if="!newCustomCategory && editCustomCategoryKey === null" v-if="!newCustomCategory && editCustomCategoryKey === null"
@click="addCustomCategory"
icon="icon-add" icon="icon-add"
@click="addCustomCategory"
></NcActionButton> ></NcActionButton>
<NcActionButton <NcActionButton
v-if="editCustomCategoryKey !== null" v-if="editCustomCategoryKey !== null"
@click="saveCustomCategory"
icon="icon-checkmark" icon="icon-checkmark"
@click="saveCustomCategory"
></NcActionButton> ></NcActionButton>
</NcActions> </NcActions>
</template> </template>
</template> </template>
<NcButton <NcButton
variant="primary" variant="primary"
@click="closeModal"
class="btn-close" class="btn-close"
@click="closeModal"
> >
{{ t('side_menu', 'Close') }} {{ t('side_menu', 'Close') }}
</NcButton> </NcButton>
@@ -222,7 +236,7 @@ const saveCustomCategory = () => {
const data = categoriesCustom const data = categoriesCustom
if (editCustomCategoryKey.value === null) { if (editCustomCategoryKey.value === null) {
data.push({...newCustomCategory.value}) data.push({ ...newCustomCategory.value })
} }
emit('update:categoriesCustom', data) emit('update:categoriesCustom', data)
@@ -246,11 +260,11 @@ const getOptions = (custom) => {
const data = [] const data = []
custom.forEach((item) => { custom.forEach((item) => {
data.push({id: item.id, label: item[langs[0]]}) data.push({ id: item.id, label: item[langs[0]] })
}) })
categories.value.forEach((item) => { categories.value.forEach((item) => {
data.push({id: item.categoryId, label: item.name !== '' ? item.name : t('side_menu', 'Other')}) data.push({ id: item.categoryId, label: item.name !== '' ? item.name : t('side_menu', 'Other') })
}) })
data.sort((a, b) => (a.label < b.label ? -1 : 1)) data.sort((a, b) => (a.label < b.label ? -1 : 1))
@@ -258,9 +272,12 @@ const getOptions = (custom) => {
return data return data
} }
watch(() => appsCategoriesCustomNext, (value) => { watch(
console.log(value) () => appsCategoriesCustomNext,
}) (value) => {
console.log(value)
},
)
onMounted(async () => { onMounted(async () => {
apps.value = await navStore.getApps() apps.value = await navStore.getApps()
@@ -303,7 +320,8 @@ td {
padding: 5px 0; padding: 5px 0;
} }
tr:hover, td:hover { tr:hover,
td:hover {
background: none !important; background: none !important;
} }
+4 -1
View File
@@ -22,7 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
v-model="model" v-model="model"
:multiple="multiple" :multiple="multiple"
> >
<option :value="null" v-if="!required"></option> <option
v-if="!required"
:value="null"
></option>
<option <option
v-for="option in options" v-for="option in options"
:key="option.id" :key="option.id"
-1
View File
@@ -207,7 +207,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
:langs="config['langs']" :langs="config['langs']"
:categories-custom="config['categories-custom']" :categories-custom="config['categories-custom']"
:apps-categories-custom="config['apps-categories-custom']" :apps-categories-custom="config['apps-categories-custom']"
@update:categories-custom="(value) => (config['categories-custom'] = value)" @update:categories-custom="(value) => (config['categories-custom'] = value)"
@update:apps-categories-custom="(value) => (config['apps-categories-custom'] = value)" @update:apps-categories-custom="(value) => (config['apps-categories-custom'] = value)"
/> />
-1
View File
@@ -264,4 +264,3 @@
flex-direction: column; flex-direction: column;
gap: 6px; gap: 6px;
} }