added user.org_member
[angular-drzb] / app / js / filters.js
1 'use strict';
2
3 /* Filters */
4
5 angular.module('myApp.filters', []).
6   filter('interpolate', ['version', function(version) {
7     return function(text) {
8       return String(text).replace(/\%VERSION\%/mg, version);
9     }
10   }]).
11   filter('registration_date_time', function() {
12     return function(text) {
13                 if ( ! text ) return '?';
14                 var timestamp = parseInt( text.split(/\./)[1] );
15         var date = new Date(timestamp / 100); // 100000 / 1000
16                 if ( date.toISOString !== undefined ) {
17                 return date.toISOString().replace(/T/, ' ').replace(/\.[0-9]{3}Z/, '');
18                 } else {
19                         return date.toString();
20                 }
21     }
22   }).
23   filter('registration_url', function() {
24     return function(text) {
25                 if ( ! text ) return '';
26                 return '#/' + text.replace('.','/');
27     }
28   });