added link to registration
[angular-drzb] / app / js / filters.js
index 259dd4e..b34d679 100644 (file)
@@ -7,4 +7,22 @@ angular.module('myApp.filters', []).
     return function(text) {
       return String(text).replace(/\%VERSION\%/mg, version);
     }
-  }]);
+  }]).
+  filter('registration_date_time', function() {
+    return function(text) {
+               if ( ! text ) return '?';
+               var timestamp = parseInt( text.split(/\./)[1] );
+        var date = new Date(timestamp / 100); // 100000 / 1000
+               if ( date.toISOString !== undefined ) {
+               return date.toISOString().replace(/T/, ' ').replace(/\.[0-9]{3}Z/, '');
+               } else {
+                       return date.toString();
+               }
+    }
+  }).
+  filter('registration_url', function() {
+    return function(text) {
+               if ( ! text ) return '';
+               return '#/' + text.replace('.','/');
+    }
+  });