Sha256: a1bd017be4b74a56ac0dcc075220ebf5db996e241c1fefe0d5e71af42cec16fa

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

app.directive('rsAttributeDescription', function($compile, $templateCache, $http) {
  return {
    restrict: 'E',
    templateUrl: 'views/directives/attribute_description.html',
    scope: {
      attribute: '='
    },
    link: function(scope, element) {
      var list = element.find('dl');

      _.forEach(scope.attribute.options, function(option, name) {
        var templatePath = 'views/directives/attribute_description/_default.html';
        var skip_keys = ['reference','dsl_compiler','dsl_compiler_options'];
        
        switch (name) {
          case 'example':
            // expects string
            if(typeof option !== 'string') {
              option = JSON.stringify(option, null, 2);
            }
            templatePath = 'views/directives/attribute_description/_example.html';
            break;
          case 'headers':
            templatePath = 'views/directives/attribute_description/_headers.html';
            break;
        }

        if( ! _.contains( skip_keys, name ) ) {
          $http.get(templatePath, { cache: $templateCache }).success(function(template) {
            var row = $(template);
            var rowScope = scope.$new(true);
  
            rowScope.row = {
              name: name,
              value: option
            };
  
            $compile(row)(rowScope);
            list.append(row);
          });
        }
        
      })
    }
  };
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
praxis-0.13.0 lib/api_browser/app/js/directives/attribute_description.js
praxis-0.11.2 lib/api_browser/app/js/directives/attribute_description.js
praxis-0.11.1 lib/api_browser/app/js/directives/attribute_description.js
praxis-0.11 lib/api_browser/app/js/directives/attribute_description.js
praxis-0.11pre lib/api_browser/app/js/directives/attribute_description.js
praxis-0.10.1 lib/api_browser/app/js/directives/attribute_description.js
praxis-0.10.0 lib/api_browser/app/js/directives/attribute_description.js