summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/repo/repo_bundle.js17
-rw-r--r--app/assets/javascripts/repo/repo_service.js15
-rw-r--r--app/assets/javascripts/repo/repo_sidebar.js26
-rw-r--r--app/helpers/tree_helper.rb4
-rw-r--r--app/views/projects/tree/_tree_content.html.haml2
-rw-r--r--package.json1
-rw-r--r--yarn.lock19
7 files changed, 82 insertions, 2 deletions
diff --git a/app/assets/javascripts/repo/repo_bundle.js b/app/assets/javascripts/repo/repo_bundle.js
index 5730ad2aba6..99efea41760 100644
--- a/app/assets/javascripts/repo/repo_bundle.js
+++ b/app/assets/javascripts/repo/repo_bundle.js
@@ -1,4 +1,14 @@
/* global monaco */
+import Sidebar from './repo_sidebar'
+import Service from './repo_service'
+
+class RepoBundle {
+ constructor(id, url) {
+ this.service = Service;
+ this.service.url = url;
+ this.sidebar = new Sidebar(url);
+ }
+}
window.require.config({ paths: { vs: '/monaco-editor/min/vs' } });
window.require(['vs/editor/editor.main'], () => {
@@ -7,3 +17,10 @@ window.require(['vs/editor/editor.main'], () => {
language: 'javascript',
});
});
+document.addEventListener('DOMContentLoaded', ()=> {
+ const ideRoot = document.getElementById('ide');
+ const bundle = new RepoBundle(
+ ideRoot,
+ ideRoot.dataset.url
+ );
+});
diff --git a/app/assets/javascripts/repo/repo_service.js b/app/assets/javascripts/repo/repo_service.js
new file mode 100644
index 00000000000..216bbce110e
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_service.js
@@ -0,0 +1,15 @@
+import axios from 'axios';
+
+let RepoService = {
+ url: '',
+
+ setUrl(url) {
+ this.url = url;
+ },
+
+ getTree() {
+ return axios.get(this.url);
+ }
+};
+
+export default RepoService; \ No newline at end of file
diff --git a/app/assets/javascripts/repo/repo_sidebar.js b/app/assets/javascripts/repo/repo_sidebar.js
new file mode 100644
index 00000000000..61a155a6ee8
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_sidebar.js
@@ -0,0 +1,26 @@
+import Service from './repo_service'
+import Vue from 'vue';
+
+export default class RepoSidebar {
+ constructor(url) {
+ this.url = url;
+ this.getTree();
+ this.initVue();
+ }
+
+ getTree() {
+ Service.getTree()
+ .then((response)=> {
+ console.log('response', response.data);
+ })
+ .catch((response)=> {
+ console.log('error response', response);
+ });
+ }
+
+ initVue() {
+ this.vue = new Vue({
+
+ });
+ }
+} \ No newline at end of file
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index e0d3e9b88f3..b3456dc3293 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -12,6 +12,10 @@ module TreeHelper
tree.html_safe
end
+ def repo_url()
+ url_for(params.merge(format: :json))
+ end
+
# Return an image icon depending on the file type and mode
#
# type - String type of the tree item; either 'folder' or 'file'
diff --git a/app/views/projects/tree/_tree_content.html.haml b/app/views/projects/tree/_tree_content.html.haml
index b0dd345abba..e31a222f47c 100644
--- a/app/views/projects/tree/_tree_content.html.haml
+++ b/app/views/projects/tree/_tree_content.html.haml
@@ -1,5 +1,5 @@
.tree-content-holder
- #ide{ style: "height:400px;" }
+ #ide{ data: { url: repo_url }, style: "height:400px;" }
- if tree.readme
= render "projects/tree/readme", readme: tree.readme
diff --git a/package.json b/package.json
index 3ceea912a5d..26407cff9ab 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js"
},
"dependencies": {
+ "axios": "^0.16.2",
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-plugin-transform-define": "^1.2.0",
diff --git a/yarn.lock b/yarn.lock
index ddabf1c5a94..ffe6ff62c50 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -233,6 +233,13 @@ aws4@^1.2.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
+axios@^0.16.2:
+ version "0.16.2"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d"
+ dependencies:
+ follow-redirects "^1.2.3"
+ is-buffer "^1.1.5"
+
babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4"
@@ -1560,7 +1567,7 @@ debug@2.6.0, debug@^2.1.0, debug@^2.1.1, debug@^2.2.0:
dependencies:
ms "0.7.2"
-debug@2.6.7:
+debug@2.6.7, debug@^2.4.5:
version "2.6.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.7.tgz#92bad1f6d05bbb6bba22cca88bcd0ec894c2861e"
dependencies:
@@ -2373,6 +2380,12 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
+follow-redirects@^1.2.3:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.2.3.tgz#01abaeca85e3609837d9fcda3167a7e42fdaca21"
+ dependencies:
+ debug "^2.4.5"
+
for-in@^0.1.5:
version "0.1.6"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"
@@ -2860,6 +2873,10 @@ is-buffer@^1.0.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b"
+is-buffer@^1.1.5:
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc"
+
is-builtin-module@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe"