Skip to content

Commit

Permalink
Merge pull request #2473 from Inist-CNRS/fix/typos
Browse files Browse the repository at this point in the history
Fix(annotations): Add graphic page source in annotation view
  • Loading branch information
jonathanarnault authored Feb 4, 2025
2 parents f274427 + cc13e1d commit c7c1dce
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/phase_1/publication.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ describe('Dataset Publication', () => {
force: true,
});

cy.contains('Delete selected fields').click({ force: true });
cy.contains('Delete selected field(s)').click({ force: true });

cy.wait(1000);

Expand Down
6 changes: 3 additions & 3 deletions src/app/custom/translations.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@
"label_format_fullscreen" "Full screen" "Plein écran"
"label_format_size" "Size" "Taille"
"export_csv" "Save as CSV" "Sauvegarder en CSV"
"delete_selected_fields" "Delete selected fields" "Supprimer les champs sélectionnés"
"delete_selected_fields" "Delete selected field(s)" "Supprimer le(s) champ(s) sélectionné(s)"
"delete_selected_fields_title" " The following field will be deleted |||| The following fields will be deleted" " Le champ suivant sera supprimé |||| Les champs suivants seront supprimés"
"delete_selected_fields_helptext" "Are you sure you want to delete the selected field ? |||| Are you sure you want to delete the %{smart_count} selected fields ?" "Êtes-vous sûr de vouloir supprimer le champ sélectionné ? |||| Êtes-vous sûr de vouloir supprimer les %{smart_count} champs sélectionnés ?"
"cancel" "Cancel" "Annuler"
Expand Down Expand Up @@ -1206,7 +1206,7 @@
"annotation_step_comment" "Comment input" "Saisie du commentaire"
"annotation_step_author" "Author input" "Saisie de l'auteur"
"annotations" "Annotations" "Annotations"
"annotation_resource_not_found" "Resource has been removed" "La resource a été supprimée"
"annotation_resource_not_found" "Resource has been removed" "La ressource a été supprimée"
"annotation_field_not_found" "Field has been removed" "Le champ a été supprimé"
"annotation_resource" "Resource title" "Titre de la ressource"
"annotation_comment" "Comment" "Commentaire"
Expand All @@ -1227,7 +1227,7 @@
"annotation_author_name" "Name" "Nom"
"annotation_author_email" "Email" "E-mail"
"annotation_internal_comment" "Internal Comment" "Commentaire Interne"
"annotation_resource_link" "Open the resource" "Ouvrir la resource"
"annotation_resource_link" "Open the resource" "Ouvrir la ressource"
"annotation_home_page" "Home page" "Page d'accueil"
"annotation_graph_page" "Chart page" "Page graphique"
"annotation.resourceId" "Resource title" "Titre de la ressource"
Expand Down
19 changes: 17 additions & 2 deletions src/app/js/admin/annotations/AnnotationItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import FieldInternalIcon from '../../fields/FieldInternalIcon';
import { useTranslate } from '../../i18n/I18NContext';
import AdminOnlyAlert from '../../lib/components/AdminOnlyAlert';
import Loading from '../../lib/components/Loading';
import { useGetAnnotation } from './useGetAnnotation';
import { AnnotationForm } from './AnnotationForm';
import { AnnotationValue } from './AnnotationValue';
import { useGetAnnotation } from './useGetAnnotation';

const tenant = sessionStorage.getItem('lodex-tenant') || DEFAULT_TENANT;

const getAnnotationResourceTitle = (annotation, translate) => {
if (annotation.field?.scope === 'graphic') {
return translate('annotation_graph_page');
}

if (!annotation.resourceUri) {
return translate('annotation_home_page');
}
Expand Down Expand Up @@ -59,7 +63,18 @@ export const AnnotationItem = () => {
{translate('annotation_header')}{' '}
{getAnnotationResourceTitle(annotation, translate)}
</Typography>
{annotation.resourceUri ? (
{annotation.field?.scope === 'graphic' ? (
<Stack direction="row">
<Typography>{annotation.field.label}</Typography>
<Link
title={translate('annotation_resource_link')}
href={`/instance/${tenant}/graph/${annotation.field.name}`}
target="_blank"
>
<OpenInNewIcon />
</Link>
</Stack>
) : annotation.resourceUri ? (
<Stack direction="row">
<Typography>{annotation.resourceUri}</Typography>
{annotation.resource && (
Expand Down

0 comments on commit c7c1dce

Please sign in to comment.