Commit cff9ef36 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

make ShowJumbotron.vue use updateProperty store action

parent fcb0f2cf
......@@ -180,56 +180,44 @@ export default {
this.$refs.modalDeactivate.show()
},
saveName (event) {
let modal = this.$refs.modalName
if (this.string !== this.selectedShow.name) {
saveProperty (property, value, modal, event) {
if (this.string !== this.selectedShow.email) {
event.preventDefault()
this.$store.dispatch('shows/updateName', {
this.$store.dispatch('shows/updateProperty', {
id: this.selectedShow.id,
text: this.string,
callback: () => { modal.hide() }
property: property,
value: value,
callback: () => {
if (modal) { modal.hide() }
}
})
}
},
saveName (event) {
if (this.string !== this.selectedShow.name) {
this.saveProperty('name', this.string, this.$refs.modalName, event)
}
},
saveShortDescription (event) {
let modal = this.$refs.modalShortDescription
if (this.string !== this.selectedShow.short_description) {
event.preventDefault()
this.$store.dispatch('shows/updateShortDescription', {
id: this.selectedShow.id,
text: this.string,
callback: () => { modal.hide() }
})
this.saveProperty('short_description', this.string, this.$refs.modalShortDescription, event)
}
},
saveDescription (event) {
let modal = this.$refs.modalDescription
if (this.string !== this.selectedShow.description) {
event.preventDefault()
this.$store.dispatch('shows/updateDescription', {
id: this.selectedShow.id,
text: this.string,
callback: () => { modal.hide() }
})
this.saveProperty('description', this.string, this.$refs.modalDescription, event)
}
},
deactivateShow (event) {
let modal = this.$refs.modalDeactivate
event.preventDefault()
this.$store.dispatch('shows/deactivateShow', {
id: this.selectedShow.id,
callback: () => { modal.hide() }
})
this.saveProperty('is_active', false, this.$refs.modalDeactivate, event)
},
activateShow (show) {
this.$log.debug(show)
this.$store.dispatch('shows/activateShow', {
id: this.selectedShow.id,
})
activateShow () {
this.saveProperty('is_active', true, null, event)
},
}
......
......@@ -204,82 +204,6 @@ const actions = {
})
},
updateName (ctx, data) {
let show = cloneMinimalShowObject(ctx.getters.getShowByDataParam(data))
show.name = data.text
ctx.dispatch('updateShow', {
id: data.id,
show: show,
callback: () => {
ctx.commit('setName', {
id: data.id,
text: data.text
})
if (typeof(data.callback) === 'function') { data.callback() }
}
})
},
updateShortDescription (ctx, data) {
let show = cloneMinimalShowObject(ctx.getters.getShowByDataParam(data))
show.short_description = data.text
ctx.dispatch('updateShow', {
id: data.id,
show: show,
callback: () => {
ctx.commit('setShortDescription', {
id: data.id,
text: data.text
})
}
})
},
updateDescription (ctx, data) {
let show = cloneMinimalShowObject(ctx.getters.getShowByDataParam(data))
show.description = data.text
ctx.dispatch('updateShow', {
id: data.id,
show: show,
callback: () => {
ctx.commit('setDescription', {
id: data.id,
text: data.text
})
}
})
},
activateShow (ctx, data) {
let show = cloneMinimalShowObject(ctx.getters.getShowByDataParam(data))
show.is_active = true
ctx.dispatch('updateShow', {
id: data.id,
show: show,
callback: () => {
ctx.commit('setActive', {
id: data.id,
active: true
})
}
})
},
deactivateShow (ctx, data) {
let show = cloneMinimalShowObject(ctx.getters.getShowByDataParam(data))
show.is_active = false
ctx.dispatch('updateShow', {
id: data.id,
show: show,
callback: () => {
ctx.commit('setActive', {
id: data.id,
active: false
})
}
})
},
updateProperty (ctx, data) {
let show = cloneMinimalShowObject(ctx.getters.getShowByDataParam(data))
show[data.property] = data.value
......
Supports Markdown
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