Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

1.9 KB
Raw Blame
<ng-select
  appendTo=".spot-modal-overlay"
  [formControl]="spotFormBinding"
  [addTag]="showAddTag ? createNewFromInput.bind(this) : false"
  [typeahead]="input$"
  [items]="items$ | async"
  [clearable]="true"
  [clearOnBackspace]="false"
  [clearSearchOnAdd]="false"
  [compareWith]="compareWith"
  bindValue="principal"
  #ngselect
  >
  <ng-template ng-label-tmp let-item="item">
    {{ item.principal?.name || item.name }}
  </ng-template>

  <ng-template ng-option-tmp let-item="item" let-search="searchTerm">
    @if (item) {
      <div
        class="ng-option-label"
        >
        <!--Selectable option-->
        <span
          data-hover-card-trigger-target="trigger"
          [attr.data-hover-card-url]="getHoverCardUrl(item.principal)"
        [ngOptionHighlight]="search">{{ item.principal.name }}</span>
        @if (item.principal.email) {
          <span
            class="op-autocompleter__option-principal-email"
          [ngOptionHighlight]="search">{{ item.principal.email }}</span>
        }
        <!-- Already a member of the project -->
        @if (item.disabled) {
          <div
          class="ellipsis">{{ text.alreadyAMember() }}</div>
        }
      </div>
    }
  </ng-template>

  <!--Nothing found -->
  <ng-template ng-notfound-tmp>
    <div class="ng-option disabled">
      {{ text.noResults[type] }}
    </div>
  </ng-template>


  <ng-template ng-tag-tmp>
    <!--Invite a new user by email-->
    @if (canInviteByEmail$ | async) {
      <div>
        <op-icon icon-classes="icon-mail1 icon-context" />
        <b>{{ text.inviteNewUser }}</b>
        {{ input }}
      </div>
    }

    <!--Create a new placeholder by name-->
    @if (canCreateNewPlaceholder$ | async) {
      <div>
        <op-icon icon-classes="icon-add icon-context" />
        <b>{{ text.createNewPlaceholder }}</b>
        {{ input }}
      </div>
    }
  </ng-template>
</ng-select>