Sha256: da568e76266ccca3ed1b7ca0fcded0863655d86f52b5a1b78c9676ba06c7203a

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

Contents

export default class RegistryEntry {
  /**
   * Initialize the registry entry
   * @param {Work} work the work to display on the form
   * @param {Registry} registry the registry that holds this registry entry.
   * @param {jQuery} element a place to insert the new row
   * @param {String} template identifer of the new row template.
   */
  constructor(work, registry, element, template) {
    this.work = work
    this.registry = registry
    this.element = element

    let row = this.createRow(work, template);
    this.addHiddenField(row, work);
    row.effect("highlight", {}, 3000);
  }

  // Remove a row that has not been persisted
  createRow(work, templateId) {
    let row = $(tmpl(templateId, work));
    this.element.before(row);
    row.find('[data-behavior="remove-relationship"]').click(function () {
      row.remove();
    });

    return row;
  }

  addHiddenField(element, work) {
      var prefix = this.registry.fieldPrefix(work.index);
      $('<input>').attr({
          type: 'hidden',
          name: prefix + '[id]',
          value: work.id
      }).appendTo(element);
  }
}

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.3 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-1.1.0 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.2 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.1 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.rc3 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.rc2 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.rc1 app/assets/javascripts/hyrax/relationships/registry_entry.es6
sufia-7.4.1 app/assets/javascripts/sufia/relationships/registry_entry.es6
hyrax-1.0.5 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.beta5 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.beta4 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.beta3 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-2.0.0.beta2 app/assets/javascripts/hyrax/relationships/registry_entry.es6
sufia-7.4.0 app/assets/javascripts/sufia/relationships/registry_entry.es6
hyrax-2.0.0.beta1 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-1.0.4 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-1.0.3 app/assets/javascripts/hyrax/relationships/registry_entry.es6
hyrax-1.0.2 app/assets/javascripts/hyrax/relationships/registry_entry.es6