All files / app/form/ext ext.component.html

26.26% Statements 57/217
33.33% Branches 15/45
0% Functions 0/10
38.67% Lines 41/106

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 1635x     5x 2x 5x 5x 2x   2x   5x 5x   5x 5x 2x           2x 2x         5x   2x 2x   2x             5x 2x                     2x     2x         5x 2x                         2x       5x             5x 2x           5x 2x           2x 2x         5x 2x     2x           2x                 5x   2x     2x                     2x     2x                                      
<ng-container [formGroup]="group"
              cdkDropListGroup>
 
  <label [for]="id + '-tag'" i18n>Tag:</label>
  <div class="form-array">
    <input [id]="id + '-tag'" name="tag" type="text" formControlName="tag">
    @if (showClear) {
      <button type="button" (click)="clear.next()" i18n-title title="New Ext" i18n>🆑️</button>
    }
  </div>
 
  <label [for]="id + '-name'" i18n>Name:</label>
  <input [id]="id + '-name'" name="name" type="text" formControlName="name">
 
  <ng-container [formGroup]="config">
    @if (popover) {
      <label [for]="id + '-popover'" class="editor-label" i18n>Popover:</label>
      <div #fillPopover class="fill-editor">
        <app-editor [id]="id + '-popover'"
                    name="popover"
                    [hasTags]="false"
                    [addButton]="true"
                    i18n-addCommentTitle addCommentTitle="Add popover"
                    i18n-addCommentLabel addCommentLabel="+ Add popover"
                    [fillWidth]="fillPopover"
                    [control]="popover"></app-editor>
      </div>
    }
    @if (userTheme && userThemeValues.length) {
      <!-- TODO: replace empty themes with instructions -->
      <label [for]="id + '-userTheme'" i18n>User Theme:</label>
      <div i18n-title title="This theme will be used on every page. Tag page themes will be ignored.">
        <select [id]="id + '-userTheme'" formControlName="userTheme">
          <option [ngValue]="undefined" i18n>default</option>
          @for (t of userThemeValues; track t) {
            <option [ngValue]="t">{{ t }}</option>
          }
        </select>
      </div>
    }
    @if (defaultSort && !user) {
      <label [for]="id + '-defaultSort'" i18n>Default Sort:</label>
      <span class="controls">
        <select [id]="id + '-defaultSort'" (input)="setSortCol($any($event.target).value)">
          <option></option>
          @for (opt of allSorts; track opt) {
            <option [selected]="sortCol === opt.value"
                    [value]="opt.value">{{ opt.label || opt.value }}</option>
          }
        </select>
        @switch (sortDir) {
          @case ("DESC") {
            <button type="button" (click)="setSortDir('ASC')" i18n-title title="Descending" i18n>🔽️</button>
          }
          @case ("ASC") {
            <button type="button" (click)="setSortDir('DESC')" i18n-title title="Ascending" i18n>🔼️</button>
          }
        }
      </span>
    }
    @if (defaultFilter && !user) {
      <label [for]="id + '-defaultFilter'" i18n>Default Filter:</label>
      <span class="controls">
        <select [id]="id + '-defaultFilter'" (input)="setFilter($any($event.target).value)">
          <option></option>
          @for (opt of allFilters; track opt) {
            <option [selected]="filter === opt.filter"
                    [value]="opt.filter">{{ opt.label || opt.filter }}</option>
          }
        </select>
        @if (filter) {
          @if (negatable(filter)) {
            <button type="button" (click)="toggleFilter()">{{ store.account.querySymbol('!') }}</button>
          }
          <button type="button" (click)="setFilter(null)" i18n>&ndash;</button>
        }
      </span>
    }
    @if (form) {
      <formly-form #mainFormlyForm
                   class="nested-form"
                   [form]="config"
                   [fields]="form"
                   [options]="options"></formly-form>
    }
    @if (modmail && inbox && !user) {
      <label [for]="id + '-modmail'" i18n>Enable Modmail:</label>
      <div>
        <input [id]="id + '-modmail'" type="checkbox" [formControl]="modmail">
        <a class="tag" [routerLink]="['/tag', inbox]">{{ inbox }}</a>
      </div>
    }
    @if (sidebar) {
      <label [for]="id + '-sidebar'" class="editor-label" i18n>Sidebar:</label>
      <div #fillSidebar class="fill-editor">
        <app-editor [id]="id + '-sidebar'"
                    class="bubble"
                    [hasTags]="false"
                    [addButton]="true"
                    i18n-addCommentTitle addCommentTitle="Add sidebar"
                    i18n-addCommentLabel addCommentLabel="+ Add sidebar"
                    [fillWidth]="fillSidebar"
                    [control]="sidebar"></app-editor>
      </div>
    }
    @if (themes) {
      <label [for]="id + '-theme'" i18n>Tag Page Theme:</label>
      <div>
        <select [id]="id + '-theme'" formControlName="theme">
          <option [ngValue]="undefined" i18n>default</option>
          @for (t of themeValues; track t) {
            <option [ngValue]="t">{{ t }}</option>
          }
        </select>
        <details class="advanced mini">
          <summary i18n-title title="Custom Themes"><span><span class="summary-open" i18n>Custom Themes</span></span></summary>
          <app-themes id="themes"
                      [group]="config"
                      fieldName="themes"></app-themes>
        </details>
      </div>
    }
  </ng-container>
 
  @if (advancedForm?.length) {
    <details class="advanced">
      <summary><span i18n>Advanced</span></summary>
      <div class="form">
        @if (defaultSort && user) {
          <label [for]="id + '-defaultSortAdvanced'" i18n>Default Sort:</label>
          <span class="controls">
            <select [id]="id + '-defaultSortAdvanced'" (input)="setSortCol($any($event.target).value)">
              <option></option>
              @for (opt of allSorts; track opt) {
                <option [selected]="sortCol === opt.value"
                        [value]="opt.value">{{ opt.label || opt.value }}</option>
              }
            </select>
            @switch (sortDir) {
              @case ("DESC") {
                <button type="button" (click)="setSortDir('ASC')" i18n-title title="Descending" i18n>🔽️</button>
              }
              @case ("ASC") {
                <button type="button" (click)="setSortDir('DESC')" i18n-title title="Ascending" i18n>🔼️</button>
              }
            }
          </span>
        }
        <formly-form #advancedFormlyForm
                     class="nested-form"
                     [form]="config"
                     [fields]="advancedForm!"
                     [options]="options"></formly-form>
      </div>
      @if (defaults) {
        <app-ref class="bubble" [ref]="defaults"></app-ref>
      } @else if (loadingDefaults) {
        <app-loading></app-loading>
      }
    </details>
  }
</ng-container>