Sha256: 0eccf0dc68dacdaa0c237520e946a6c3234d31dc0e4e0dba27e9c6afdc84de42

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

pageflow.chart.IframeEmbeddedView = Backbone.Marionette.View.extend({
  modelEvents: {
    'change': 'update'
  },

  render: function() {
    this.updateScrapedSite();
    return this;
  },

  update: function() {
    if (this.model.hasChanged(this.options.propertyName)) {
      this.updateScrapedSite();
    }
  },

  updateScrapedSite: function() {
    if (this.scrapedSite) {
      this.stopListening(this.scrapedSite);
    }

    this.scrapedSite = this.model.getReference(this.options.propertyName,
                                               'pageflow_chart_scraped_sites');
    this.updateAttributes();

    if (this.scrapedSite) {
      this.listenTo(this.scrapedSite, 'change', this.updateAttributes);
    }
  },

  updateAttributes: function() {
    var scrapedSite = this.scrapedSite;

    if (scrapedSite && scrapedSite.isReady()) {
      this.$el.attr('src', scrapedSite.get('html_file_url'));

      if (scrapedSite.get('use_custom_theme')) {
        this.$el.attr('data-use-custom-theme', 'true');
      }
      else {
        this.$el.removeAttr('data-use-custom-theme');
      }
    }
    else {
      this.$el.attr('src', '');
    }
  }
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-chart-2.3.0 app/assets/javascripts/pageflow/chart/editor/views/embedded/iframe_embedded_view.js
pageflow-chart-2.2.0 app/assets/javascripts/pageflow/chart/editor/views/embedded/iframe_embedded_view.js