Sha256: 09af1ef9dafea6a2bb302dc87aec04085ea6cd00ff035c89020f1cfdf3732faa

Contents?: true

Size: 1.44 KB

Versions: 13

Compression:

Stored size: 1.44 KB

Contents

pageflow.linkmapPage.AreasListView = Backbone.Marionette.View.extend({
  className: 'linkmap_page_areas_list',

  render: function() {
    this.model.linkmapAreas().resetSelection();

    this.subview(new pageflow.linkmapPage.EditableAreasModeView({
      model: this.model.page
    }));

    this.appendSubview(new pageflow.ListView({
      label: I18n.t('pageflow.linkmap_page.editor.views.areas_list.label'),
      collection: this.model.linkmapAreas(),
      highlight: true,
      sortable: true,

      onEdit: function(model) {
        pageflow.editor.navigate(model.editPath(), {trigger: true});
      },

      itemDescription: function(area) {
        return area.label();
      },

      itemTypeName: function(area) {
        return {
          'audio_file': 'audio',
          'page': 'internal_links_list',
          'external_site': 'external_links',
          'text_only': 'text_only'
        }[area.get('target_type')];
      },

      itemTypeDescription: function(area) {
        return I18n.t('pageflow.linkmap_page.editor.area_types.' + area.get('target_type'));
      },

      itemIsInvalid: function(area) {
        return !area.target() && area.get('target_type') !== 'text_only';
      },
    }));

    this.appendSubview(new pageflow.DropDownButtonView({
      sortable: true,
      label: I18n.t('pageflow.linkmap_page.editor.views.areas_list.add'),
      items: pageflow.linkmapPage.areaTypesFor(this.model)
    }));

    return this;
  }
});

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pageflow-linkmap-page-2.10.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.9.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.8.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.7.1 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.7.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.6.1 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.6.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.5.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.4.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.3.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.2.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.1.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js
pageflow-linkmap-page-2.0.0 app/assets/javascript/pageflow/linkmap_page/editor/views/areas_list_view.js