forked from deblan/side_menu
format code
This commit is contained in:
parent
fdd8f8850d
commit
b835bbb34d
7 changed files with 74 additions and 56 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
<TableContainer :class="sectionClass('global')">
|
||||
<p class="side-menu-tips">
|
||||
<em>{{ t('side_menu', 'Use the shortcut Ctrl+o to open and to hide the side menu. Use tab key to navigate.') }}</em>
|
||||
<em>{{ t('side_menu', 'Use the shortcut Ctrl+o to open and to hide the side menu. Use tab key to navigate.') }}</em>
|
||||
</p>
|
||||
|
||||
<SectionTitle label="Global" />
|
||||
|
|
@ -688,6 +688,6 @@ onMounted(async () => {
|
|||
|
||||
.save {
|
||||
display: block;
|
||||
float: right
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -19,12 +19,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
v-if="config"
|
||||
app-name="side_menu"
|
||||
>
|
||||
<NcAppContent class="side-menu-setting-app" v-if="config['force']">
|
||||
<NcAppContent
|
||||
v-if="config['force']"
|
||||
class="side-menu-setting-app"
|
||||
>
|
||||
<TableContainer>
|
||||
<TableLabel label="You do not have permission to change the settings." />
|
||||
</TableContainer>
|
||||
</NcAppContent>
|
||||
<NcAppContent v-else class="side-menu-setting-app side-menu-setting-app--user">
|
||||
<NcAppContent
|
||||
v-else
|
||||
class="side-menu-setting-app side-menu-setting-app--user"
|
||||
>
|
||||
<TableContainer>
|
||||
<SectionTitle label="Menu" />
|
||||
|
||||
|
|
@ -64,11 +70,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
:middle="true"
|
||||
/>
|
||||
<TableValue>
|
||||
<FormSelect v-model="config['target-blank-mode']" :options="[
|
||||
{id: 1, label: 'Use the global setting'},
|
||||
{id: 2, label: 'Use my selection'},
|
||||
]" />
|
||||
<FormAppPicker v-if="config['target-blank-mode'] === 2" v-model="config['target-blank-apps']" />
|
||||
<FormSelect
|
||||
v-model="config['target-blank-mode']"
|
||||
:options="[
|
||||
{ id: 1, label: 'Use the global setting' },
|
||||
{ id: 2, label: 'Use my selection' },
|
||||
]"
|
||||
/>
|
||||
<FormAppPicker
|
||||
v-if="config['target-blank-mode'] === 2"
|
||||
v-model="config['target-blank-apps']"
|
||||
/>
|
||||
</TableValue>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
|
|
@ -82,7 +94,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
</TableRow>
|
||||
</TableContainer>
|
||||
|
||||
<TableContainer>
|
||||
<TableContainer>
|
||||
<SectionTitle label="Support" />
|
||||
|
||||
<TableRow>
|
||||
|
|
@ -166,6 +178,6 @@ onMounted(async () => {
|
|||
|
||||
.save {
|
||||
display: block;
|
||||
float: right
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue