Reorganize client shared modules
[oweals/peertube.git] / client / src / app / search / search-filters.component.html
index f8b3675e51650ea640fd7727378f12b9ead1ea4b..e20aef8fbad8f942306a60dbdc85ba26165cb677 100644 (file)
@@ -3,25 +3,26 @@
   <div class="row">
     <div class="col-lg-4 col-md-6 col-xs-12">
       <div class="form-group">
-        <div i18n class="radio-label">Published date</div>
-
-        <div class="peertube-radio-container" *ngFor="let date of publishedDateRanges">
-          <input type="radio" name="publishedDateRange" [id]="date.id" [value]="date.id" [(ngModel)]="publishedDateRange">
-          <label [for]="date.id" class="radio">{{ date.label }}</label>
+        <div class="radio-label label-container">
+          <label i18n>Sort</label>
+          <button i18n class="reset-button reset-button-small" (click)="resetField('sort', '-match')" *ngIf="advancedSearch.sort !== '-match'">
+            Reset
+          </button>
         </div>
-      </div>
-
-      <div class="form-group">
-        <div i18n class="radio-label">Duration</div>
 
-        <div class="peertube-radio-container" *ngFor="let duration of durationRanges">
-          <input type="radio" name="durationRange" [id]="duration.id" [value]="duration.id" [(ngModel)]="durationRange">
-          <label [for]="duration.id" class="radio">{{ duration.label }}</label>
+        <div class="peertube-radio-container" *ngFor="let sort of sorts">
+          <input type="radio" name="sort" [id]="sort.id" [value]="sort.id" [(ngModel)]="advancedSearch.sort">
+          <label [for]="sort.id" class="radio">{{ sort.label }}</label>
         </div>
       </div>
 
       <div class="form-group">
-        <div i18n class="radio-label">Display sensitive content</div>
+        <div class="radio-label label-container">
+          <label i18n>Display sensitive content</label>
+          <button i18n class="reset-button reset-button-small" (click)="resetField('nsfw')" *ngIf="advancedSearch.nsfw !== undefined">
+            Reset
+          </button>
+        </div>
 
         <div class="peertube-radio-container">
           <input type="radio" name="sensitiveContent" id="sensitiveContentYes" value="both" [(ngModel)]="advancedSearch.nsfw">
         </div>
       </div>
 
+      <div class="form-group">
+        <div class="radio-label label-container">
+          <label i18n>Published date</label>
+          <button i18n class="reset-button reset-button-small" (click)="resetLocalField('publishedDateRange')" *ngIf="publishedDateRange !== undefined">
+            Reset
+          </button>
+        </div>
+
+        <div class="peertube-radio-container" *ngFor="let date of publishedDateRanges">
+          <input type="radio" (change)="inputUpdated()" name="publishedDateRange" [id]="date.id" [value]="date.id" [(ngModel)]="publishedDateRange">
+          <label [for]="date.id" class="radio">{{ date.label }}</label>
+        </div>
+      </div>
+
+      <div class="form-group">
+        <div class="label-container">
+          <label i18n for="original-publication-after">Original publication year</label>
+          <button i18n class="reset-button reset-button-small" (click)="resetOriginalPublicationYears()" *ngIf="originallyPublishedStartYear || originallyPublishedEndYear">
+            Reset
+          </button>
+        </div>
+
+        <div class="row">
+          <div class="pl-0 col-sm-6">
+            <input
+              (change)="inputUpdated()"
+              (keydown.enter)="$event.preventDefault()"
+              type="text" id="original-publication-after" name="original-publication-after"
+              i18n-placeholder placeholder="After..."
+              [(ngModel)]="originallyPublishedStartYear"
+              class="form-control"
+            >
+          </div>
+          <div class="pr-0 col-sm-6">
+            <input
+              (change)="inputUpdated()"
+              (keydown.enter)="$event.preventDefault()"
+              type="text" id="original-publication-before" name="original-publication-before"
+              i18n-placeholder placeholder="Before..."
+              [(ngModel)]="originallyPublishedEndYear"
+              class="form-control"
+            >
+          </div>
+        </div>
+      </div>
+
     </div>
 
     <div class="col-lg-4 col-md-6 col-xs-12">
+      <div class="form-group">
+        <div class="radio-label label-container">
+          <label i18n>Duration</label>
+          <button i18n class="reset-button reset-button-small" (click)="resetLocalField('durationRange')" *ngIf="durationRange !== undefined">
+            Reset
+          </button>
+        </div>
+
+        <div class="peertube-radio-container" *ngFor="let duration of durationRanges">
+          <input type="radio" (change)="inputUpdated()" name="durationRange" [id]="duration.id" [value]="duration.id" [(ngModel)]="durationRange">
+          <label [for]="duration.id" class="radio">{{ duration.label }}</label>
+        </div>
+      </div>
+
       <div class="form-group">
         <label i18n for="category">Category</label>
+        <button i18n class="reset-button reset-button-small" (click)="resetField('categoryOneOf')" *ngIf="advancedSearch.categoryOneOf !== undefined">
+          Reset
+        </button>
         <div class="peertube-select-container">
-          <select id="category" name="category" [(ngModel)]="advancedSearch.categoryOneOf">
-            <option></option>
+          <select id="category" name="category" [(ngModel)]="advancedSearch.categoryOneOf" class="form-control">
+            <option [value]="undefined" i18n>Display all categories</option>
             <option *ngFor="let category of videoCategories" [value]="category.id">{{ category.label }}</option>
           </select>
         </div>
 
       <div class="form-group">
         <label i18n for="licence">Licence</label>
+        <button i18n class="reset-button reset-button-small" (click)="resetField('licenceOneOf')" *ngIf="advancedSearch.licenceOneOf !== undefined">
+          Reset
+        </button>
         <div class="peertube-select-container">
-          <select id="licence" name="licence" [(ngModel)]="advancedSearch.licenceOneOf">
-            <option></option>
+          <select id="licence" name="licence" [(ngModel)]="advancedSearch.licenceOneOf" class="form-control">
+            <option [value]="undefined" i18n>Display all licenses</option>
             <option *ngFor="let licence of videoLicences" [value]="licence.id">{{ licence.label }}</option>
           </select>
         </div>
 
       <div class="form-group">
         <label i18n for="language">Language</label>
+        <button i18n class="reset-button reset-button-small" (click)="resetField('languageOneOf')" *ngIf="advancedSearch.languageOneOf !== undefined">
+          Reset
+        </button>
         <div class="peertube-select-container">
-          <select id="language" name="language" [(ngModel)]="advancedSearch.languageOneOf">
-            <option></option>
+          <select id="language" name="language" [(ngModel)]="advancedSearch.languageOneOf" class="form-control">
+            <option [value]="undefined" i18n>Display all languages</option>
             <option *ngFor="let language of videoLanguages" [value]="language.id">{{ language.label }}</option>
           </select>
         </div>
     <div class="col-lg-4 col-md-6 col-xs-12">
       <div class="form-group">
         <label i18n for="tagsAllOf">All of these tags</label>
-        <input type="text" name="tagsAllOf" id="tagsAllOf" [(ngModel)]="advancedSearch.tagsAllOf" />
+        <button i18n class="reset-button reset-button-small" (click)="resetField('tagsAllOf')" *ngIf="advancedSearch.tagsAllOf">
+          Reset
+        </button>
+        <tag-input
+          [(ngModel)]="advancedSearch.tagsAllOf" name="tagsAllOf" id="tagsAllOf"
+          [validators]="tagValidators" [errorMessages]="tagValidatorsMessages"
+          i18n-placeholder placeholder="+ Tag" i18n-secondaryPlaceholder secondaryPlaceholder="Enter a tag"
+          [maxItems]="5" [modelAsStrings]="true"
+        ></tag-input>
       </div>
 
       <div class="form-group">
         <label i18n for="tagsOneOf">One of these tags</label>
-        <input type="text" name="tagsOneOf" id="tagsOneOf" [(ngModel)]="advancedSearch.tagsOneOf" />
+        <button i18n class="reset-button reset-button-small" (click)="resetField('tagsOneOf')" *ngIf="advancedSearch.tagsOneOf">
+          Reset
+        </button>
+        <tag-input
+          [(ngModel)]="advancedSearch.tagsOneOf" name="tagsOneOf" id="tagsOneOf"
+          [validators]="tagValidators" [errorMessages]="tagValidatorsMessages"
+          i18n-placeholder placeholder="+ Tag" i18n-secondaryPlaceholder secondaryPlaceholder="Enter a tag"
+          [maxItems]="5" [modelAsStrings]="true"
+        ></tag-input>
+      </div>
+
+      <div class="form-group" *ngIf="isSearchTargetEnabled()">
+        <div class="radio-label label-container">
+          <label i18n>Search target</label>
+        </div>
+
+        <div class="peertube-radio-container">
+          <input type="radio" name="searchTarget" id="searchTargetLocal" value="local" [(ngModel)]="advancedSearch.searchTarget">
+          <label i18n for="searchTargetLocal" class="radio">Instance</label>
+        </div>
+
+        <div class="peertube-radio-container">
+          <input type="radio" name="searchTarget" id="searchTargetSearchIndex" value="search-index" [(ngModel)]="advancedSearch.searchTarget">
+          <label i18n for="searchTargetSearchIndex" class="radio">Vidiverse</label>
+        </div>
       </div>
     </div>
   </div>
 
   <div class="submit-button">
+    <button i18n class="reset-button" (click)="reset()" *ngIf="advancedSearch.size()">
+      Reset
+    </button>
+
     <input type="submit" i18n-value value="Filter">
   </div>
-</form>
\ No newline at end of file
+</form>