Site > File Tree > Add All read button

This commit is contained in:
brunosimon
2017-08-29 20:58:31 +01:00
parent e9f373e62e
commit 8dbaa35f9e
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -36,6 +36,29 @@ export default
onSearchValueChange(value) onSearchValueChange(value)
{ {
this.$store.commit('searchFile', value) this.$store.commit('searchFile', value)
},
onAllReadClick()
{
// Go through each folder and file
const eachFolder = (obj) =>
{
for(const folder of obj.folders)
{
eachFolder(folder)
}
if(obj.files)
{
for(const file of obj.files)
{
// Update changed and new properties
file.isChanged = false
file.isNew = false
}
}
}
eachFolder(this.files)
} }
} }
} }
@@ -1,4 +1,7 @@
<div> <div>
<input type="text" v-model="searchValue"> <input type="text" v-model="searchValue">
<files-tree-folder v-for="folder of files.folders" :key="+ new Date()" :content="folder" :depth="0"></files-tree-folder> <files-tree-folder v-for="folder of files.folders" :key="+ new Date()" :content="folder" :depth="0"></files-tree-folder>
<div>
<a href="#" class="all-read" @click.prevent="onAllReadClick">Mark all as read</a>
</div>
</div> </div>