From 32d3a3b2ce6bc4a09616c46105434bfbe6aa062f Mon Sep 17 00:00:00 2001 From: Bruce McMoran Date: Thu, 12 Mar 2020 07:30:17 -0700 Subject: [PATCH] feature(events): Reused add/edit component --- app/javascript/components/AddEvent.vue | 46 ++------ app/javascript/components/EditableEvent.vue | 111 ++++++++++++++++++++ app/javascript/components/Event.vue | 21 ++-- app/javascript/components/EventList.vue | 3 +- app/javascript/components/ShowEvent.vue | 24 ++++- 5 files changed, 144 insertions(+), 61 deletions(-) create mode 100644 app/javascript/components/EditableEvent.vue diff --git a/app/javascript/components/AddEvent.vue b/app/javascript/components/AddEvent.vue index 67be0fb..3e00c49 100644 --- a/app/javascript/components/AddEvent.vue +++ b/app/javascript/components/AddEvent.vue @@ -1,49 +1,22 @@ \ No newline at end of file diff --git a/app/javascript/components/Event.vue b/app/javascript/components/Event.vue index b41915e..ee62a2c 100644 --- a/app/javascript/components/Event.vue +++ b/app/javascript/components/Event.vue @@ -23,7 +23,8 @@ - Save + + Edit Delete @@ -37,7 +38,7 @@ export default { name: 'Event', props: { event: Object, - isEditable: {default: false, type: Boolean}, + isEditable: {default: true, type: Boolean}, }, data: function() { return { @@ -66,19 +67,9 @@ export default { this.$router.replace('/events') }) }, - updateEvent: function() { - const event = { - id: this.event.id, - start_time: this.start_time, - end_time: this.end_time, - name: this.event.name, - theme: this.event.theme, - description: this.event.description, - } - updateEvent(this.event.id, event).then(r => { - this.$emit('eventUpdated') - }) - } + changeMode: function() { + this.$emit('changeMode') + }, } } diff --git a/app/javascript/components/EventList.vue b/app/javascript/components/EventList.vue index 35844cd..2d60f84 100644 --- a/app/javascript/components/EventList.vue +++ b/app/javascript/components/EventList.vue @@ -6,7 +6,8 @@ v-for='event in events' :key='event.id' :event='event' - /> + :isEditable='false' + /> \ No newline at end of file