GUI -- Moved cap() utility function into FnService.
Change-Id: I0afdb38e5b37e085ffebaedc74d3cb2857472b12
diff --git a/web/gui/src/main/webapp/app/fw/layer/quickhelp.js b/web/gui/src/main/webapp/app/fw/layer/quickhelp.js
index 8d533c7..4e8ac05a 100644
--- a/web/gui/src/main/webapp/app/fw/layer/quickhelp.js
+++ b/web/gui/src/main/webapp/app/fw/layer/quickhelp.js
@@ -63,16 +63,9 @@
// ===========================================
// === Function Definitions ===
-
- // TODO: move this to FnService.
- function cap(s) {
- return s.replace(/^[a-z]/, function (m) { return m.toUpperCase(); });
- }
-
-
function mkKeyDisp(id) {
var v = keyDisp[id] || id;
- return cap(v);
+ return fs.cap(v);
}
function addSeparator(el, i) {
diff --git a/web/gui/src/main/webapp/app/fw/util/fn.js b/web/gui/src/main/webapp/app/fw/util/fn.js
index dcc2725..5f1280e 100644
--- a/web/gui/src/main/webapp/app/fw/util/fn.js
+++ b/web/gui/src/main/webapp/app/fw/util/fn.js
@@ -143,6 +143,13 @@
return found;
}
+ // return the given string with the first character capitalized.
+ function cap(s) {
+ return s.replace(/^[a-z]/, function (m) {
+ return m.toUpperCase();
+ });
+ }
+
angular.module('onosUtil')
.factory('FnService', ['$window', function (_$window_) {
$window = _$window_;
@@ -158,7 +165,8 @@
windowSize: windowSize,
find: find,
inArray: inArray,
- removeFromArray: removeFromArray
+ removeFromArray: removeFromArray,
+ cap: cap
};
}]);