aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js')
-rw-r--r--server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js b/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js
new file mode 100644
index 00000000000..5eca1464585
--- /dev/null
+++ b/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js
@@ -0,0 +1,8 @@
+module.exports = function () {
+ var args = Array.prototype.slice.call(arguments, 0, -1),
+ options = arguments[arguments.length - 1],
+ prefix = args.join(''),
+ path = window.location.pathname,
+ match = path.indexOf(baseUrl + prefix) === 0;
+ return match ? options.fn(this) : options.inverse(this);
+};