Sha256: 7026ac30a4c1621750b297ab016208d00791770a4e56439ead04084df9782b48

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

(function() {
    var iframe = function(json) {
      view.View.call(this, json);
      this.title = json.title;
      this.url = json.url;
      this.clickFocusable = true;
      this.el.addClass("iframe");
      this.h2 = $('<h2/>');
      this.el.append(this.h2);
      this.h2.text(this.title);
      this.iframe = $('<iframe />');
      this.iframe.addClass('container').addClass('quickfit');
      this.iframe.attr('src', this.url);
      this.el.append(this.iframe);
      this.reflow();
    }

    view.inherit(view.View, iframe);
    view.iframe = iframe;
    view.types.iframe = iframe;

    iframe.prototype.json = function() {
      return $.extend(view.View.prototype.json.call(this), {
        type: 'iframe',
        title: this.title,
        url: this.url
      });
    }

    var editTemplate = _.template(
      '<label for="title">Title</label>' +
      '<input type="title" name="title" value="{{title}}" /><br />' +
      '<label for="title">URL</label>' +
      '<input type="text" name="url" value="{{url}}" />'
    );

    iframe.prototype.editForm = function() {
      return editTemplate(this);
    }

    iframe.prototype.reflow = function() {
      this.iframe.height(this.el.innerHeight() - this.h2.height())
      this.iframe.width(this.width())
    }
})();

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
riemann-dash-0.2.14 lib/riemann/dash/public/views/iframe.js
riemann-dash-0.2.13 lib/riemann/dash/public/views/iframe.js
riemann-dash-0.2.12 lib/riemann/dash/public/views/iframe.js