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"/>
<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>
</template>
@ -73,6 +80,7 @@ export default {
step: 1,
valid: false, // is the whole editor in a valid state?
showExitEditorPopup: false,
showPublicNotice: false,
}),
computed: {
loadingCatalog() {
@ -82,6 +90,7 @@ export default {
return this.$store.getters.savingCatalog
},
...mapState([
'catalog',
'catalogSavedOK',
]),
},
@ -94,6 +103,15 @@ export default {
},
},
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) {
if (value) {
console.log('catalog saved. redirecting to catalog list...')

View File

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