diff --git a/app/scripts/components/results.js b/app/scripts/components/results.js index b0b9f2659..f73e68c1e 100644 --- a/app/scripts/components/results.js +++ b/app/scripts/components/results.js @@ -14,6 +14,7 @@ import "@/components/sidebar" import "@/components/tab-hash" import "@/components/word-picture" import "@/directives/tab-preloader" +import settings from "@/settings" angular.module("korpApp").component("results", { template: html` @@ -21,110 +22,105 @@ angular.module("korpApp").component("results", {
- - - - KWIC - -
- - -
-
- - {{'statistics' | loc:$root.lang}} - - + + + KWIC + +
- - - - - {{'word_picture' | loc:$root.lang}} - - -
- -
- -
- - - - - - - + prev-request="proxy.prevRequest" + corpus-order="corpusOrder" + > +
+
+ + {{'statistics' | loc:$root.lang}} + + + + + + + + {{'word_picture' | loc:$root.lang}} + + +
+ +
+ +
+ + + + + +
@@ -143,8 +139,10 @@ angular.module("korpApp").component("results", { bindings: {}, controller: [ "$rootScope", + "$scope", "searches", - function ($rootScope, searches) { + "utils", + function ($rootScope, $scope, searches, utils) { const $ctrl = this $ctrl.searches = searches $ctrl.onSidebarShow = () => ($ctrl.sidebarVisible = true) @@ -155,6 +153,24 @@ angular.module("korpApp").component("results", { $rootScope.compareTabs.length || $rootScope.graphTabs.length || $rootScope.mapTabs.length + + $scope.hasStatistics = settings.statistics !== false + $scope.hasWordPicture = settings.word_picture !== false + + function updateTabs() { + $scope.tabCount = + 2 + ($scope.hasStatistics ? 1 : 0) + ($scope.hasWordPicture ? 1 : 0) + $rootScope.kwicTabs.length // TODO + ... + } + + $scope.$watch($rootScope.kwicTabs, updateTabs) + // TODO watch other tabs too + updateTabs() + + utils.setupHash($scope, { + key: "result_tab", + scope_name: "activeTab", + val_in: (tab) => Math.min(tab, $scope.tabCount), + }) }, ], }) diff --git a/app/scripts/settings/app-settings.types.ts b/app/scripts/settings/app-settings.types.ts index 710cd4017..7f9f0fc70 100644 --- a/app/scripts/settings/app-settings.types.ts +++ b/app/scripts/settings/app-settings.types.ts @@ -57,11 +57,12 @@ export type AppSettings = { news_url?: string reduce_word_attribute_selector: "union" | "intersection" reduce_struct_attribute_selector: "union" | "intersection" + statistics?: false statistics_search_default: boolean urnResolver?: string visible_modes: number word_label: Record - word_picture?: boolean + word_picture?: false word_picture_tagset?: Record word_picture_conf?: Record }