"use strict"; (function () { 'use strict'; angular.module('feedModule') .directive('entityProfileLink', ['$filter', function ($filter) { return { restrict: 'A', scope: { entityData: '=entityProfileLink' }, link: function (scope, iElement) { if (!scope.entityData) { console.log('No information about entity'); } else { if (scope.entityData.type && scope.entityData.type === 'changerequest') { scope.entityData.type = 'change'; } var entityLink = scope.entityData.entityLink; if (_.contains(scope.entityData.entityLink, 'asset')) { var assetId, classId; if (scope.entityData.reconciliationId || scope.entityData.id) { assetId = $filter('escape')(scope.entityData.reconciliationId || scope.entityData.id); classId = scope.entityData.classId || scope.entityData.realObject.classId; entityLink = '#/asset/' + assetId + '/' + classId; } else if (scope.entityData.realObject.reconciliationId) { assetId = $filter('escape')(scope.entityData.realObject.reconciliationId); entityLink = '#/' + scope.entityData.type + '/' + assetId + '/' + scope.entityData.realObject.classId; } } if (!scope.entityData.entityLink && scope.entityData.id) { entityLink = '#/' + scope.entityData.type + '/' + encodeURIComponent(scope.entityData.id.replace(/\\\\/g, '\\')); } if (!iElement.attr('href')) { iElement.attr('href', entityLink); } } } }; }]); }());