diff --git a/site/src/components/files-tree-file/script.js b/site/src/components/files-tree-file/script.js index 430a92d..93f9351 100644 --- a/site/src/components/files-tree-file/script.js +++ b/site/src/components/files-tree-file/script.js @@ -35,7 +35,7 @@ export default if(search !== '') { // Set up fuzzy search - const text = this.content.data.path.full.replace(/^\.\//, '') + const text = this.content.path.full.replace(/^\.\//, '') let searchPosition = 0 this.matchingPositions = [] @@ -46,7 +46,7 @@ export default if(searchPosition < search.length && text[n].toLowerCase() === search[searchPosition]) { searchPosition += 1 - this.matchingPositions.push(n - this.content.data.path.directory.length + 1) + this.matchingPositions.push(n - this.content.path.directory.length + 1) } } @@ -64,7 +64,7 @@ export default { onNameClick() { - this.$store.commit('setFile', this.content.data.path.full) + this.$store.commit('setFile', this.content.path.full) } } } \ No newline at end of file diff --git a/site/src/components/files-tree-file/template.html b/site/src/components/files-tree-file/template.html index 98224b0..994895f 100644 --- a/site/src/components/files-tree-file/template.html +++ b/site/src/components/files-tree-file/template.html @@ -1,12 +1,12 @@
- + - (new) - (changed) + (new) + (changed)
\ No newline at end of file diff --git a/site/src/components/files-tree-folder/template.html b/site/src/components/files-tree-folder/template.html index 43576ab..0ff3d87 100644 --- a/site/src/components/files-tree-folder/template.html +++ b/site/src/components/files-tree-folder/template.html @@ -10,6 +10,6 @@
- +
\ No newline at end of file diff --git a/site/src/components/project/template.html b/site/src/components/project/template.html index 71bb2ed..16a8f82 100644 --- a/site/src/components/project/template.html +++ b/site/src/components/project/template.html @@ -2,7 +2,7 @@ {{ project.name }} - + diff --git a/site/src/components/viewer/script.js b/site/src/components/viewer/script.js index 948adc1..e2d1447 100644 --- a/site/src/components/viewer/script.js +++ b/site/src/components/viewer/script.js @@ -15,7 +15,7 @@ export default { extension() { - return this.$store.state.files.current.data.extension + return this.$store.state.files.current.extension }, version() diff --git a/site/src/store/modules/files.js b/site/src/store/modules/files.js index 4b32c6e..00ed48c 100644 --- a/site/src/store/modules/files.js +++ b/site/src/store/modules/files.js @@ -39,11 +39,11 @@ export default { { const file = state.tree.getFile(data) - if(!state.current || state.current.data.id !== file.data.id) + if(!state.current || state.current.id !== file.id) { state.current = file - state.current.data.isNew = false - state.current.data.isChanged = false + state.current.isNew = false + state.current.isChanged = false } }, @@ -53,8 +53,8 @@ export default { if(file) { - file.data.versions.push(data.version) - file.data.isChanged = true + file.versions.push(data.version) + file.isChanged = true } }, diff --git a/site/src/utils/FileTree.js b/site/src/utils/FileTree.js index 9300b6e..e55f666 100644 --- a/site/src/utils/FileTree.js +++ b/site/src/utils/FileTree.js @@ -99,8 +99,14 @@ class FileTree folder = { folders: [], files: [], - name: _part, - data: _data + name: _part + } + + // Add data + for(const dataKey in _data) + { + const data = _data[dataKey] + folder[dataKey] = data } // Save @@ -144,8 +150,14 @@ class FileTree // Create file const file = { - name: filePart, - data: _data + name: filePart + } + + // Add data + for(const dataKey in _data) + { + const data = _data[dataKey] + file[dataKey] = data } // Save @@ -175,9 +187,9 @@ class FileTree folder.folders.splice(_folderKey, 1) // Callback - if(typeof _folder.data.onRemove === 'function') + if(typeof _folder.onRemove === 'function') { - _folder.data.onRemove.apply(this, [_folder]) + _folder.onRemove.apply(this, [_folder]) } } @@ -189,9 +201,9 @@ class FileTree folder.files.splice(_fileKey, 1) // Callback - if(typeof _file.data.onRemove === 'function') + if(typeof _file.onRemove === 'function') { - _file.data.onRemove.apply(this, [_file]) + _file.onRemove.apply(this, [_file]) } } } @@ -243,9 +255,9 @@ class FileTree folders.splice(index, 1) // Callback - if(typeof folder.data.onRemove === 'function') + if(typeof folder.onRemove === 'function') { - folder.data.onRemove.apply(this, [folder]) + folder.onRemove.apply(this, [folder]) } // Auto wash @@ -324,9 +336,9 @@ class FileTree } // Callback - if(typeof file.data.onRemove === 'function') + if(typeof file.onRemove === 'function') { - file.data.onRemove.apply(this, [file]) + file.onRemove.apply(this, [file]) } return true @@ -466,9 +478,9 @@ class FileTree folder.folders.splice(_folderKey, 1) // Callback - if(typeof _folder.data.onRemove === 'function') + if(typeof _folder.onRemove === 'function') { - _folder.data.onRemove.apply(this, [_folder]) + _folder.onRemove.apply(this, [_folder]) } } }