From 9977f1a83a6b3f12d85304fca63a156c1fd247a0 Mon Sep 17 00:00:00 2001 From: Sabbir Siddiqui Date: Thu, 18 Jun 2015 15:22:38 -0400 Subject: [PATCH] date format helper --- app/assets/javascripts/helpers.js.coffee | 4 +++- app/assets/javascripts/templates/providers/show.hbs | 2 +- app/assets/javascripts/views/provider_view.js.coffee | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/helpers.js.coffee b/app/assets/javascripts/helpers.js.coffee index 701671e3d..d5685ca18 100644 --- a/app/assets/javascripts/helpers.js.coffee +++ b/app/assets/javascripts/helpers.js.coffee @@ -20,7 +20,9 @@ _.extend PopHealth.Helpers, else return value - + formatNumber: (value) -> + return String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ##### Handlebars Helpers Handlebars.registerHelper 'join', (list, options = {}) -> mappable = if list instanceof Backbone.Collection then list else _(list) diff --git a/app/assets/javascripts/templates/providers/show.hbs b/app/assets/javascripts/templates/providers/show.hbs index a72ce3454..da1f6ad0e 100644 --- a/app/assets/javascripts/templates/providers/show.hbs +++ b/app/assets/javascripts/templates/providers/show.hbs @@ -10,7 +10,7 @@

{{providerType}}: {{providerExtension}}, {{title}} {{given_name}} {{family_name}}

-

# of Patients: {{patient_count}}

+

# of Patients: {{patient_count_format}}

{{specialty}}

{{organization.name}}

diff --git a/app/assets/javascripts/views/provider_view.js.coffee b/app/assets/javascripts/views/provider_view.js.coffee index a385ec693..42c2f8e20 100644 --- a/app/assets/javascripts/views/provider_view.js.coffee +++ b/app/assets/javascripts/views/provider_view.js.coffee @@ -9,6 +9,7 @@ class Thorax.Views.ProviderView extends Thorax.View providerType: @model.providerType() || "" providerExtension: @model.providerExtension() || "" npi: @model.npi() || "" + patient_count_format: PopHealth.Helpers.formatNumber(@model.get('patient_count')) events: 'click .effective-date-btn' : 'setEffectiveDate' rendered: ->