LP#1708291: add a join filter for angular templates
authorJason Etheridge <jason@equinoxinitiative.org>
Tue, 30 May 2017 15:51:51 +0000 (11:51 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 29 Aug 2017 19:27:55 +0000 (15:27 -0400)
Signed-off-by: Jason Etheridge <jason@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/services/ui.js

index 5080b54..f632478 100644 (file)
@@ -223,6 +223,18 @@ function($timeout , $parse) {
     return eg_context_due_date_filter;
 }])
 
+// 'join' filter
+// TODO: perhaps this should live elsewhere
+.filter('join', function() {
+    return function(arr,sep) {
+        if (typeof arr == 'object' && arr.constructor == Array) {
+            return arr.join(sep || ',');
+        } else {
+            return '';
+        }
+    };
+})
+
 /**
  * Progress Dialog. 
  *