Merge pull request #4779 from WoltLab/search-result-pagination
authorAlexander Ebert <ebert@woltlab.com>
Sun, 8 May 2022 11:42:21 +0000 (13:42 +0200)
committerGitHub <noreply@github.com>
Sun, 8 May 2022 11:42:21 +0000 (13:42 +0200)
Tracked the result page number in the url

1  2 
ts/WoltLabSuite/Core/Ui/Search/Extended.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Extended.js

index 6115fc36f4a865a680b86fefc73d1b35eefb1af3,0156b5c8bb5a108bb027ffb8e3d5d8b60597a14a..9f544e3ad8cc68fee645b30cfff771c615e0a77c
@@@ -75,28 -86,12 +86,28 @@@ export class UiSearchExtended 
    }
  
    private changeType(): void {
 +    let hasVisibleFilters = false;
      document.querySelectorAll(".objectTypeSearchFilters").forEach((filter: HTMLElement) => {
 -      filter.hidden = filter.dataset.objectType !== this.typeInput.value;
 +      if (filter.dataset.objectType === this.typeInput.value) {
 +        hasVisibleFilters = true;
 +        filter.hidden = false;
 +      } else {
 +        filter.hidden = true;
 +      }
      });
 +
 +    const title = document.querySelector(".searchFiltersTitle") as HTMLElement;
 +    if (hasVisibleFilters) {
 +      const selectedOption = this.typeInput.selectedOptions.item(0)!;
 +      title.textContent = selectedOption.textContent!.trim();
 +
 +      title.hidden = false;
 +    } else {
 +      title.hidden = true;
 +    }
    }
  
-   private async search(): Promise<void> {
+   private async search(searchAction: SearchAction): Promise<void> {
      if (!this.queryInput.value.trim() && !this.usernameInput.value.trim()) {
        return;
      }
index c9029526f8b8eacf325de01f9fbc03a232477d3e,76e9b8d7ece82dd86706e852476790a78f710b66..95b89cc9d4a82ec46fa95332fb0354f68f38668d
@@@ -51,27 -54,11 +54,27 @@@ define(["require", "exports", "tslib", 
              });
          }
          changeType() {
 +            let hasVisibleFilters = false;
              document.querySelectorAll(".objectTypeSearchFilters").forEach((filter) => {
 -                filter.hidden = filter.dataset.objectType !== this.typeInput.value;
 +                if (filter.dataset.objectType === this.typeInput.value) {
 +                    hasVisibleFilters = true;
 +                    filter.hidden = false;
 +                }
 +                else {
 +                    filter.hidden = true;
 +                }
              });
 +            const title = document.querySelector(".searchFiltersTitle");
 +            if (hasVisibleFilters) {
 +                const selectedOption = this.typeInput.selectedOptions.item(0);
 +                title.textContent = selectedOption.textContent.trim();
 +                title.hidden = false;
 +            }
 +            else {
 +                title.hidden = true;
 +            }
          }
-         async search() {
+         async search(searchAction) {
              var _a;
              if (!this.queryInput.value.trim() && !this.usernameInput.value.trim()) {
                  return;