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>
<div id="app">
<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 class="container">
<b-breadcrumb :items="breadcrumbs"/>
......@@ -9,7 +9,7 @@
<Footer/>
</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/>
</b-card>
</div>
......@@ -26,8 +26,7 @@
components: {Sidebar, Footer, Navbar},
data() {
return {
breadcrumbs: [],
show_sidebar: false
breadcrumbs: []
}
},
watch: {
......@@ -38,9 +37,6 @@
}
},
methods: {
toggleSidebar() {
this.show_sidebar = !this.show_sidebar
},
getBreadcrumbs(m) {
let res = [{text: m.meta.resolveName(this.$route.params), path: m.path}]
while ((m.meta && m.meta.resolveParents) || m.parent) {
......
......@@ -103,10 +103,10 @@
ta['func_descr'] = this.object_functions[this.object_function].parameters
let prev_fields = this.preview_fields
if (prev_fields == null) {
if (this.non_optionals.length != 0) {
if (this.non_optionals.length !== 0) {
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
}
else {
......@@ -121,6 +121,9 @@
ta['preview_fields'] = prev_fields
this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta)
if(!this.isMobile() && !this.$store.state.show_sidebar) {
this.$store.state.show_sidebar = true
}
},
async validateObjectFQName() {
let parts = this.object_fq_name.split('.')
......
......@@ -41,7 +41,7 @@
</div>
</b-nav-form>
<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']"/>
Geplante Aktionen
<b-badge variant="primary">{{$store.state.ta_list ? $store.state.ta_list.length : 0}}</b-badge>
......
......@@ -122,7 +122,7 @@
function2variant: TransactionUtil.function2variant,
function2text: TransactionUtil.function2text,
editElement(element) {
this.should_edit = this.edit_elem != element
this.should_edit = this.edit_elem !== element
this.edit_elem = element
if (!this.should_edit) {
this.$bvModal.show('ta-edit')
......
......@@ -55,7 +55,8 @@ const store = new Vuex.Store({
done: JSON.parse(window.localStorage.getItem('done')) || [],
undone: JSON.parse(window.localStorage.getItem('undone')) || [],
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: {
emptyState(state) {
......@@ -130,7 +131,7 @@ const store = new Vuex.Store({
},
removeTransactionElement(state, payload) {
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)
break
}
......@@ -143,7 +144,7 @@ const store = new Vuex.Store({
}
let update = false
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
Vue.set(state.ta_list, i, payload)
break
......@@ -197,6 +198,10 @@ const store = new Vuex.Store({
}
window.localStorage.setItem('transaction_error', JSON.stringify(state.transaction_error))
}
},
showSidebar(state, show) {
state.show_sidebar = show
window.localStorage.setItem('show_sidebar', show)
}
},
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