diff options
Diffstat (limited to 'server/sonar-web/src/main/js/common/handlebars-extensions.js')
-rw-r--r-- | server/sonar-web/src/main/js/common/handlebars-extensions.js | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/server/sonar-web/src/main/js/common/handlebars-extensions.js b/server/sonar-web/src/main/js/common/handlebars-extensions.js index 36f89fd0214..2dddae877d2 100644 --- a/server/sonar-web/src/main/js/common/handlebars-extensions.js +++ b/server/sonar-web/src/main/js/common/handlebars-extensions.js @@ -473,35 +473,11 @@ }); Handlebars.registerHelper('collapsedDirFromPath', function (path) { - var limit = 30; - if (typeof path === 'string') { - var tokens = _.initial(path.split('/')); - if (tokens.length > 2) { - var head = _.first(tokens), - tail = _.last(tokens), - middle = _.initial(_.rest(tokens)), - cut = false; - while (middle.join().length > limit && middle.length > 0) { - middle.shift(); - cut = true; - } - var body = [].concat(head, cut ? ['...'] : [], middle, tail); - return body.join('/') + '/'; - } else { - return tokens.join('/') + '/'; - } - } else { - return null; - } + return collapsedDirFromPath(path); }); Handlebars.registerHelper('fileFromPath', function (path) { - if (typeof path === 'string') { - var tokens = path.split('/'); - return _.last(tokens); - } else { - return null; - } + return fileFromPath(path); }); Handlebars.registerHelper('repeat', function (number, options) { |