Sha256: d4b832acd77fa87c18e0fea675b61d7af6c172c5dff0b778c6425f15e3377bf8

Contents?: true

Size: 937 Bytes

Versions: 211

Compression:

Stored size: 937 Bytes

Contents

HAL.Views.EmbeddedResources = Backbone.View.extend({
  initialize: function(opts) {
    this.vent = opts.vent;
    _.bindAll(this, 'render');
  },

  className: 'embedded-resources accordion',

  render: function(resources) {
    var self = this,
        resourceViews = [],
        buildView = function(resource) {
          return new HAL.Views.EmbeddedResource({
            resource: resource,
            vent: self.vent
          });
        };

    _.each(resources, function(prop) {
      if ($.isArray(prop)) {
        _.each(prop, function(resource) {
          resourceViews.push(buildView(resource));
        });
      } else {
        resourceViews.push(buildView(prop));
      }
    });

    this.$el.html(this.template());

    _.each(resourceViews, function(view) {
      view.render();
      self.$el.append(view.el);
    });


    return this;
  },

  template: _.template($('#embedded-resources-template').html())
});

Version data entries

211 entries across 211 versions & 1 rubygems

Version Path
pact_broker-2.55.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.54.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.53.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.52.2 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.52.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.52.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.51.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.50.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.50.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.49.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.48.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.47.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.47.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.46.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.45.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.44.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.43.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.42.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.41.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.40.0 vendor/hal-browser/js/hal/views/embedded_resources.js