Sha256: 50599ad6a3844d9f057115fec173f153cefae8cb2508e6ecc8efaaac642376de

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

app.provider('Examples', function() {
  var registry = {};

  this.register = function(key, displayName, handler) {
    registry[key] = registry[key] || [];
    registry[key].unshift({
      key: key,
      displayName: displayName,
      handler: handler
    });
  };

  this.removeHandlersForKey = function(key) {
    registry[key] = [];
  };

  this.register('general', 'General', function() {
    return 'views/examples/general.html';
  });

  this.$get = function(prepareTemplate, $injector) {
    return {
      forContext: function(action, version, resource) {
        var results = {};
        for (var key in registry) {
          for (var i = 0; i < registry[key].length; i++) {
            var result = $injector.invoke(registry[key][i].handler, this, {
              $action: action,
              $version: version,
              $context: {
                resource: resource,
                action: action,
                version: version
              }
            });
            if (result) {
              results[key] = {
                key: key,
                displayName: registry[key][i].displayName,
                template: prepareTemplate(result)
              };
              break;
            }
          }
        }
        return results;
      }
    };
  };

});

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
praxis-2.0.pre.9 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.8 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.7 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.6 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.5 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.4 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.3 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.2 lib/api_browser/app/js/factories/Example.js
praxis-2.0.pre.1 lib/api_browser/app/js/factories/Example.js
praxis-0.22.pre.2 lib/api_browser/app/js/factories/Example.js
praxis-0.22.pre.1 lib/api_browser/app/js/factories/Example.js
praxis-0.21 lib/api_browser/app/js/factories/Example.js