Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat Nav buttons text configurable + add tests #476

Merged
merged 21 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
99d2b44
feat: make the header nav buttons text configurable
Sep 19, 2024
996003e
fix: resolve errors in app.cy tests regarding the title bar
Sep 19, 2024
a0d9e93
fix: resolve errors regarding the content tests
Sep 19, 2024
46f977f
fix: rewrite the old tests content as it was and add a arabic karshun…
Sep 19, 2024
0bb79e4
refactor: add ahiqar and gfl selektors in globals file
Sep 19, 2024
383c931
test: add tests for the feat header nav buttons text configurable
Sep 19, 2024
8ccdfc8
chore: restore the previous content in index.html
Sep 20, 2024
ee74427
fix: add combined translation keys for the header nav buttons
Sep 20, 2024
bc803d9
test: adapt the header nav buttons text according to the new translat…
Sep 20, 2024
fddb30c
chore: remove the 'labels' object from the gfl local example file
Sep 20, 2024
044f32e
chore: restore the labels object in config of local files (arabic kar…
Sep 20, 2024
93b1840
fix: show specific header nav button labels for the ahiqar editions
Sep 20, 2024
7988fcb
feat: make header navigation buttons text configurable for each project
Sep 20, 2024
fc824c8
test: remove the tests for arabic karshuni 'de'
Sep 20, 2024
935c7a5
chore: add in the translations key of config the (key,value) of nav b…
Sep 20, 2024
5bb41a1
chore: remove the translations key values from i18n en for the ahiqa…
Sep 20, 2024
625f681
chore: set the 'item' label temporarily in Title bar
Sep 20, 2024
b6b196f
chore: use the general keys (item and manifest) in config for the loc…
Sep 23, 2024
c754f39
feat: add nav buttons text configurable
Sep 23, 2024
415b03f
fix: show the item name in the title of header based on nav buttons text
Sep 23, 2024
931b282
chore: remove ahiqar arabic karshuni local
Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions examples/ahiqar-arabic-karshuni-local-de.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<!DOCTYPE html>
paulpestov marked this conversation as resolved.
Show resolved Hide resolved
<html>
<head><title>TIDO</title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="initial-scale=1,maximum-scale=5,minimum-scale=1,width=device-width">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="dist/tido.css">
<style>
html, body {
margin: 0;
}
#app {
height: 100vh;
}
</style>
</head>
<body>
<noscript><strong>We're sorry but TIDO doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong></noscript>

<div id="app"></div>
<script src="dist/tido.js"></script>
<script>
window.addEventListener('load', function () {
window.tido = new window.Tido({
"collection": "http://localhost:8181/ahiqar/textapi/ahiqar/arabic-karshuni/collection.json",
"lang": "de",
"colors": {
"forceMode": "light"
},
"panels": [
{
"label": "contents_and_metadata",
"views": [
{
"id": "tree",
"label": "contents",
"connector": {
"id": 1
}
},
{
"id": "metadata",
"label": "metadata",
"connector": {
"id": 2,
"options": {
"collection": {
"all": true
},
"manifest": {
"all": true
},
"item": {
"all": true
}
}
}
}
]
},
{
"label": "image",
"views": [
{
"id": "image",
"label": "Image",
"connector": {
"id": 3
}
}]
},
{
"label": "text",
"views": [
{
"id": "text1",
"label": "Transcription",
"default": true,
"connector": {
"id": 4,
"options": {
"type": "transcription"
}
}
},
{
"id": "text2",
"label": "Transliteration",
"connector": {
"id": 4,
"options": {
"type": "transliteration"
}
}
}
]
},
{
"label": "annotations",
"views": [
{
"id": "annotations1",
"label": "Editorial",
"connector": {
"id": 5,
"options": {
"types": [
{
"name": "Person",
"icon": "biPersonFill"
},
{
"name": "Place",
"icon": "biGeoAltFill"
},
{
"name": "Editorial Comment",
"icon": "biChatFill"
},
{
"name": "Reference",
"icon": "biBoxArrowUpRight"
}
]
}
}
},
{
"id": "annotations2",
"label": "Motif",
"connector": {
"id": 5,
"options": {
"types": [
{
"name": "Motif",
"icon": "biPenFill"
}
]
}
}
}
]
}
],
"translations": {
"en": {
"contents_and_metadata": "Contents & Metadata"
}
}
});
});
</script>
</body>
</html>
5 changes: 1 addition & 4 deletions examples/ahiqar-arabic-karshuni-local.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
window.addEventListener('load', function () {
window.tido = new window.Tido({
"collection": "http://localhost:8181/ahiqar/textapi/ahiqar/arabic-karshuni/collection.json",
"labels": {
"item": "Sheet",
"manifest": "Manuscript"
},
"lang": "en",
paulpestov marked this conversation as resolved.
Show resolved Hide resolved
"colors": {
"forceMode": "light"
},
Expand Down
5 changes: 1 addition & 4 deletions examples/gfl-local.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
window.addEventListener('load', function () {
window.tido = new window.Tido({
manifest: "http://localhost:8181/gfl/textapi/Z_1819-06-03_l/manifest.json",
labels: {
paulpestov marked this conversation as resolved.
Show resolved Hide resolved
item: "Seite",
manifest: "Dokument"
},
lang:"de",
colors: {
forceMode: "light",
primary: "#4569cc"
Expand Down
13 changes: 5 additions & 8 deletions src/components/header/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,13 @@ const hasNext = computed<boolean>(() => {
}
return true;
});
const labels = computed<Labels>(() => configStore.config.labels || {
manifest: 'manifest',
item: 'item',
});

const nextButtonLabel = computed<string>(() => (itemIndex.value === manifest.value.sequence.length - 1
? `${t('next')} ${t(labels.value.manifest ? labels.value.manifest : 'Manuscript')}`
: `${t('next')} ${t(labels.value.item)}`));
? `${t('next_manifest')}`
: `${t('next_item')}`));
const prevButtonLabel = computed<string>(() => (itemIndex.value === 0
? `${t('prev')} ${t(labels.value.manifest ? labels.value.manifest : 'Manuscript')}`
: `${t('prev')} ${t(labels.value.item)}`));
? `${t('previous_manifest')}`
: `${t('previous_item')}`));

function prev() {
const prevIndex = itemIndex.value - 1;
Expand Down
12 changes: 5 additions & 7 deletions src/components/header/TitleBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class="t-px-2 text-gray-500 dark:text-gray-300"
name="chevronRight"
/>
<span v-if="item">{{ labels.item }} {{ item.n }}</span>
<span v-if="item">{{ $t('item') }} {{ item.n }}</span>
</h2>
</template>
<template v-else>
Expand All @@ -32,7 +32,7 @@
<span
v-if="item"
class="t-align-middle"
>{{ labels.item }} {{ item.n }}</span>
>{{ $t('item') }} {{ item.n }}</span>
</h1>
</template>
</template>
Expand All @@ -50,7 +50,7 @@ import { computed } from 'vue';
import { useConfigStore } from '@/stores/config';
import { useContentsStore } from '@/stores/contents'
import BaseIcon from '@/components/base/BaseIcon.vue';

import { useI18n } from 'vue-i18n';

export interface Props {
item: Item
Expand All @@ -62,11 +62,9 @@ withDefaults(defineProps<Props>(), {

const configStore = useConfigStore()
const contentStore = useContentsStore()
const { t } = useI18n();


const collectionTitle = computed<string | null>(() => contentStore.collectionTitle);
const manifestTitle = computed<string | undefined>(() => contentStore.manifest?.label );
const labels = computed<Labels>(() => configStore.config.labels || {
manifest: 'manifest',
item: 'item',
});
</script>
10 changes: 5 additions & 5 deletions src/i18n/de/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ export default {
Letter: 'Brief',
License: 'Lizenz',
Location: 'Aktueller Aufbewahrungsort',
Manuscript: 'Manuskript',
metadata: 'Metadaten',
Motif: 'Motive',
search_hit_list: 'Trefferanzeige',
next: 'Nächste',
no_annotations_in_view: 'Die aktuelle Ansicht enthält keine Annotationen.',
no_comments_in_view: 'Die aktuelle Ansicht enthält keine Kommentare',
no_entrypoint_available: 'Keine URL zum Einstieg gefunden. Bitte überprüfen Sie Ihre Konfiguration.',
Expand All @@ -74,11 +72,14 @@ export default {
zoom_in: 'Vergrössern',
zoom_out: 'Verkleinern',
'Place of origin': 'Herkunftsort',
prev: 'Vorherige',
project_info: 'Projekt Informationen',
reset: 'Zurücksetzen',
search: 'Suche',
Sheet: 'Seite',
item: 'Seite',
next_item: 'Nächste Seite',
previous_item: 'Vorherige Seite',
next_manifest: 'Nächstes Dokument',
previous_manifest: 'Vorheriges Dokument',
show: 'Zeige',
show_hide_panels: 'Panels ein-/ausblenden',
tabs: 'Reiter',
Expand All @@ -104,7 +105,6 @@ export default {
server_error: 'Server Fehler',
other: 'Sonstiges',
subtitle: 'Untertitel',
manifest: 'Manifest',
more_annotations: 'Weitere',
undefined_role: 'Undefinierte Rolle',
not_found: 'Nicht gefunden',
Expand Down
9 changes: 5 additions & 4 deletions src/i18n/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export default {
metadata: 'Metadata',
Motif: 'Motifs',
search_hit_list: 'Search hit list',
next: 'Next',
next_item: 'Next Item',
previous_item: 'Previous Item',
next_manifest: 'Next Manifest',
previous_manifest: 'Previous Manifest',
no_annotations_in_view: 'The current view has no annotations to display.',
no_comments_in_view:
'The current view does not contain any comments to display',
Expand All @@ -78,11 +81,10 @@ export default {
zoom_in: 'Zoom in',
zoom_out: 'Zoom out',
'Place of origin': 'Place of origin',
prev: 'Previous',
project_info: 'Project Info',
reset: 'Reset',
search: 'Search',
Sheet: 'Sheet',
item: 'Item',
show: 'Show',
show_hide_panels: 'Show/Hide Panels',
tabs: 'Tabs',
Expand All @@ -108,7 +110,6 @@ export default {
server_error: 'Server error',
other: 'Other',
subtitle: 'Subtitle',
manifest: 'Manifest',
also_selected: 'Also selected',
undefined_role: 'Undefined role',
not_found: 'Not found',
Expand Down
6 changes: 3 additions & 3 deletions tests/cypress/e2e/app.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Tido', () => {
it('Should render titles', () => {
cy.get('.header h1').contains('Textual witnesses in Arabic and Karshuni');
cy.get('.header h2').contains('Cod. Arab. 236 Copenhagen');
cy.get('.header h2').contains('Sheet 2a');
cy.get('.header h2').contains('Item 2a');
});

it('Should render panels', () => {
Expand Down Expand Up @@ -86,12 +86,12 @@ describe('Tido', () => {
.get(selectors.prevButton)
.should('be.visible')
.should('be.disabled')
.contains('Previous Manuscript');
.contains('Previous Manifest');

cy
.get(selectors.nextButton)
.should('be.visible')
.contains('Next Sheet');
.contains('Next Item');
});

//
Expand Down
6 changes: 3 additions & 3 deletions tests/cypress/e2e/content.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('Content - Multiple Tabs', () => {
// Decreasing font size
cy
.get(selectors.panel3)
.get('.actions>div:first-child button[title="Decrease"]')
.find('.actions>div:first-child button[title="Decrease"]')
.click();

cy.get('#text-content div')
Expand All @@ -142,7 +142,7 @@ describe('Content - Multiple Tabs', () => {
// Increasing font size
cy
.get(selectors.panel3)
.get('.actions>div:first-child button[title="Increase"]')
.find('.actions>div:first-child button[title="Increase"]')
.click() // 18px
.click() // 20px
.click() // 22px
Expand All @@ -160,7 +160,7 @@ describe('Content - Multiple Tabs', () => {
// Increasing font size
cy
.get(selectors.panel3)
.get('.actions>div:first-child button[title="Decrease"]')
.find('.actions>div:first-child button[title="Decrease"]')
.click() // 14px
.should('be.disabled');

Expand Down
7 changes: 4 additions & 3 deletions tests/cypress/e2e/header.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Header initial', () => {
.get(selectors.prevButton)
.should('be.visible')
.should('be.disabled')
.contains('Previous Manuscript');
.contains('Previous Manifest');
});

it('Should toggle panels', () => {
Expand Down Expand Up @@ -73,7 +73,7 @@ describe('Header - Item and Manifest changing', () => {
cy
.get(selectors.prevButton)
.should('not.be.disabled')
.contains('Previous Manuscript');
.contains('Previous Manifest');

cy
.get(selectors.prevButton)
Expand All @@ -88,7 +88,7 @@ describe('Header - Item and Manifest changing', () => {
cy
.get(selectors.nextButton)
.should('not.be.disabled')
.contains('Next Sheet');
.contains('Next Item');
paulpestov marked this conversation as resolved.
Show resolved Hide resolved

cy
.get(selectors.nextButton)
Expand All @@ -99,3 +99,4 @@ describe('Header - Item and Manifest changing', () => {
.should('include', 'tido=m7_i1');
});
});

Loading