Commit b74c25db authored by gj4210's avatar gj4210 👽
Browse files

UPD: Sidebar status synced & stored via vuex

+ teeny tiny cosmetic improvements
parent c6fb58c2
Pipeline #92651 passed with stages
in 7 minutes and 41 seconds
<template> <template>
<div id="app"> <div id="app">
<Navbar/> <Navbar/>
<div id="wrapper" :class="show_sidebar ? 'squished' : null"> <div id="wrapper" :class="$store.state.show_sidebar ? 'squished' : null">
<div id="page-content-wrapper"> <div id="page-content-wrapper">
<div class="container"> <div class="container">
<b-breadcrumb :items="breadcrumbs"/> <b-breadcrumb :items="breadcrumbs"/>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<Footer/> <Footer/>
</div> </div>
</div> </div>
<b-card id="sidebar-wrapper" no-body :class="show_sidebar ? 'hide' : null"> <b-card id="sidebar-wrapper" no-body :class="$store.state.show_sidebar ? 'hide' : null">
<Sidebar/> <Sidebar/>
</b-card> </b-card>
</div> </div>
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
components: {Sidebar, Footer, Navbar}, components: {Sidebar, Footer, Navbar},
data() { data() {
return { return {
breadcrumbs: [], breadcrumbs: []
show_sidebar: false
} }
}, },
watch: { watch: {
...@@ -38,9 +37,6 @@ ...@@ -38,9 +37,6 @@
} }
}, },
methods: { methods: {
toggleSidebar() {
this.show_sidebar = !this.show_sidebar
},
getBreadcrumbs(m) { getBreadcrumbs(m) {
let res = [{text: m.meta.resolveName(this.$route.params), path: m.path}] let res = [{text: m.meta.resolveName(this.$route.params), path: m.path}]
while ((m.meta && m.meta.resolveParents) || m.parent) { while ((m.meta && m.meta.resolveParents) || m.parent) {
......
...@@ -103,10 +103,10 @@ ...@@ -103,10 +103,10 @@
ta['func_descr'] = this.object_functions[this.object_function].parameters ta['func_descr'] = this.object_functions[this.object_function].parameters
let prev_fields = this.preview_fields let prev_fields = this.preview_fields
if (prev_fields == null) { if (prev_fields == null) {
if (this.non_optionals.length != 0) { if (this.non_optionals.length !== 0) {
prev_fields = this.non_optionals prev_fields = this.non_optionals
} }
else if (this.non_optionals_order && this.non_optionals_order.length != 0) { else if (this.non_optionals_order && this.non_optionals_order.length !== 0) {
prev_fields = this.non_optionals_order prev_fields = this.non_optionals_order
} }
else { else {
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
ta['preview_fields'] = prev_fields ta['preview_fields'] = prev_fields
this.$store.commit('addTransactionElement', ta) this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta) this.$emit('commited', ta)
if(!this.isMobile() && !this.$store.state.show_sidebar) {
this.$store.state.show_sidebar = true
}
}, },
async validateObjectFQName() { async validateObjectFQName() {
let parts = this.object_fq_name.split('.') let parts = this.object_fq_name.split('.')
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</div> </div>
</b-nav-form> </b-nav-form>
<b-nav-item><span class="d-none d-xl-inline">Erweiterte </span>Suche</b-nav-item> <b-nav-item><span class="d-none d-xl-inline">Erweiterte </span>Suche</b-nav-item>
<b-nav-item :active="$parent.show_sidebar" @click="$parent.toggleSidebar"> <b-nav-item :active="$store.state.show_sidebar" @click="$store.commit('showSidebar', !$store.state.show_sidebar)">
<font-awesome-icon :icon="['fas', 'tasks']"/> <font-awesome-icon :icon="['fas', 'tasks']"/>
Geplante Aktionen Geplante Aktionen
<b-badge variant="primary">{{$store.state.ta_list ? $store.state.ta_list.length : 0}}</b-badge> <b-badge variant="primary">{{$store.state.ta_list ? $store.state.ta_list.length : 0}}</b-badge>
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
function2variant: TransactionUtil.function2variant, function2variant: TransactionUtil.function2variant,
function2text: TransactionUtil.function2text, function2text: TransactionUtil.function2text,
editElement(element) { editElement(element) {
this.should_edit = this.edit_elem != element this.should_edit = this.edit_elem !== element
this.edit_elem = element this.edit_elem = element
if (!this.should_edit) { if (!this.should_edit) {
this.$bvModal.show('ta-edit') this.$bvModal.show('ta-edit')
......
...@@ -55,7 +55,8 @@ const store = new Vuex.Store({ ...@@ -55,7 +55,8 @@ const store = new Vuex.Store({
done: JSON.parse(window.localStorage.getItem('done')) || [], done: JSON.parse(window.localStorage.getItem('done')) || [],
undone: JSON.parse(window.localStorage.getItem('undone')) || [], undone: JSON.parse(window.localStorage.getItem('undone')) || [],
undo_redo_new_mutaion: JSON.parse(window.localStorage.getItem('undo_redo_new_mutation')) || true, undo_redo_new_mutaion: JSON.parse(window.localStorage.getItem('undo_redo_new_mutation')) || true,
transaction_error: JSON.parse(window.localStorage.getItem('transaction_error')) || null transaction_error: JSON.parse(window.localStorage.getItem('transaction_error')) || null,
show_sidebar: JSON.parse(window.localStorage.getItem('show_sidebar')) || false,
}, },
mutations: { mutations: {
emptyState(state) { emptyState(state) {
...@@ -130,7 +131,7 @@ const store = new Vuex.Store({ ...@@ -130,7 +131,7 @@ const store = new Vuex.Store({
}, },
removeTransactionElement(state, payload) { removeTransactionElement(state, payload) {
for (let i = 0; i < state.ta_list.length; i++) { for (let i = 0; i < state.ta_list.length; i++) {
if (state.ta_list[i].uuid == payload.uuid) { if (state.ta_list[i].uuid === payload.uuid) {
state.ta_list.splice(i, 1) state.ta_list.splice(i, 1)
break break
} }
...@@ -143,7 +144,7 @@ const store = new Vuex.Store({ ...@@ -143,7 +144,7 @@ const store = new Vuex.Store({
} }
let update = false let update = false
for (let i = 0; i < state.ta_list.length; i++) { for (let i = 0; i < state.ta_list.length; i++) {
if (state.ta_list[i].uuid == payload.old_uuid) { if (state.ta_list[i].uuid === payload.old_uuid) {
update = true update = true
Vue.set(state.ta_list, i, payload) Vue.set(state.ta_list, i, payload)
break break
...@@ -197,6 +198,10 @@ const store = new Vuex.Store({ ...@@ -197,6 +198,10 @@ const store = new Vuex.Store({
} }
window.localStorage.setItem('transaction_error', JSON.stringify(state.transaction_error)) window.localStorage.setItem('transaction_error', JSON.stringify(state.transaction_error))
} }
},
showSidebar(state, show) {
state.show_sidebar = show
window.localStorage.setItem('show_sidebar', show)
} }
}, },
plugins: [ plugins: [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment