Sha256: 50b39c4eaaabc452d80a65853130e4904a0bd2e8b72f52617b4c738f7b8db25a

Contents?: true

Size: 1.51 KB

Versions: 8

Compression:

Stored size: 1.51 KB

Contents

import RelationshipsControl from 'hyrax/relationships/control'
import SaveWorkControl from 'hyrax/save_work/save_work_control'
import AdminSetWidget from 'hyrax/editor/admin_set_widget'

export default class {
  constructor(element) {
    this.element = element
    this.adminSetWidget = new AdminSetWidget(element.find('select[id$="_admin_set_id"]'))
    this.sharingTabElement = $('#tab-share')

    this.sharingTab()
    this.relationshipsControl()
    this.saveWorkControl()
    this.saveWorkFixed()
  }

  // Display the sharing tab if they select an admin set that permits sharing
  sharingTab() {
    if(this.adminSetWidget && !this.adminSetWidget.isEmpty()) {
      this.adminSetWidget.on('change', () => this.sharingTabVisiblity(this.adminSetWidget.isSharing()))
      this.sharingTabVisiblity(this.adminSetWidget.isSharing())
    }
  }

  sharingTabVisiblity(visible) {
      if (visible)
         this.sharingTabElement.removeClass('hidden')
      else
         this.sharingTabElement.addClass('hidden')
  }

  relationshipsControl() {
      new RelationshipsControl(this.element.find('[data-behavior="child-relationships"]'),
                               'work_members_attributes',
                               'tmpl-child-work')
  }

  saveWorkControl() {
      new SaveWorkControl(this.element.find("#form-progress"), this.adminSetWidget)
  }

  saveWorkFixed() {
      // Setting test to false to skip native and go right to polyfill
      FixedSticky.tests.sticky = false
      this.element.find('#savewidget').fixedsticky()
  }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyrax-1.1.1 app/assets/javascripts/hyrax/editor.es6
hyrax-1.1.0 app/assets/javascripts/hyrax/editor.es6
hyrax-1.0.5 app/assets/javascripts/hyrax/editor.es6
hyrax-1.0.4 app/assets/javascripts/hyrax/editor.es6
hyrax-1.0.3 app/assets/javascripts/hyrax/editor.es6
hyrax-1.0.2 app/assets/javascripts/hyrax/editor.es6
hyrax-1.0.1 app/assets/javascripts/hyrax/editor.es6
hyrax-1.0.0.rc2 app/assets/javascripts/hyrax/editor.es6