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.112.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.111.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.109.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.109.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.108.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.107.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.107.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.107.0.beta.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.106.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.105.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.104.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.103.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.102.2 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.102.1 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.102.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.101.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.100.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.99.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.98.0 vendor/hal-browser/js/hal/views/embedded_resources.js
pact_broker-2.97.0 vendor/hal-browser/js/hal/views/embedded_resources.js