Sha256: 4299734a6df3acfcf338438921b2310fafe62b05fda084a4fad27d43fe6e2fa1

Contents?: true

Size: 1.2 KB

Versions: 103

Compression:

Stored size: 1.2 KB

Contents

export class RegistryEntry {
  /**
   * Initialize the registry
   * @param {Grant} grant the grant to display on the form
   * @param {Registry} registry the registry that holds this registry entry.
   */
  constructor(grant, registry, element, template) {
    this.grant = grant
    this.registry = registry
    this.element = element

    let row = this.createPermissionRow(grant, template);
    this.addHiddenPermField(row, grant);
    row.effect("highlight", {}, 3000);
  }

  createPermissionRow(grant, template_id) {
    let row = $(tmpl(template_id, grant));
    this.element.after(row);
    row.find('button').click(function () {
      row.remove();
    });

    return row;
  }

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

Version data entries

103 entries across 103 versions & 3 rubygems

Version Path
hyrax-5.1.0.pre.beta1 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.4 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.3 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.2 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.1 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.0 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.0.rc3 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.0.rc2 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-5.0.0.rc1 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-3.6.0 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-4.0.0 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-4.0.0.rc3 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-4.0.0.rc2 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-4.0.0.rc1 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-3.5.0 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-4.0.0.beta2 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-3.4.2 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-4.0.0.beta1 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-3.4.1 app/assets/javascripts/hyrax/permissions/registry_entry.es6
hyrax-3.4.0 app/assets/javascripts/hyrax/permissions/registry_entry.es6