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)
committerDan Wells <dbw2@calvin.edu>
Fri, 1 Sep 2017 16:47:14 +0000 (12:47 -0400)
Signed-off-by: Jason Etheridge <jason@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/web/js/ui/default/staff/services/ui.js

index ff7cfd8..10766ff 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. 
  *