From f0e23800c3e10ec2881ec8cbb7619b590a82ede4 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Thu, 20 Jul 2017 16:20:48 +0100 Subject: Covert vue components to single file components --- app/assets/javascripts/repo/repo_file.js | 32 ---------------- app/assets/javascripts/repo/repo_file.vue | 38 +++++++++++++++++++ app/assets/javascripts/repo/repo_file_options.js | 28 -------------- app/assets/javascripts/repo/repo_file_options.vue | 33 ++++++++++++++++ app/assets/javascripts/repo/repo_loading_file.js | 34 ----------------- app/assets/javascripts/repo/repo_loading_file.vue | 39 +++++++++++++++++++ app/assets/javascripts/repo/repo_prev_directory.js | 20 ---------- .../javascripts/repo/repo_prev_directory.vue | 24 ++++++++++++ app/assets/javascripts/repo/repo_sidebar.js | 8 ++-- app/assets/javascripts/repo/repo_store.js | 2 +- app/assets/javascripts/repo/repo_tab.js | 39 ------------------- app/assets/javascripts/repo/repo_tab.vue | 44 ++++++++++++++++++++++ app/assets/javascripts/repo/repo_tabs.js | 2 +- 13 files changed, 184 insertions(+), 159 deletions(-) delete mode 100644 app/assets/javascripts/repo/repo_file.js create mode 100644 app/assets/javascripts/repo/repo_file.vue delete mode 100644 app/assets/javascripts/repo/repo_file_options.js create mode 100644 app/assets/javascripts/repo/repo_file_options.vue delete mode 100644 app/assets/javascripts/repo/repo_loading_file.js create mode 100644 app/assets/javascripts/repo/repo_loading_file.vue delete mode 100644 app/assets/javascripts/repo/repo_prev_directory.js create mode 100644 app/assets/javascripts/repo/repo_prev_directory.vue delete mode 100644 app/assets/javascripts/repo/repo_tab.js create mode 100644 app/assets/javascripts/repo/repo_tab.vue diff --git a/app/assets/javascripts/repo/repo_file.js b/app/assets/javascripts/repo/repo_file.js deleted file mode 100644 index ce669861619..00000000000 --- a/app/assets/javascripts/repo/repo_file.js +++ /dev/null @@ -1,32 +0,0 @@ -const RepoFile = { - template: ` - - - - {{file.name}} - - -
{{file.lastCommitMessage}}
- - - {{file.lastCommitUpdate}} - - - `, - props: { - name: 'repo-file', - file: Object, - isTree: Boolean, - isMini: Boolean, - loading: Object, - hasFiles: Boolean, - activeFile: Object, - }, - - methods: { - linkClicked(file) { - this.$emit('linkclicked', file); - }, - }, -}; -export default RepoFile; diff --git a/app/assets/javascripts/repo/repo_file.vue b/app/assets/javascripts/repo/repo_file.vue new file mode 100644 index 00000000000..0aa88921133 --- /dev/null +++ b/app/assets/javascripts/repo/repo_file.vue @@ -0,0 +1,38 @@ + + + diff --git a/app/assets/javascripts/repo/repo_file_options.js b/app/assets/javascripts/repo/repo_file_options.js deleted file mode 100644 index 3efa6d7c13d..00000000000 --- a/app/assets/javascripts/repo/repo_file_options.js +++ /dev/null @@ -1,28 +0,0 @@ -const RepoFileOptions = { - template: ` - - - {{projectName}} - - - - `, - props: { - name: 'repo-file-options', - isMini: Boolean, - projectName: String, - }, -}; - -export default RepoFileOptions; diff --git a/app/assets/javascripts/repo/repo_file_options.vue b/app/assets/javascripts/repo/repo_file_options.vue new file mode 100644 index 00000000000..361232b6b2c --- /dev/null +++ b/app/assets/javascripts/repo/repo_file_options.vue @@ -0,0 +1,33 @@ + + + diff --git a/app/assets/javascripts/repo/repo_loading_file.js b/app/assets/javascripts/repo/repo_loading_file.js deleted file mode 100644 index 2e02710fc89..00000000000 --- a/app/assets/javascripts/repo/repo_loading_file.js +++ /dev/null @@ -1,34 +0,0 @@ -const RepoLoadingFile = { - template: ` - - -
-
-
- - -
-
-
- - -
-
-
- - - `, - - methods: { - lineOfCode(n) { - return `line-of-code-${n}`; - }, - }, - - props: { - loading: Object, - hasFiles: Boolean, - isMini: Boolean, - }, -}; -export default RepoLoadingFile; diff --git a/app/assets/javascripts/repo/repo_loading_file.vue b/app/assets/javascripts/repo/repo_loading_file.vue new file mode 100644 index 00000000000..677c7cbe12d --- /dev/null +++ b/app/assets/javascripts/repo/repo_loading_file.vue @@ -0,0 +1,39 @@ + + + diff --git a/app/assets/javascripts/repo/repo_prev_directory.js b/app/assets/javascripts/repo/repo_prev_directory.js deleted file mode 100644 index bd341510525..00000000000 --- a/app/assets/javascripts/repo/repo_prev_directory.js +++ /dev/null @@ -1,20 +0,0 @@ -const RepoPreviousDirectory = { - template: ` - - - .. - - - `, - props: { - name: 'repo-previous-directory', - prevUrl: String, - }, - - methods: { - linkClicked(file) { - this.$emit('linkclicked', file); - }, - }, -}; -export default RepoPreviousDirectory; diff --git a/app/assets/javascripts/repo/repo_prev_directory.vue b/app/assets/javascripts/repo/repo_prev_directory.vue new file mode 100644 index 00000000000..1201bd3c877 --- /dev/null +++ b/app/assets/javascripts/repo/repo_prev_directory.vue @@ -0,0 +1,24 @@ + + + diff --git a/app/assets/javascripts/repo/repo_sidebar.js b/app/assets/javascripts/repo/repo_sidebar.js index d8037786399..0af2aeef6d7 100644 --- a/app/assets/javascripts/repo/repo_sidebar.js +++ b/app/assets/javascripts/repo/repo_sidebar.js @@ -2,10 +2,10 @@ import Vue from 'vue'; import Service from './repo_service'; import Helper from './repo_helper'; import Store from './repo_store'; -import RepoPreviousDirectory from './repo_prev_directory'; -import RepoFileOptions from './repo_file_options'; -import RepoFile from './repo_file'; -import RepoLoadingFile from './repo_loading_file'; +import RepoPreviousDirectory from './repo_prev_directory.vue'; +import RepoFileOptions from './repo_file_options.vue'; +import RepoFile from './repo_file.vue'; +import RepoLoadingFile from './repo_loading_file.vue'; import RepoMiniMixin from './repo_mini_mixin'; export default class RepoSidebar { diff --git a/app/assets/javascripts/repo/repo_store.js b/app/assets/javascripts/repo/repo_store.js index 612b7b61158..87088cfdd89 100644 --- a/app/assets/javascripts/repo/repo_store.js +++ b/app/assets/javascripts/repo/repo_store.js @@ -55,7 +55,7 @@ const RepoStore = { toggleRawPreview() { this.activeFile.raw = !this.activeFile.raw; - this.activeFileLabel = this.activeFile.raw ? 'Display rendered file' : 'Display source'; + this.activeFileLabel = this.activeFile.raw ? 'Display rendered file' : 'Display source'; }, setActiveFiles(file) { diff --git a/app/assets/javascripts/repo/repo_tab.js b/app/assets/javascripts/repo/repo_tab.js deleted file mode 100644 index 40a81c63ef7..00000000000 --- a/app/assets/javascripts/repo/repo_tab.js +++ /dev/null @@ -1,39 +0,0 @@ -import RepoHelper from './repo_helper'; -import RepoStore from './repo_store'; - -const RepoTab = { - template: ` -
  • - - - - {{tab.name}} - -
  • - `, - props: { - name: 'repo-tab', - tab: Object, - saved: true, - }, - - computed: { - changedClass() { - const tabChangedObj = { - 'fa-times': !this.tab.changed, - 'fa-circle': this.tab.changed, - }; - return tabChangedObj; - }, - }, - - methods: { - tabClicked: RepoStore.setActiveFiles.bind(RepoStore), - - xClicked(file) { - if (file.changed) return; - RepoStore.removeFromOpenedFiles(file); - }, - }, -}; -export default RepoTab; diff --git a/app/assets/javascripts/repo/repo_tab.vue b/app/assets/javascripts/repo/repo_tab.vue new file mode 100644 index 00000000000..11456a7ab8f --- /dev/null +++ b/app/assets/javascripts/repo/repo_tab.vue @@ -0,0 +1,44 @@ + + + diff --git a/app/assets/javascripts/repo/repo_tabs.js b/app/assets/javascripts/repo/repo_tabs.js index d55dd2fd26c..073438a14a5 100644 --- a/app/assets/javascripts/repo/repo_tabs.js +++ b/app/assets/javascripts/repo/repo_tabs.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import Store from './repo_store'; -import RepoTab from './repo_tab'; +import RepoTab from './repo_tab.vue'; import RepoMiniMixin from './repo_mini_mixin'; export default class RepoTabs { -- cgit v1.2.1