summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZara Gebru <zgebru@thoughtworks.com>2016-04-06 15:40:28 +0200
committerZara Gebru <zgebru@thoughtworks.com>2016-04-06 15:41:04 +0200
commit3835f94880cd6392191ba9008d5a1b516c78465a (patch)
tree92a24077bdfdc3ee663f89a1bfffe43efd8f481c
parentdc389b7a1424ca39a88b783f77006536031d93bd (diff)
Issue #292: add fingerprint view in user settings
-rw-r--r--web-ui/app/js/helpers/view_helper.js7
-rw-r--r--web-ui/app/templates/page/user_settings_box.hbs1
-rw-r--r--web-ui/test/spec/helpers/view_helper.spec.js6
3 files changed, 14 insertions, 0 deletions
diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js
index e8d517a5..7e07df75 100644
--- a/web-ui/app/js/helpers/view_helper.js
+++ b/web-ui/app/js/helpers/view_helper.js
@@ -98,14 +98,21 @@ define(
}
+ function formatFingerPrint(fingerprint) {
+ fingerprint = fingerprint || '';
+ return fingerprint.replace(/(.{4})/g, '$1 ').trim();
+ }
+
Handlebars.registerHelper('formatDate', formatDate);
Handlebars.registerHelper('formatSize', formatSize);
Handlebars.registerHelper('formatStatusClasses', formatStatusClasses);
+ Handlebars.registerHelper('formatFingerPrint', formatFingerPrint);
return {
formatStatusClasses: formatStatusClasses,
formatSize: formatSize,
formatMailBody: formatMailBody,
+ formatFingerPrint: formatFingerPrint,
moveCaretToEndOfText: moveCaretToEndOfText,
quoteMail: quoteMail,
i18n: i18n
diff --git a/web-ui/app/templates/page/user_settings_box.hbs b/web-ui/app/templates/page/user_settings_box.hbs
index eb227dcf..a6b575f2 100644
--- a/web-ui/app/templates/page/user_settings_box.hbs
+++ b/web-ui/app/templates/page/user_settings_box.hbs
@@ -5,3 +5,4 @@
<i class="shortcut-label"></i>
</header>
<p>{{ account_email }}</p>
+<p>{{ formatFingerPrint fingerprint }}</p>
diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js
index b2f597c2..19bef15f 100644
--- a/web-ui/test/spec/helpers/view_helper.spec.js
+++ b/web-ui/test/spec/helpers/view_helper.spec.js
@@ -106,5 +106,11 @@ define(['helpers/view_helper'], function (viewHelper) {
expect(window.setTimeout.calls.all()[0].args[1]).toEqual(1);
});
+
+ describe('fingerprint helper', function () {
+ it('should format fingerprint', function () {
+ expect(viewHelper.formatFingerPrint('12345678')).toEqual('1234 5678');
+ });
+ });
});
});