Skip to content

Commit

Permalink
Add config option to directly jump to location on unambiguous alias s…
Browse files Browse the repository at this point in the history
…earch

Closes #336
  • Loading branch information
bkis committed Sep 23, 2024
1 parent 071d1de commit 8e380a3
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 42 deletions.
36 changes: 24 additions & 12 deletions Tekst-API/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12234,6 +12234,18 @@
"title": "Defaulttextid",
"description": "Default text to load in UI"
},
"alwaysShowTextInfo": {
"type": "boolean",
"title": "Alwaysshowtextinfo",
"description": "Always show text info and selector in header, even on non-text-specific pages",
"default": true
},
"directJumpOnUniqueAliasSearch": {
"type": "boolean",
"title": "Directjumponuniquealiassearch",
"description": "Directly jump to respective location when searching for unique location alias",
"default": true
},
"navBrowseEntry": {
"items": {
"$ref": "#/components/schemas/MainNavEntryTranslation"
Expand Down Expand Up @@ -12304,12 +12316,6 @@
"description": "Show location aliases in browse view",
"default": true
},
"alwaysShowTextInfo": {
"type": "boolean",
"title": "Alwaysshowtextinfo",
"description": "Always show text info and selector in header, even on non-text-specific pages",
"default": true
},
"showLogoOnLoadingScreen": {
"type": "boolean",
"title": "Showlogoonloadingscreen",
Expand Down Expand Up @@ -12410,6 +12416,18 @@
"title": "Defaulttextid",
"description": "Default text to load in UI"
},
"alwaysShowTextInfo": {
"type": "boolean",
"title": "Alwaysshowtextinfo",
"description": "Always show text info and selector in header, even on non-text-specific pages",
"default": true
},
"directJumpOnUniqueAliasSearch": {
"type": "boolean",
"title": "Directjumponuniquealiassearch",
"description": "Directly jump to respective location when searching for unique location alias",
"default": true
},
"navBrowseEntry": {
"items": {
"$ref": "#/components/schemas/MainNavEntryTranslation"
Expand Down Expand Up @@ -12480,12 +12498,6 @@
"description": "Show location aliases in browse view",
"default": true
},
"alwaysShowTextInfo": {
"type": "boolean",
"title": "Alwaysshowtextinfo",
"description": "Always show text info and selector in header, even on non-text-specific pages",
"default": true
},
"showLogoOnLoadingScreen": {
"type": "boolean",
"title": "Showlogoonloadingscreen",
Expand Down
30 changes: 20 additions & 10 deletions Tekst-API/tekst/models/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ class PlatformState(ModelBase, ModelFactoryMixin):
),
] = None

always_show_text_info: Annotated[
bool,
Field(
description=(
"Always show text info and selector in header, "
"even on non-text-specific pages"
),
),
] = True

direct_jump_on_unique_alias_search: Annotated[
bool,
Field(
description=(
"Directly jump to respective location "
"when searching for unique location alias"
),
),
] = True

nav_browse_entry: Annotated[
Translations[MainNavEntryTranslation],
Field(
Expand Down Expand Up @@ -183,16 +203,6 @@ class PlatformState(ModelBase, ModelFactoryMixin):
),
] = True

always_show_text_info: Annotated[
bool,
Field(
description=(
"Always show text info and selector in header, "
"even on non-text-specific pages"
),
),
] = True

show_logo_on_loading_screen: Annotated[
bool,
Field(
Expand Down
36 changes: 24 additions & 12 deletions Tekst-Web/src/api/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,18 @@ export interface components {
* @description Default text to load in UI
*/
defaultTextId?: string | null;
/**
* Alwaysshowtextinfo
* @description Always show text info and selector in header, even on non-text-specific pages
* @default true
*/
alwaysShowTextInfo?: boolean;
/**
* Directjumponuniquealiassearch
* @description Directly jump to respective location when searching for unique location alias
* @default true
*/
directJumpOnUniqueAliasSearch?: boolean;
/**
* Navbrowseentry
* @description Custom label for main navigation browse entry
Expand Down Expand Up @@ -3217,12 +3229,6 @@ export interface components {
* @default true
*/
showLocationAliases?: boolean;
/**
* Alwaysshowtextinfo
* @description Always show text info and selector in header, even on non-text-specific pages
* @default true
*/
alwaysShowTextInfo?: boolean;
/**
* Showlogoonloadingscreen
* @description Show logo on loading screen
Expand Down Expand Up @@ -3287,6 +3293,18 @@ export interface components {
* @description Default text to load in UI
*/
defaultTextId?: string | null;
/**
* Alwaysshowtextinfo
* @description Always show text info and selector in header, even on non-text-specific pages
* @default true
*/
alwaysShowTextInfo?: boolean;
/**
* Directjumponuniquealiassearch
* @description Directly jump to respective location when searching for unique location alias
* @default true
*/
directJumpOnUniqueAliasSearch?: boolean;
/**
* Navbrowseentry
* @description Custom label for main navigation browse entry
Expand Down Expand Up @@ -3335,12 +3353,6 @@ export interface components {
* @default true
*/
showLocationAliases?: boolean;
/**
* Alwaysshowtextinfo
* @description Always show text info and selector in header, even on non-text-specific pages
* @default true
*/
alwaysShowTextInfo?: boolean;
/**
* Showlogoonloadingscreen
* @description Show logo on loading screen
Expand Down
4 changes: 2 additions & 2 deletions Tekst-Web/src/components/search/QuickSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ async function handleSearch() {
});
if (!error && !!data.length) {
if (data.length === 1) {
// there is one matching location alias, so we navigate to this location
if (data.length === 1 && !!pfData.value?.state.directJumpOnUniqueAliasSearch) {
// there is one matching location alias, so we directly navigate to this location
router.push({
name: 'browse',
params: { text: state.text?.slug || '' },
Expand Down
13 changes: 9 additions & 4 deletions Tekst-Web/src/views/admin/AdminSystemSettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function resetForm() {
<n-divider />
<h3>{{ $t('admin.system.platformSettings.headingConfig') }}</h3>

<h4>{{ $t('admin.system.platformSettings.headingConfigTexts') }}</h4>
<h4>{{ $t('admin.system.platformSettings.headingConfigTextsLocs') }}</h4>

<!-- DEFAULT TEXT -->
<n-form-item path="defaultTextId" :label="$t('models.platformSettings.defaultText')">
Expand All @@ -140,13 +140,18 @@ function resetForm() {
/>
</n-form-item>

<!-- ALWAYS SHOW TEXT INFO, ALSO ON NON-TEXT-SPECIFIC PAGES? -->
<n-form-item :show-label="false">
<n-flex vertical>
<!-- ALWAYS SHOW TEXT INFO, ALSO ON NON-TEXT-SPECIFIC PAGES? -->
<labelled-switch
v-model="formModel.alwaysShowTextInfo"
:label="$t('models.platformSettings.alwaysShowTextInfo')"
/>
</n-form-item>
<!-- DIRECT JUMP ON UNIQUE ALIAS SEARCH -->
<labelled-switch
v-model="formModel.directJumpOnUniqueAliasSearch"
:label="$t('models.platformSettings.directJumpOnUniqueAliasSearch')"
/>
</n-flex>

<h4>{{ $t('admin.system.platformSettings.headingConfigI18n') }}</h4>

Expand Down
3 changes: 2 additions & 1 deletion Tekst-Web/translations/ui/deDE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ models:
navInfoEntry: Eigene Beschriftung für "Info" in Hauptnavigation
registerIntroText: Eigener Einführungstext für Registrierungsseite
alwaysShowTextInfo: Zeige Textinformationen und -auswahl auch auf nicht-textspezifischen Seiten
directJumpOnUniqueAliasSearch: Springe direkt zu entsprechender Belegstelle bei Suche nach eindeutigem Belegstellen-Alias
showLogoOnLoadingScreen: Zeige Logo in Ladebildschirm
showLogoInHeader: Zeige Logo in Kopfzeile
showTekstFooterHint: Zeige kleinen Hinweis auf Tekst-Software in Fußzeile (Danke ♥)
Expand Down Expand Up @@ -779,7 +780,7 @@ admin:
platformSettings:
headingInfo: Plattform-Informationen
headingConfig: Allgemeine Konfiguration
headingConfigTexts: Texte
headingConfigTextsLocs: Texte und Belegstellen
headingConfigI18n: Internationalisierung
headingConfigCustomLabels: Benutzerdefinierte Beschriftungen
headingConfigBrowseView: Lese-Ansicht
Expand Down
3 changes: 2 additions & 1 deletion Tekst-Web/translations/ui/enUS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ models:
navInfoEntry: Custom label for "Info" in main navigation
registerIntroText: Custom introduction text for register page
alwaysShowTextInfo: Show text info and selector in header even on non-text-specific pages
directJumpOnUniqueAliasSearch: Directly jump to respective location when searching for unambiguous location alias
showLogoOnLoadingScreen: Show logo on loading screen
showLogoInHeader: Show logo in page header
showTekstFooterHint: Show small hint to Tekst software in footer (Thank you ♥)
Expand Down Expand Up @@ -755,7 +756,7 @@ admin:
platformSettings:
headingInfo: Platform Information
headingConfig: General Configuration
headingConfigTexts: Texts
headingConfigTextsLocs: Texts and Locations
headingConfigI18n: Internationalization
headingConfigCustomLabels: Custom Labels
headingConfigBrowseView: Browse View
Expand Down

0 comments on commit 8e380a3

Please sign in to comment.