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

4.4 KB
Raw Blame
<spot-drop-modal
  [opened]="dropModalOpen"
  [allowRepositioning]="false"
  (closed)="close()"
  alignment="bottom-start"
  class="op-project-list-modal"
  >
  <button
    id="projects-menu"
    accesskey="5"
    aria-haspopup="true"
    class="op-project-select--trigger-button"
    type="button"
    slot="trigger"
    (click)="toggleDropModal()"
    data-test-selector="op-projects-menu"
    >
    <span
      class="ellipsis"
      [textContent]="currentProjectName()"
      [attr.title]="currentProjectName()">
    </span>
    <i class="button--dropdown-indicator"></i>
  </button>

  <ng-container slot="body">
    <div class="op-project-list-modal--header">
      <h1
        class="op-project-list-modal--title"
        [textContent]="text.project.plural"
      ></h1>

      @if (this.currentUserService.isLoggedIn) {
        <spot-toggle [options]="displayModeOptions"
          [ngModel]="displayMode"
          (ngModelChange)="displayModeChange($event)"
         />
      }
    </div>
    @if (projects$ | async; as projects) {
      <div
        class="op-project-list-modal--body spot-container"
        data-searchable-list-parent="true"
        >
        @if (displayMode !== 'favorited' || (favorites$ | async)?.length > 0) {
          <spot-text-field
            [placeholder]="displayMode === 'favorited' ? text.search_favorites_placeholder : text.search_placeholder"
            [(ngModel)]="searchableProjectListService.searchText"
            [ngModelOptions]="{standalone: true}"
            data-test-selector="op-header-project-select--search"
            data-modal-focus-catcher-container="true"
            (keydown)="searchableProjectListService.onKeydown($event, projects)"
            (inputFocus)="textFieldFocused = true"
            (inputBlur)="textFieldFocused = false"
            >
            <svg search-icon slot="before" size="small" class="op-header-project-select--search-icon"/>
          </spot-text-field>
        }
        @if ((loading$ | async) === false) {
          @if (anyProjectsFound(projects, (favorites$ | async))) {
            <ul
              op-header-project-select-list
              class="spot-list_active"
              [projects]="projects"
              [displayMode]="displayMode"
              [favorited]="favorites$ | async"
              [searchText]="searchableProjectListService.searchText"
              [root]="true"
              data-list-root="true"
              data-test-selector="op-header-project-select--list"
            ></ul>
          } @else {
            @if (displayMode === 'favorited' && (favorites$ | async).length === 0) {
              <div
                class="op-header-project-select--no-favorites"
                >
                <svg
                  class="op-header-project-select--no-favorites-icon"
                  star-icon
                  size="medium"
                ></svg>
                <p>
                  <strong [textContent]="text.no_favorites"></strong>
                  <br/>
                  <span class="op-header-project-select--no-favorites-subtext"
                  [textContent]="text.no_favorites_subtext"></span>
                </p>
              </div>
            }
            @if (!(displayMode === 'favorited' && (favorites$ | async).length === 0)) {
              <span
                class="op-project-list-modal--no-results">
                {{ displayMode === 'favorited' ? text.no_favorite_results : text.no_results }}
              </span>
            }
          }
        } @else {
          <op-loading-project-list class="op-project-list-modal--loading" />
        }
        @if (!portfolioModelsEnabled) {
          <div
            class="spot-action-bar">
            <div class="spot-action-bar--right">
              <a
                class="button spot-action-bar--action"
                [href]="allProjectsPath()"
                >
                <svg list-unordered-icon size="small" />
                <span [textContent]="text.project.list"></span>
              </a>
              @if (canCreateNewProjects$ | async) {
                <a
                  class="button -primary spot-action-bar--action"
                  [href]="newProjectPath()"
                  >
                  <svg plus-icon size="small" />
                  <span [textContent]="text.project.singular"></span>
                </a>
              }
            </div>
          </div>
        }
      </div>
    }
  </ng-container>

</spot-drop-modal>