Show banner when in edit mode

This commit is contained in:
Alicia Sykes
2021-10-17 19:14:12 +01:00
parent 5aefbb272f
commit 159748e3de
5 changed files with 39 additions and 0 deletions

View File

@@ -152,10 +152,17 @@ export default {
},
/* Saves the updated item to VueX Store */
saveItem() {
// Convert form data back into section.item data structure
const structured = {};
this.formData.forEach((row) => { structured[row.name] = row.value; });
// Some attributes need a little extra formatting
const newItem = this.formatBeforeSave(structured);
// Update the data store, with new item data
this.$store.commit(StoreKeys.UPDATE_ITEM, { newItem, itemId: this.itemId });
// If we're not already in edit mode, enable it now
this.$store.commit(StoreKeys.SET_EDIT_MODE, true);
// Close edit menu
this.$emit('closeEditMenu');
},
/* Adds filed from extras list to main form, then removes from extras list */
appendNewField(fieldId) {

View File

@@ -0,0 +1,20 @@
<template>
<div class="edit-mode-top-banner">
<span>Edit Mode Enabled</span>
</div>
</template>
<style scoped lang="scss">
div.edit-mode-top-banner {
width: 100%;
text-align: center;
padding: 0.2rem 0;
background: var(--primary);
opacity: var(--dimming-factor);
span {
font-size: 1rem;
font-weight: bold;
color: var(--background);
}
}
</style>