cateditor: show notice if editing a public catalog

This commit is contained in:
Seth Ladygo
2019-06-01 01:46:54 -07:00
parent 26ff012903
commit 25fd0b6ef7
2 changed files with 19 additions and 0 deletions

View File

@ -50,6 +50,13 @@
<ExitEditorDialog v-model="showExitEditorPopup"/> <ExitEditorDialog v-model="showExitEditorPopup"/>
<v-snackbar v-model="showPublicNotice" color="success"
multi-line top :timeout="10000">
This is a public catalog.<br/>
Changes will be saved in a new catalog that you own.
<v-btn dark flat @click="showPublicNotice = false">Close</v-btn>
</v-snackbar>
</v-form> </v-form>
</template> </template>
@ -73,6 +80,7 @@ export default {
step: 1, step: 1,
valid: false, // is the whole editor in a valid state? valid: false, // is the whole editor in a valid state?
showExitEditorPopup: false, showExitEditorPopup: false,
showPublicNotice: false,
}), }),
computed: { computed: {
loadingCatalog() { loadingCatalog() {
@ -82,6 +90,7 @@ export default {
return this.$store.getters.savingCatalog return this.$store.getters.savingCatalog
}, },
...mapState([ ...mapState([
'catalog',
'catalogSavedOK', 'catalogSavedOK',
]), ]),
}, },
@ -94,6 +103,15 @@ export default {
}, },
}, },
watch: { watch: {
catalog(value) {
if (value) {
var userID = JSON.parse(document.getElementById('userID').textContent)
console.log('catalog changed', value.owner, userID)
if (value.owner && value.owner !== userID) {
this.showPublicNotice = true
}
}
},
catalogSavedOK(value) { catalogSavedOK(value) {
if (value) { if (value) {
console.log('catalog saved. redirecting to catalog list...') console.log('catalog saved. redirecting to catalog list...')

View File

@ -14,6 +14,7 @@
{{ regions | json_script:"regions" }} {{ regions | json_script:"regions" }}
{{ seasons | json_script:"seasons" }} {{ seasons | json_script:"seasons" }}
{{ user.get_full_name | json_script:"userName" }} {{ user.get_full_name | json_script:"userName" }}
{{ user.id | json_script:"userID" }}
{{ user | is_lazy_user | json_script:"lazyUser" }} {{ user | is_lazy_user | json_script:"lazyUser" }}
</head> </head>
<body> <body>