File size: 989 Bytes
c02f046 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | angular
.module('crosswatch')
.directive('watchlistLogevent', watchlistLogevent);
function watchlistLogevent() {
var directive = {
link: link,
templateUrl: 'components/watchlist/logevent.directive.html',
restrict: 'E'
};
return directive;
function link(scope, element, attrs) {
/*
* copy event.logparams properties to event
*/
for (var prop in scope.event.logparams) {
if (scope.event.logparams.hasOwnProperty(prop)) {
if (!(isNumber(prop)) && !(scope.event.hasOwnProperty(prop))) {
scope.event[prop] = scope.event.logparams[prop];
}
}
}
/*
* Rename badly named logparams properties
*/
if (scope.event.logaction === 'move_prot') {
scope.event.target_title = scope.event.logparams['0'];
} else if (scope.event.logtype === 'protect') {
scope.event.protection_level = scope.event.logparams['0'];
}
function isNumber(obj) { return !isNaN(parseFloat(obj)) }
}
}
|