datacite/bracco

View on GitHub
app/templates/components/doi-alternate-identifiers.hbs

Summary

Maintainability
Test Coverage
<div class="form-group">
  <label class="control-label col-md-3" data-test-alternate-identifiers>Alternate Identifiers</label>
  <div class="col-md-9">
    <div class="label-vertical">An identifier or identifiers other than the primary Identifier applied to the resource being registered.</div>
    {{#if this.showAlternateIdentifiers}}
      {{#each this.model.alternateIdentifiers as |alternateIdentifier index|}}
        <DoiAlternateIdentifier @model={{this.model}} @fragment={{alternateIdentifier}} @form={{this.form}} @index={{index}} />
      {{/each}}

      {{#if (lte this.model.alternateIdentifiers.length 4)}}
        <BsButton class="btn-sm" id="add-alternate-identifier" @outline={{true}} @onClick={{action "addAlternateIdentifier"}}><i class="fas fa-plus"></i> Add {{if (gt this.model.alternateIdentifiers.length 1) "another "}} alternate identifier</BsButton>
      {{/if}}

      {{#if (gt this.model.alternateIdentifiers.length 0)}}
        <BsButton id="toggle-alternate-identifiers" class="btn-sm" @outline={{true}} @onClick={{action "toggleAlternateIdentifiers"}}><i class="fas fa-eye-slash"></i> Hide {{pluralize this.model.alternateIdentifiers.length 'alternate identifier'}}</BsButton>
      {{/if}}
    {{else}}
      {{#if (gt this.model.alternateIdentifiers.length 0)}}
        <BsButton id="toggle-alternate-identifiers" class="btn-sm" @outline={{true}} @onClick={{action "toggleAlternateIdentifiers"}}><i class="fas fa-eye"></i> Show {{pluralize this.model.alternateIdentifiers.length 'alternate identifier'}}</BsButton>
      {{else}}
        <BsButton class="btn-sm btn-warning" id="add-alternate-identifier" @outline={{true}} @onClick={{action "addAlternateIdentifier"}}><i class="fas fa-plus"></i> Add alternate identifier</BsButton>
      {{/if}}
    {{/if}}
  </div>
</div>