Skip to content

Commit 1545268

Browse files
committed
Settings: Move Settings to NcAppSettingsDialog in favour of the
NcAppNavigationSettings Signed-off-by: Jonathan Pagel <jonny_tischbein@systemli.org>
1 parent be0b498 commit 1545268

File tree

2 files changed

+67
-17
lines changed

2 files changed

+67
-17
lines changed

src/App.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@
2828
</template>
2929

3030
<template #footer>
31-
<AppSettings v-if="!loading.notes && error !== true" @reload="reloadNotes" />
31+
<ul class="app-navigation-entry__settings">
32+
<NcAppNavigationItem
33+
:title="t('notes', 'Notes settings')"
34+
@click.prevent="openSettings"
35+
>
36+
<CogIcon slot="icon" :size="20" />
37+
</NcAppNavigationItem>
38+
</ul>
39+
<AppSettings v-if="!loading.notes && error !== true" :open.sync="settingsVisible" @reload="reloadNotes" />
3240
</template>
3341
</NcAppNavigation>
3442

@@ -59,6 +67,7 @@ import '@nextcloud/dialogs/dist/index.css'
5967
6068
import InfoIcon from 'vue-material-design-icons/Information.vue'
6169
import PlusIcon from 'vue-material-design-icons/Plus.vue'
70+
import CogIcon from 'vue-material-design-icons/Cog.vue'
6271
6372
import AppSettings from './components/AppSettings.vue'
6473
import NavigationList from './components/NavigationList.vue'
@@ -83,6 +92,7 @@ export default {
8392
NcAppNavigationNew,
8493
NcAppNavigationItem,
8594
NcContent,
95+
CogIcon,
8696
PlusIcon,
8797
},
8898
@@ -102,6 +112,7 @@ export default {
102112
refreshTimer: null,
103113
helpVisible: false,
104114
editorHint: loadState('notes', 'editorHint', '') === 'yes' && window.OCA.Text?.createEditor,
115+
settingsVisible: false,
105116
}
106117
},
107118
@@ -252,6 +263,10 @@ export default {
252263
this.helpVisible = true
253264
},
254265
266+
openSettings() {
267+
this.settingsVisible = true
268+
},
269+
255270
onNewNote() {
256271
if (this.loading.create) {
257272
return
@@ -345,3 +360,14 @@ export default {
345360
},
346361
}
347362
</script>
363+
364+
<style scoped lang="scss">
365+
// Source for footer fix: https://github.com/nextcloud/server/blob/master/apps/files/src/views/Navigation.vue
366+
.app-navigation-entry__settings {
367+
height: auto !important;
368+
overflow: hidden !important;
369+
padding-top: 0 !important;
370+
// Prevent shrinking or growing
371+
flex: 0 0 auto;
372+
}
373+
</style>

src/components/AppSettings.vue

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<template>
2-
<NcAppNavigationSettings :title="t('notes', 'Notes settings')" :class="{ loading: saving }">
3-
<div class="settings-block">
4-
<p class="settings-hint">
5-
<label for="notesPath">{{ t('notes', 'Folder to store your notes') }}</label>
2+
<NcAppSettingsDialog
3+
:title="t('notes', 'Notes settings')"
4+
:class="{ loading: saving }"
5+
:show-navigation="true"
6+
:open="settingsOpen"
7+
@update:open="setSettingsOpen($event)"
8+
>
9+
<NcAppSettingsSection id="notes-path-section" :title="t('notes', 'Notes path')">
10+
<p class="app-settings-section__desc">
11+
{{ t('notes', 'Folder to store your notes') }}
612
</p>
713
<form @submit.prevent="onChangeSettingsReload">
814
<input id="notesPath"
@@ -13,10 +19,10 @@
1319
@change="onChangeSettingsReload"
1420
><input type="submit" class="icon-confirm" value="">
1521
</form>
16-
</div>
17-
<div class="settings-block">
18-
<p class="settings-hint">
19-
<label for="fileSuffix">{{ t('notes', 'File extension for new notes') }}</label>
22+
</NcAppSettingsSection>
23+
<NcAppSettingsSection id="file-suffix-section" :title="t('notes', 'File extension')">
24+
<p class="app-settings-section__desc">
25+
{{ t('notes', 'File extension for new notes') }}
2026
</p>
2127
<select id="fileSuffix" v-model="settings.fileSuffix" @change="onChangeSettings">
2228
<option v-for="extension in extensions" :key="extension.value" :value="extension.value">
@@ -31,23 +37,24 @@
3137
placeholder=".txt"
3238
@change="onChangeSettings"
3339
>
34-
</div>
35-
<div class="settings-block">
36-
<p class="settings-hint">
37-
<label for="noteMode">{{ t('notes', 'Display mode for notes') }}</label>
40+
</NcAppSettingsSection>
41+
<NcAppSettingsSection id="note-mode-section" :title="t('notes', 'Display mode')">
42+
<p class="app-settings-section__desc">
43+
{{ t('notes', 'Display mode for notes') }}
3844
</p>
3945
<select id="noteMode" v-model="settings.noteMode" @change="onChangeSettings">
4046
<option v-for="mode in noteModes" :key="mode.value" :value="mode.value">
4147
{{ mode.label }}
4248
</option>
4349
</select>
44-
</div>
45-
</NcAppNavigationSettings>
50+
</NcAppSettingsSection>
51+
</NcAppSettingsDialog>
4652
</template>
4753

4854
<script>
4955
import {
50-
NcAppNavigationSettings,
56+
NcAppSettingsDialog,
57+
NcAppSettingsSection,
5158
} from '@nextcloud/vue'
5259
5360
import { setSettings } from '../NotesService.js'
@@ -57,7 +64,12 @@ export default {
5764
name: 'AppSettings',
5865
5966
components: {
60-
NcAppNavigationSettings,
67+
NcAppSettingsDialog,
68+
NcAppSettingsSection,
69+
},
70+
71+
props: {
72+
open: Boolean,
6173
},
6274
6375
data() {
@@ -73,6 +85,7 @@ export default {
7385
{ value: 'preview', label: t('notes', 'Open in preview mode') },
7486
],
7587
saving: false,
88+
settingsOpen: this.open,
7689
}
7790
},
7891
@@ -82,6 +95,12 @@ export default {
8295
},
8396
},
8497
98+
watch: {
99+
open(newValue) {
100+
this.settingsOpen = newValue
101+
},
102+
},
103+
85104
created() {
86105
if (!window.OCA.Text?.createEditor) {
87106
this.noteModes.splice(0, 1)
@@ -105,6 +124,11 @@ export default {
105124
this.$emit('reload')
106125
})
107126
},
127+
128+
setSettingsOpen(newValue) {
129+
this.settingsOpen = newValue
130+
this.$emit('update:open', newValue)
131+
},
108132
},
109133
}
110134
</script>

0 commit comments

Comments
 (0)