Sha256: 659a882138c90a1e23018f00ca3e87169fbdafb967c167c9affa1839dc82efee

Contents?: true

Size: 1.79 KB

Versions: 7

Compression:

Stored size: 1.79 KB

Contents

pageflow.linkmapPage.AreasEmbeddedView = Backbone.Marionette.View.extend({
  events: {
    'linkmapbackgroundclick': function() {
      this.model.linkmapAreas(this.options.propertyName).resetSelection();
      pageflow.editor.navigate('/pages/' + this.model.page.id + '/areas', {trigger: true});
    }
  },

  render: function() {
    var view = this;

    var masksDelegator = this.masks = new pageflow.linkmapPage.MasksDelegator();

    this.$el.on('linkmapupdatemasks', function(event, options) {
      masksDelegator.updateDelegate(options.masks);
      view.updateClassNames();
    });

    this.subview(new pageflow.CollectionView({
      el: this.$el,
      collection: this.model.linkmapAreas(this.options.propertyName),
      itemViewConstructor: pageflow.linkmapPage.AreaItemEmbeddedView,
      itemViewOptions: {
        pageConfiguration: this.model,
        page: this.model.page,
        container: this.options.container,
        masks: masksDelegator
      }
    }));

    view.appendSubview(new pageflow.linkmapPage.AreaOutlinesEmbeddedView({
      model: this.model,
      areas: this.model.linkmapAreas(this.options.propertyName),
      masks: masksDelegator
    }));

    view.appendSubview(new pageflow.linkmapPage.AreaMasksPreviewEmbeddedView({
      model: this.model,
      areas: this.model.linkmapAreas(this.options.propertyName),
      masks: masksDelegator
    }));

    this.listenTo(this.model.page, 'change:areas_editable', function() {
      this.updateClassNames();
    });

    return this;
  },

  updateClassNames: function() {
    var editable = this.model.page.get('areas_editable');

    this.$el.toggleClass('editable', !!editable);
    this.$el.toggleClass('masks_available',
                         !this.masks.isEmpty() && this.model.get('background_type') !== 'hover_video');
  }
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pageflow-linkmap-page-1.5.0 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js
pageflow-linkmap-page-1.4.0 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js
pageflow-linkmap-page-1.3.0 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js
pageflow-linkmap-page-1.2.1 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js
pageflow-linkmap-page-1.2.0 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js
pageflow-linkmap-page-1.1.0 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js
pageflow-linkmap-page-1.0.0 app/assets/javascript/pageflow/linkmap_page/editor/views/embedded/areas_embedded_view.js