Sha256: d1e039566d7f9ea99113757d056f9fae6408d5fbeed468f8b3843a46050ed864
Contents?: true
Size: 1.62 KB
Versions: 7
Compression:
Stored size: 1.62 KB
Contents
app.directive('rsTypeLabel', function($compile, $templateCache, $http) { var primitives = [ 'Boolean', 'CSV', 'DateTime', 'Float', 'Hash', 'Ids', 'Integer', 'Object', 'String', 'Struct' ]; var templates = { primitive: '<span>{{type.name}}</span>', type: '<a ui-sref="root.type({version: apiVersion, type: type.name})">{{type.name | resourceName}}</a>', primitiveCollection: '<span>Collection [ {{type.member_attribute.type.name}} ]</a>', typeCollection: '<span>Collection [ <a ui-sref="root.type({version: apiVersion, type: type.member_attribute.type.name})">{{type.member_attribute.type.name | resourceName}}</a> ]</span>', link: '<span>Link [ <a ui-sref="root.type({version: apiVersion, type: type.link_to})">{{type.link_to | resourceName}}</a> ]</span>' }; return { restrict: 'E', scope: { type: '=' }, link: function(scope, element) { var template = templates.type; if (_.contains(primitives, scope.type.name)) { template = templates.primitive; } else if ( scope.type.member_attribute !== undefined ) { if ( _.contains(primitives, scope.type.member_attribute.type.name)){ template = templates.primitiveCollection; }else{ template = templates.typeCollection; } } else if (scope.type.link_to) { template = templates.link; } element.html(template); $compile(element.contents())(scope); }, controller: function($scope, $stateParams) { $scope.apiVersion = $stateParams.version; } }; });
Version data entries
7 entries across 7 versions & 1 rubygems