Skip to content
Snippets Groups Projects
Commit c7b7fb5d authored by Nick Anton Christoph Kleine-Tebbe's avatar Nick Anton Christoph Kleine-Tebbe
Browse files

finished editable list

parent 5353584c
Branches
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
:selected="selected" :selected="selected"
> >
<div class="flex flex-row w-full"> <div class="flex flex-row w-full">
<div v-if="!inEdit" class="w-full select-none text-left mr-1"> <div class="w-full select-none text-left mr-1">
{{ title }} {{ title }}
</div> </div>
<button <button
......
...@@ -12,13 +12,16 @@ ...@@ -12,13 +12,16 @@
class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-blue-500 hover:bg-blue-700 active:bg-blue-900 pb-1">&#9993;</button> class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-blue-500 hover:bg-blue-700 active:bg-blue-900 pb-1">&#9993;</button>
<button <button
v-if="inEdit" v-if="inEdit"
@click.native="save()" @click="save()"
class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-green-500 hover:bg-green-700 active:bg-green-900"></button> class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-green-500 hover:bg-green-700 active:bg-green-900"></button>
<button <button
v-if="!inEdit" v-if="!inEdit"
@click="edit()"
class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-yellow-500 hover:bg-yellow-700 active:bg-yellow-900"></button> class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-yellow-500 hover:bg-yellow-700 active:bg-yellow-900"></button>
<button <button
class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-red-500 hover:bg-red-700 active:bg-red-900"></button> class="text-center text-white rounded-md select-none w-9 h-8 ml-1 bg-red-500 hover:bg-red-700 active:bg-red-900"
@click="deleteMe()"
></button>
</div> </div>
</ListItem> </ListItem>
</template> </template>
...@@ -48,7 +51,14 @@ export default { ...@@ -48,7 +51,14 @@ export default {
}, },
methods: { methods: {
save() { save() {
console.log("save me!") this.$emit("update:inEdit", false);
this.$emit("update:title", this.title);
},
edit() {
this.$emit("update:inEdit", true);
},
deleteMe() {
this.$emit("deleteKolloquium")
} }
} }
} }
......
<template> <template>
<div <div class="relative flex flex-col items-center justify-top min-h-screen bg-gray-100 sm:items-top sm:pt-0">
class="relative flex flex-col items-center justify-top min-h-screen bg-gray-100 sm:items-top sm:pt-0"
>
<box> <box>
<template slot="title"> <template slot="title">
KolloquiumVR Control Panel KolloquiumVR Control Panel
...@@ -21,7 +19,10 @@ ...@@ -21,7 +19,10 @@
@click.native="selectKolloquium(kolloquium)" @click.native="selectKolloquium(kolloquium)"
:selected="selectedKolloquium===kolloquium.title" :selected="selectedKolloquium===kolloquium.title"
:title="kolloquium.title" :title="kolloquium.title"
@update:title="kolloquium.title=$event"
:inEdit="kolloquium.inEdit" :inEdit="kolloquium.inEdit"
@update:inEdit="toggleEdit(kolloquium, $event)"
@deleteKolloquium="deleteKolloquium(kolloquium)"
/> />
<ListItem <ListItem
@click.native="createNewKolloquium()" @click.native="createNewKolloquium()"
...@@ -45,7 +46,6 @@ ...@@ -45,7 +46,6 @@
<button class="border rounded mt-4 p-2 font-semibold text-white bg-green-500 hover:bg-green-600 focus:bg-green-700">Aktivieren</button> <button class="border rounded mt-4 p-2 font-semibold text-white bg-green-500 hover:bg-green-600 focus:bg-green-700">Aktivieren</button>
</template> </template>
</box> </box>
{{ kolloquiums }}
</div> </div>
</template> </template>
...@@ -105,6 +105,15 @@ export default { ...@@ -105,6 +105,15 @@ export default {
this.kolloquiums = this.kolloquiums.filter(kolloquium => kolloquium.title.length > 0); this.kolloquiums = this.kolloquiums.filter(kolloquium => kolloquium.title.length > 0);
this.kolloquiums = [...this.kolloquiums, {title: '', inEdit: true}]; this.kolloquiums = [...this.kolloquiums, {title: '', inEdit: true}];
},
toggleEdit(kolloquium, status) {
this.kolloquiums.forEach(kolloquium => {
kolloquium.inEdit = false;
});
kolloquium.inEdit = status;
},
deleteKolloquium(kolloquiumToDelete) {
this.kolloquiums = this.kolloquiums.filter(kolloquium => kolloquium.title != kolloquiumToDelete.title);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment