add categories orderer
move the admin menu to the left
This commit is contained in:
@@ -16,11 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<NcButton
|
<NcButton
|
||||||
aria-label="t('side_menu', 'Sort apps')"
|
aria-label="t('side_menu', 'Sort')"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
@click="openModal"
|
@click="openModal"
|
||||||
>
|
>
|
||||||
{{ t('side_menu', 'Sort apps') }}
|
{{ t('side_menu', 'Sort') }}
|
||||||
</NcButton>
|
</NcButton>
|
||||||
|
|
||||||
<NcModal
|
<NcModal
|
||||||
@@ -114,8 +114,8 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.modal__footer {
|
.modal__footer {
|
||||||
margin-top: 20px;
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal__footer button {
|
.modal__footer button {
|
||||||
@@ -130,5 +130,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
color: var(--color-text-maxcontrast);
|
color: var(--color-text-maxcontrast);
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 3px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<!--
|
||||||
|
@license GNU AGPL version 3 or any later version
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<NcButton
|
||||||
|
aria-label="t('side_menu', 'Sort')"
|
||||||
|
variant="primary"
|
||||||
|
@click="openModal"
|
||||||
|
>
|
||||||
|
{{ t('side_menu', 'Sort') }}
|
||||||
|
</NcButton>
|
||||||
|
|
||||||
|
<NcModal
|
||||||
|
v-if="modal"
|
||||||
|
size="small"
|
||||||
|
@close="closeModal"
|
||||||
|
>
|
||||||
|
<div class="modal__content">
|
||||||
|
<draggable
|
||||||
|
v-model="apps"
|
||||||
|
item-key="categoryId"
|
||||||
|
@end="update"
|
||||||
|
>
|
||||||
|
<template #item="{ element }">
|
||||||
|
<div class="draggable">
|
||||||
|
<span class="arrow">⇅</span>
|
||||||
|
<span v-if="element.name !== ''">{{ element.name }}</span>
|
||||||
|
<span v-else>{{ t('side_menu', 'Other') }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</draggable>
|
||||||
|
|
||||||
|
<div class="modal__footer">
|
||||||
|
<NcButton
|
||||||
|
variant="primary"
|
||||||
|
@click="closeModal"
|
||||||
|
>
|
||||||
|
{{ t('side_menu', 'Close') }}
|
||||||
|
</NcButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</NcModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { NcButton, NcModal } from '@nextcloud/vue'
|
||||||
|
import { useNavStore } from '../../../store/nav.js'
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import draggable from 'vuedraggable'
|
||||||
|
|
||||||
|
const model = defineModel({ type: Array })
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
const navStore = useNavStore()
|
||||||
|
const modal = ref(false)
|
||||||
|
const apps = ref([])
|
||||||
|
|
||||||
|
const openModal = () => {
|
||||||
|
modal.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
modal.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const setApps = (items) => {
|
||||||
|
apps.value = []
|
||||||
|
|
||||||
|
model.value.forEach((id) => {
|
||||||
|
items.forEach((app) => {
|
||||||
|
if (app.categoryId === id) {
|
||||||
|
apps.value.push(app)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
items.forEach((app) => {
|
||||||
|
if (!apps.value.find((element) => element.categoryId === app.categoryId)) {
|
||||||
|
apps.value.push(app)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const update = () => {
|
||||||
|
const value = []
|
||||||
|
|
||||||
|
apps.value.forEach((app) => {
|
||||||
|
value.push(app.categoryId)
|
||||||
|
})
|
||||||
|
|
||||||
|
emit('update:modelValue', value)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const items = await navStore.getCategories()
|
||||||
|
|
||||||
|
window.setTimeout(() => {
|
||||||
|
setApps(items)
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.modal__footer {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal__footer button {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-bottom: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
color: var(--color-text-maxcontrast);
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
v-if="config"
|
v-if="config"
|
||||||
app-name="side_menu"
|
app-name="side_menu"
|
||||||
>
|
>
|
||||||
<NcAppContent>
|
<NcAppContent class="side-menu-setting-app">
|
||||||
<div class="side-menu-setting">
|
<div class="side-menu-setting">
|
||||||
<NcButton
|
<NcButton
|
||||||
v-for="item in menu"
|
v-for="item in menu"
|
||||||
@@ -31,6 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TableContainer :class="sectionClass('panel')">
|
<TableContainer :class="sectionClass('panel')">
|
||||||
|
<SectionTitle label="Panel" />
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableLabel label="Display" />
|
<TableLabel label="Display" />
|
||||||
<TableValue>
|
<TableValue>
|
||||||
@@ -101,6 +103,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|
||||||
<TableContainer :class="sectionClass('topMenu')">
|
<TableContainer :class="sectionClass('topMenu')">
|
||||||
|
<SectionTitle label="Top menu" />
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableLabel
|
<TableLabel
|
||||||
label="Applications kept in the top menu"
|
label="Applications kept in the top menu"
|
||||||
@@ -142,6 +146,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|
||||||
<TableContainer :class="sectionClass('apps')">
|
<TableContainer :class="sectionClass('apps')">
|
||||||
|
<SectionTitle label="Applications" />
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableLabel
|
<TableLabel
|
||||||
label="Apps that should not be displayed in the menu"
|
label="Apps that should not be displayed in the menu"
|
||||||
@@ -171,7 +177,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|
||||||
|
<TableContainer :class="sectionClass('cats')">
|
||||||
|
<SectionTitle label="Categories" />
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
<TableLabel
|
||||||
|
label="Order by"
|
||||||
|
:middle="true"
|
||||||
|
/>
|
||||||
|
<TableValue>
|
||||||
|
<FormSelect
|
||||||
|
v-model="config['categories-order-type']"
|
||||||
|
:options="[
|
||||||
|
{ id: 'default', label: 'Name' },
|
||||||
|
{ id: 'custom', label: 'Customed' },
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</TableValue>
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
<TableLabel
|
||||||
|
label="Customize sorting"
|
||||||
|
:middle="true"
|
||||||
|
/>
|
||||||
|
<TableValue>
|
||||||
|
<FormCatSort v-model="config['categories-order']" />
|
||||||
|
</TableValue>
|
||||||
|
</TableRow>
|
||||||
|
</TableContainer>
|
||||||
|
|
||||||
<TableContainer :class="sectionClass('opener')">
|
<TableContainer :class="sectionClass('opener')">
|
||||||
|
<SectionTitle label="Opener" />
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableLabel
|
<TableLabel
|
||||||
label="Opener"
|
label="Opener"
|
||||||
@@ -363,6 +401,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|
||||||
<TableContainer :class="sectionClass('global')">
|
<TableContainer :class="sectionClass('global')">
|
||||||
|
<SectionTitle label="Global" />
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableLabel
|
<TableLabel
|
||||||
label="The menu is enabled by default for users"
|
label="The menu is enabled by default for users"
|
||||||
@@ -396,6 +436,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
|
|
||||||
<TableContainer :class="sectionClass('support')">
|
<TableContainer :class="sectionClass('support')">
|
||||||
|
<SectionTitle label="Support" />
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableLabel
|
<TableLabel
|
||||||
label="You like this app and you want to support me?"
|
label="You like this app and you want to support me?"
|
||||||
@@ -521,6 +563,7 @@ import FormYesNo from '../components/settings/form/FormYesNo'
|
|||||||
import FormSize from '../components/settings/form/FormSize'
|
import FormSize from '../components/settings/form/FormSize'
|
||||||
import FormAppPicker from '../components/settings/form/FormAppPicker'
|
import FormAppPicker from '../components/settings/form/FormAppPicker'
|
||||||
import FormAppSort from '../components/settings/form/FormAppSort'
|
import FormAppSort from '../components/settings/form/FormAppSort'
|
||||||
|
import FormCatSort from '../components/settings/form/FormCatSort'
|
||||||
import FormDisplayPicker from '../components/settings/form/FormDisplayPicker'
|
import FormDisplayPicker from '../components/settings/form/FormDisplayPicker'
|
||||||
|
|
||||||
const menu = [
|
const menu = [
|
||||||
@@ -530,6 +573,7 @@ const menu = [
|
|||||||
{ label: 'Colors', section: 'colors' },
|
{ label: 'Colors', section: 'colors' },
|
||||||
{ label: 'Opener', section: 'opener' },
|
{ label: 'Opener', section: 'opener' },
|
||||||
{ label: 'Applications', section: 'apps' },
|
{ label: 'Applications', section: 'apps' },
|
||||||
|
{ label: 'Categories', section: 'cats' },
|
||||||
{ label: 'Support', section: 'support' },
|
{ label: 'Support', section: 'support' },
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -537,7 +581,7 @@ const config = ref(null)
|
|||||||
const showConfig = ref(false)
|
const showConfig = ref(false)
|
||||||
const configCopied = ref(false)
|
const configCopied = ref(false)
|
||||||
const configStore = useConfigStore()
|
const configStore = useConfigStore()
|
||||||
const section = ref('apps' /*menu[0].section*/)
|
const section = ref(menu[0].section)
|
||||||
|
|
||||||
const setSection = (value) => {
|
const setSection = (value) => {
|
||||||
section.value = value
|
section.value = value
|
||||||
|
|||||||
+12
-6
@@ -240,12 +240,6 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-menu-setting {
|
|
||||||
padding: 20px;
|
|
||||||
display: flex;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.side-menu-setting-color-picker {
|
.side-menu-setting-color-picker {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
@@ -259,3 +253,15 @@
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.side-menu-setting-app {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.side-menu-setting {
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user