forked from deblan/side_menu
format code
This commit is contained in:
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 v-if="section === 'cats'">
|
||||
<table width="100%" v-if="!newCustomCategory && editCustomCategoryKey === null">
|
||||
<table
|
||||
v-if="!newCustomCategory && editCustomCategoryKey === null"
|
||||
width="100%"
|
||||
>
|
||||
<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 width="50px">
|
||||
<NcActions>
|
||||
|
|
@ -66,10 +72,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div v-else class="form">
|
||||
<div
|
||||
v-else
|
||||
class="form"
|
||||
>
|
||||
<template v-if="newCustomCategory">
|
||||
<NcTextField
|
||||
v-for="lang in langs"
|
||||
:key="lang"
|
||||
v-model="newCustomCategory[lang]"
|
||||
:label="lang"
|
||||
/>
|
||||
|
|
@ -77,6 +87,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<template v-if="editCustomCategoryKey !== null">
|
||||
<NcTextField
|
||||
v-for="lang in langs"
|
||||
:key="lang"
|
||||
v-model="categoriesCustom[editCustomCategoryKey][lang]"
|
||||
:label="lang"
|
||||
/>
|
||||
|
|
@ -87,7 +98,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<div v-if="section === 'apps'">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr v-for="item in apps" :key="key">
|
||||
<tr
|
||||
v-for="item in apps"
|
||||
:key="item.id"
|
||||
>
|
||||
<td>
|
||||
<img
|
||||
:src="item.icon"
|
||||
|
|
@ -135,21 +149,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<NcActions>
|
||||
<NcActionButton
|
||||
v-if="!newCustomCategory && editCustomCategoryKey === null"
|
||||
@click="addCustomCategory"
|
||||
icon="icon-add"
|
||||
@click="addCustomCategory"
|
||||
></NcActionButton>
|
||||
<NcActionButton
|
||||
v-if="editCustomCategoryKey !== null"
|
||||
@click="saveCustomCategory"
|
||||
icon="icon-checkmark"
|
||||
@click="saveCustomCategory"
|
||||
></NcActionButton>
|
||||
</NcActions>
|
||||
</template>
|
||||
</template>
|
||||
<NcButton
|
||||
variant="primary"
|
||||
@click="closeModal"
|
||||
class="btn-close"
|
||||
@click="closeModal"
|
||||
>
|
||||
{{ t('side_menu', 'Close') }}
|
||||
</NcButton>
|
||||
|
|
@ -222,7 +236,7 @@ const saveCustomCategory = () => {
|
|||
const data = categoriesCustom
|
||||
|
||||
if (editCustomCategoryKey.value === null) {
|
||||
data.push({...newCustomCategory.value})
|
||||
data.push({ ...newCustomCategory.value })
|
||||
}
|
||||
|
||||
emit('update:categoriesCustom', data)
|
||||
|
|
@ -246,11 +260,11 @@ const getOptions = (custom) => {
|
|||
const data = []
|
||||
|
||||
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) => {
|
||||
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))
|
||||
|
|
@ -258,9 +272,12 @@ const getOptions = (custom) => {
|
|||
return data
|
||||
}
|
||||
|
||||
watch(() => appsCategoriesCustomNext, (value) => {
|
||||
console.log(value)
|
||||
})
|
||||
watch(
|
||||
() => appsCategoriesCustomNext,
|
||||
(value) => {
|
||||
console.log(value)
|
||||
},
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
apps.value = await navStore.getApps()
|
||||
|
|
@ -303,7 +320,8 @@ td {
|
|||
padding: 5px 0;
|
||||
}
|
||||
|
||||
tr:hover, td:hover {
|
||||
tr:hover,
|
||||
td:hover {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
v-model="model"
|
||||
:multiple="multiple"
|
||||
>
|
||||
<option :value="null" v-if="!required"></option>
|
||||
<option
|
||||
v-if="!required"
|
||||
:value="null"
|
||||
></option>
|
||||
<option
|
||||
v-for="option in options"
|
||||
:key="option.id"
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
:langs="config['langs']"
|
||||
:categories-custom="config['categories-custom']"
|
||||
:apps-categories-custom="config['apps-categories-custom']"
|
||||
|
||||
@update:categories-custom="(value) => (config['categories-custom'] = value)"
|
||||
@update:apps-categories-custom="(value) => (config['apps-categories-custom'] = value)"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -264,4 +264,3 @@
|
|||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue