diff options
author | Jared Deckard <jared.deckard@gmail.com> | 2016-07-26 22:32:10 -0500 |
---|---|---|
committer | Jared Deckard <jared.deckard@gmail.com> | 2016-09-08 12:23:12 -0500 |
commit | 7f6474b269a5cfa454d28c0c0da969490c9eb33e (patch) | |
tree | aafe7df9bc2683712a466595a046adb57e222565 /app/assets/javascripts/project_find_file.js | |
parent | 4c833a1d4ead49c27f6a81e607d10a5c6f0fcc2b (diff) | |
download | gitlab-ce-7f6474b269a5cfa454d28c0c0da969490c9eb33e.tar.gz |
Restore comments lost when converting CoffeeScript to JavaScript
Diffstat (limited to 'app/assets/javascripts/project_find_file.js')
-rw-r--r-- | app/assets/javascripts/project_find_file.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/project_find_file.js b/app/assets/javascripts/project_find_file.js index 4925f0519f0..5bf900f3e1d 100644 --- a/app/assets/javascripts/project_find_file.js +++ b/app/assets/javascripts/project_find_file.js @@ -13,8 +13,11 @@ this.selectRowUp = bind(this.selectRowUp, this); this.filePaths = {}; this.inputElement = this.element.find(".file-finder-input"); + // init event this.initEvent(); + // focus text input box this.inputElement.focus(); + // load file list this.load(this.options.url); } @@ -42,6 +45,7 @@ } } }); + // init event }; ProjectFindFile.prototype.findFile = function() { @@ -49,8 +53,10 @@ searchText = this.inputElement.val(); result = searchText.length > 0 ? fuzzaldrinPlus.filter(this.filePaths, searchText) : this.filePaths; return this.renderList(result, searchText); + // find file }; + // files pathes load ProjectFindFile.prototype.load = function(url) { return $.ajax({ url: url, @@ -67,6 +73,7 @@ }); }; + // render result ProjectFindFile.prototype.renderList = function(filePaths, searchText) { var blobItemUrl, filePath, html, i, j, len, matches, results; this.element.find(".tree-table > tbody").empty(); @@ -86,6 +93,7 @@ return results; }; + // highlight text(awefwbwgtc -> <b>a</b>wefw<b>b</b>wgt<b>c</b> ) highlighter = function(element, text, matches) { var highlightText, j, lastIndex, len, matchIndex, matchedChars, unmatched; lastIndex = 0; @@ -110,6 +118,7 @@ return element.append(document.createTextNode(text.substring(lastIndex))); }; + // make tbody row html ProjectFindFile.prototype.makeHtml = function(filePath, matches, blobItemUrl) { var $tr; $tr = $("<tr class='tree-item'><td class='tree-item-file-name'><i class='fa fa-file-text-o fa-fw'></i><span class='str-truncated'><a></a></span></td></tr>"); |