datacite/bracco

View on GitHub
app/templates/components/model-search.hbs

Summary

Maintainability
Test Coverage
<form class="form-horizontal" {{action 'doSearch' this.query on='submit'}}>
  <div id="search" class="input-group">
    <Input
      name="query"
      @value={{this.query}}
      class="form-control"
      placeholder={{if this.placeholder this.placeholder "Type to search..."}}
      @escape-press={{action 'clear'}}
      @enter={{action 'doSearch'}}
    />
    {{#if this.hasInput}}
      <span
        id="search-clear"
        title="Clear"
        aria-label="Clear"
        {{action 'clear'}}
      >
        <i class="fas fa-times-circle"></i>
      </span>
    {{/if}}
    <div class="input-group-btn">
      <button type="submit" class="btn btn-primary hidden-xs">
        Search
      </button>
    </div>
  </div>
  {{#if this.hasFilters}}
    <span class="help-block">
      <LinkTo
        @route={{this.link}}
        @query={{hash
          page=1
          size=25
          sort=null
          query=null
          created=null
          registered=null
          state=null
          resource-type-id=null
          schema-version=null
          prefix=null
          client-id=null
          consortium-organization-id=null
          affiliation-id=null
          source=null
          year=null
          provider-id=null
          region=null
          member-type=null
          organization-type=null
          focus-area=null
          link-check-status=null
          client-type=null
          repository-type=null
          non-profit-status=null
          has-required-contacts=null
          certificate=null
          software=null
          has-citations=null
          has-views=null
          has-downloads=null
          role-name=null
        }}
      >
        Reset All
      </LinkTo>
    </span>
  {{/if}}
</form>
{{#if (gt this.model.meta.total 1)}}
  {{#if this.sortable}}
    <div id="sort" class="input-group pull-right">
      <select onchange={{action 'sort' value='target.value'}}>
        {{#each-in this.formats as |key value|}}
          <option name="sort" value={{key}} selected={{eq this.sort key}}>
            {{value}}
          </option>
        {{/each-in}}
      </select>
    </div>
  {{/if}}
  <h3 class="member-results" data-test-results>
    {{format-number this.model.meta.total}}
    {{pluralize this.model.meta.total this.modelName without-count=true}}
  </h3>
{{/if}}