github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/controller/static/app/shipyard.filters.js (about)

     1  (function() {
     2      'use strict';
     3  
     4      angular
     5          .module('shipyard.filters', [])
     6          .filter('roleDisplay', roleDisplay)
     7          .filter('fromCalendar', fromCalendar);
     8          
     9          function roleDisplay() {
    10              return function(input) {
    11                  var display = "";
    12                  var scope = "";
    13                  var parts = input.split(':');
    14                  switch (parts[1]) {
    15                      case "ro":
    16                          scope = "Read Only";
    17                          break;
    18                      default:
    19                          scope = "";
    20                          break;
    21                  }
    22                  return parts[0].charAt(0).toUpperCase() + parts[0].slice(1) + " " + scope;
    23              }
    24          };
    25  
    26          function fromCalendar() {
    27              return function(input) {
    28                  return moment(input).calendar().toLowerCase();
    29              }
    30          };
    31  })();