Sha256: 3f91bcf8f40556f97216cc6cf8547f66ef998cd6cb30e86a050f9be437e8ee8f

Contents?: true

Size: 751 Bytes

Versions: 4

Compression:

Stored size: 751 Bytes

Contents

app.directive('rsAttributeTable', function() {
  return {
    restrict: 'E',
    templateUrl: 'views/directives/attribute_table.html',
    controller: function(){},
    scope: {
      attributes: '=',
      showGroups: '='
    },
    link: function(scope) {
      // create attribute groups
      scope.groups = [{attributes: []}];

      // handle required, optional
      if(scope.showGroups) {
        scope.groups[0].name = 'Required';
        scope.groups.push({name: 'Optional', attributes: []});
      }

      // map hash to array
      _(scope.attributes).forEach(function(attr, key) {
        attr.name = attr.name || key;
        scope.groups[(scope.showGroups && !attr.required ? 1 : 0)].attributes.push(attr);
      });
    }
  };
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
praxis-0.16.1 lib/api_browser/app/js/directives/attribute_table.js
praxis-0.16.0 lib/api_browser/app/js/directives/attribute_table.js
praxis-0.15.0 lib/api_browser/app/js/directives/attribute_table.js
praxis-0.14.0 lib/api_browser/app/js/directives/attribute_table.js