summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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');
+ });
+ });
});
});