Commit c7145944 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide

parents afd9b6fb 5af7d1af
...@@ -105,7 +105,9 @@ export default class RepoEditor { ...@@ -105,7 +105,9 @@ export default class RepoEditor {
this.monacoInstance.setModel(null); this.monacoInstance.setModel(null);
const languages = monaco.languages.getLanguages(); const languages = monaco.languages.getLanguages();
console.log(languages)
const languageID = Helper.getLanguageIDForFile(this.activeFile, languages); const languageID = Helper.getLanguageIDForFile(this.activeFile, languages);
console.log('languageID',languageID)
const newModel = monaco.editor.createModel(this.blobRaw, languageID); const newModel = monaco.editor.createModel(this.blobRaw, languageID);
this.monacoInstance.setModel(newModel); this.monacoInstance.setModel(newModel);
......
...@@ -23,16 +23,16 @@ const RepoHelper = { ...@@ -23,16 +23,16 @@ const RepoHelper = {
}, },
findLanguage(ext, langs) { findLanguage(ext, langs) {
langs.find(lang => lang.extensions && lang.extensions.indexOf(`.${ext}`) > -1); return langs.find(lang => lang.extensions && lang.extensions.indexOf(`.${ext}`) > -1);
}, },
setDirectoryOpen(tree) { setDirectoryOpen(tree) {
if (!tree) return; let file = tree;
if (!file) return;
/* eslint-disable no-param-reassign */ file.opened = true;
tree.opened = true; file.icon = 'fa-folder-open';
tree.icon = 'fa-folder-open'; return file;
/* eslint-enable no-param-reassign */
}, },
getRawURLFromBlobURL(url) { getRawURLFromBlobURL(url) {
...@@ -96,7 +96,7 @@ const RepoHelper = { ...@@ -96,7 +96,7 @@ const RepoHelper = {
getContent(treeOrFile) { getContent(treeOrFile) {
let file = treeOrFile; let file = treeOrFile;
const loadingData = this.setLoading(true); const loadingData = RepoHelper.setLoading(true);
Service.getContent() Service.getContent()
.then((response) => { .then((response) => {
...@@ -133,8 +133,8 @@ const RepoHelper = { ...@@ -133,8 +133,8 @@ const RepoHelper = {
} }
} else { } else {
// it's a tree // it's a tree
RepoHelper.setDirectoryOpen(file); file = RepoHelper.setDirectoryOpen(file);
const newDirectory = this.dataToListOfFiles(data); const newDirectory = RepoHelper.dataToListOfFiles(data);
Store.addFilesToDirectory(file, Store.files, newDirectory); Store.addFilesToDirectory(file, Store.files, newDirectory);
Store.prevURL = Service.blobURLtoParentTree(Service.url); Store.prevURL = Service.blobURLtoParentTree(Service.url);
} }
...@@ -217,7 +217,7 @@ const RepoHelper = { ...@@ -217,7 +217,7 @@ const RepoHelper = {
}, },
loadingError() { loadingError() {
new Flash('Unable to load the file at this time.'); // eslint-disable-line no-new Flash('Unable to load the file at this time.');
}, },
}; };
......
...@@ -98,19 +98,26 @@ const RepoStore = { ...@@ -98,19 +98,26 @@ const RepoStore = {
removeChildFilesOfTree(tree) { removeChildFilesOfTree(tree) {
let foundTree = false; let foundTree = false;
const newTree = tree; const treeToClose = tree;
let wereDone = false;
RepoStore.files = RepoStore.files.filter((file) => { RepoStore.files = RepoStore.files.filter((file) => {
if (file.url === newTree.url) foundTree = true; const isItTheTreeWeWant = file.url === treeToClose.url;
// if it's the next tree
if(foundTree && file.type === 'tree' && !isItTheTreeWeWant) {
wereDone = true;
return true;
}
if(wereDone) return true;
if (foundTree) return file.level <= newTree.level; if (isItTheTreeWeWant) foundTree = true;
if (foundTree) return file.level <= treeToClose.level;
return true; return true;
}); });
newTree.opened = false; treeToClose.opened = false;
newTree.icon = 'fa-folder'; treeToClose.icon = 'fa-folder';
return treeToClose;
return newTree;
}, },
removeFromOpenedFiles(file) { removeFromOpenedFiles(file) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= render 'shared/ref_switcher', destination: 'tree', path: @path = render 'shared/ref_switcher', destination: 'tree', path: @path
.tree-controls .tree-controls
%a.btn.btn-default.btn-grouped#editable-mode{ "href"=>"#", "@click.prevent" => "editClicked", "v-cloak" => 1 } %a.btn.btn-default#editable-mode{ "href"=>"#", "@click.prevent" => "editClicked", "v-cloak" => 1 }
%i{ ":class" => "buttonIcon" } %i{ ":class" => "buttonIcon" }
%span {{buttonLabel}} %span {{buttonLabel}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment