Fix search filters reset button

pull/6610/head
Chocobozzz 2024-08-21 15:29:46 +02:00
parent a06c2ea020
commit f31da23625
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 18 additions and 14 deletions

View File

@ -5,7 +5,7 @@
<fieldset class="form-group" role="radiogroup"> <fieldset class="form-group" role="radiogroup">
<div class="radio-label label-container"> <div class="radio-label label-container">
<label for="sort" i18n>Sort</label> <label for="sort" i18n>Sort</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('sort', '-match')" *ngIf="advancedSearch.sort !== '-match'"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('sort', '-match')" *ngIf="advancedSearch.sort !== '-match'">
Reset Reset
</button> </button>
</div> </div>
@ -19,7 +19,7 @@
<div class="form-group" role="radiogroup"> <div class="form-group" role="radiogroup">
<div class="radio-label label-container"> <div class="radio-label label-container">
<label for="isLive" i18n>Display only</label> <label for="isLive" i18n>Display only</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('isLive')" *ngIf="advancedSearch.isLive !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('isLive')" *ngIf="advancedSearch.isLive !== undefined">
Reset Reset
</button> </button>
</div> </div>
@ -38,7 +38,7 @@
<div class="form-group" role="radiogroup"> <div class="form-group" role="radiogroup">
<div class="radio-label label-container"> <div class="radio-label label-container">
<label for="sensitiveContent" i18n>Display sensitive content</label> <label for="sensitiveContent" i18n>Display sensitive content</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('nsfw')" *ngIf="advancedSearch.nsfw !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('nsfw')" *ngIf="advancedSearch.nsfw !== undefined">
Reset Reset
</button> </button>
</div> </div>
@ -57,7 +57,7 @@
<div class="form-group"> <div class="form-group">
<div class="radio-label label-container"> <div class="radio-label label-container">
<label for="publishedDateRange" i18n>Published date</label> <label for="publishedDateRange" i18n>Published date</label>
<button i18n class="reset-button reset-button-small" (click)="resetLocalField('publishedDateRange')" *ngIf="publishedDateRange !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetLocalField('publishedDateRange')" *ngIf="publishedDateRange !== undefined">
Reset Reset
</button> </button>
</div> </div>
@ -71,7 +71,7 @@
<div class="form-group"> <div class="form-group">
<div class="label-container"> <div class="label-container">
<label i18n for="original-publication-after">Original publication year</label> <label i18n for="original-publication-after">Original publication year</label>
<button i18n class="reset-button reset-button-small" (click)="resetOriginalPublicationYears()" *ngIf="originallyPublishedStartYear || originallyPublishedEndYear"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetOriginalPublicationYears()" *ngIf="originallyPublishedStartYear || originallyPublishedEndYear">
Reset Reset
</button> </button>
</div> </div>
@ -106,7 +106,7 @@
<div class="form-group" role="radiogroup"> <div class="form-group" role="radiogroup">
<div class="radio-label label-container"> <div class="radio-label label-container">
<label for="durationRange" i18n>Duration</label> <label for="durationRange" i18n>Duration</label>
<button i18n class="reset-button reset-button-small" (click)="resetLocalField('durationRange')" *ngIf="durationRange !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetLocalField('durationRange')" *ngIf="durationRange !== undefined">
Reset Reset
</button> </button>
</div> </div>
@ -119,7 +119,7 @@
<div class="form-group"> <div class="form-group">
<label i18n for="category">Category</label> <label i18n for="category">Category</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('categoryOneOf')" *ngIf="advancedSearch.categoryOneOf !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('categoryOneOf')" *ngIf="advancedSearch.categoryOneOf !== undefined">
Reset Reset
</button> </button>
<div class="peertube-select-container"> <div class="peertube-select-container">
@ -132,7 +132,7 @@
<div class="form-group"> <div class="form-group">
<label i18n for="licence">Licence</label> <label i18n for="licence">Licence</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('licenceOneOf')" *ngIf="advancedSearch.licenceOneOf !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('licenceOneOf')" *ngIf="advancedSearch.licenceOneOf !== undefined">
Reset Reset
</button> </button>
<div class="peertube-select-container"> <div class="peertube-select-container">
@ -145,7 +145,7 @@
<div class="form-group"> <div class="form-group">
<label i18n for="language">Language</label> <label i18n for="language">Language</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('languageOneOf')" *ngIf="advancedSearch.languageOneOf !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('languageOneOf')" *ngIf="advancedSearch.languageOneOf !== undefined">
Reset Reset
</button> </button>
<div class="peertube-select-container"> <div class="peertube-select-container">
@ -160,7 +160,7 @@
<div class="col-lg-4 col-md-6 col-xs-12"> <div class="col-lg-4 col-md-6 col-xs-12">
<div class="form-group"> <div class="form-group">
<label i18n for="tagsAllOf">All of these tags</label> <label i18n for="tagsAllOf">All of these tags</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('tagsAllOf')" *ngIf="advancedSearch.tagsAllOf"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('tagsAllOf')" *ngIf="advancedSearch.tagsAllOf">
Reset Reset
</button> </button>
<my-select-tags name="tagsAllOf" labelForId="tagsAllOf" id="tagsAllOf" [(ngModel)]="advancedSearch.tagsAllOf"></my-select-tags> <my-select-tags name="tagsAllOf" labelForId="tagsAllOf" id="tagsAllOf" [(ngModel)]="advancedSearch.tagsAllOf"></my-select-tags>
@ -168,7 +168,7 @@
<div class="form-group"> <div class="form-group">
<label i18n for="tagsOneOf">One of these tags</label> <label i18n for="tagsOneOf">One of these tags</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('tagsOneOf')" *ngIf="advancedSearch.tagsOneOf"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('tagsOneOf')" *ngIf="advancedSearch.tagsOneOf">
Reset Reset
</button> </button>
<my-select-tags name="tagsOneOf" labelForId="tagsOneOf" id="tagsOneOf" [(ngModel)]="advancedSearch.tagsOneOf"></my-select-tags> <my-select-tags name="tagsOneOf" labelForId="tagsOneOf" id="tagsOneOf" [(ngModel)]="advancedSearch.tagsOneOf"></my-select-tags>
@ -185,7 +185,7 @@
<div class="form-group" role="radiogroup"> <div class="form-group" role="radiogroup">
<div class="radio-label label-container"> <div class="radio-label label-container">
<label for="resultType" i18n>Result types</label> <label for="resultType" i18n>Result types</label>
<button i18n class="reset-button reset-button-small" (click)="resetField('resultType')" *ngIf="advancedSearch.resultType !== undefined"> <button type="button" i18n class="reset-button reset-button-small" (click)="resetField('resultType')" *ngIf="advancedSearch.resultType !== undefined">
Reset Reset
</button> </button>
</div> </div>
@ -226,7 +226,7 @@
</div> </div>
<div class="submit-button"> <div class="submit-button">
<button i18n class="reset-button me-3" (click)="reset()" *ngIf="advancedSearch.size()"> <button type="button" i18n class="reset-button me-3" (click)="reset()" *ngIf="advancedSearch.size()">
Reset Reset
</button> </button>

View File

@ -209,7 +209,11 @@ export class SearchFiltersComponent implements OnInit {
} }
private updateModelFromDurationRange () { private updateModelFromDurationRange () {
if (!this.durationRange) return if (!this.durationRange) {
this.advancedSearch.durationMin = undefined
this.advancedSearch.durationMax = undefined
return
}
const fourMinutes = 60 * 4 const fourMinutes = 60 * 4
const tenMinutes = 60 * 10 const tenMinutes = 60 * 10