Skip to content

Commit

Permalink
Merge pull request #133 from abes-esr/THE-933-Page-personne-rendre-le…
Browse files Browse the repository at this point in the history
…s-noms-des-personnes-cliquables

The 933 page personne rendre les noms des personnes cliquables
  • Loading branch information
clementdelafontaine authored Sep 25, 2023
2 parents 6af1f8c + 18510e8 commit f662a24
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/components/theses/results/ResultCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
{{ $t('resultCard.par') }}{{ '\xa0' }}
</span>

<span v-for="(item, index) in auteur" :key="item.ppn">
<span :class="item.ppn ? 'clickable lightblue' : ''" @click="linkTo(item.ppn)">
<span v-for="(item, index) in auteur" :key="item.ppn ? item.ppn : item.id">
<span :class="item.ppn || item.id ? 'clickable lightblue' : ''" @click="linkTo(item.ppn ? item.ppn : item.id)">
<span class="card-text">{{ item.prenom }}{{ '\xa0' }}</span>
<span class="card-text">{{ item.nom }}</span>
</span>{{ '\xa0' }}
Expand All @@ -50,8 +50,8 @@
{{ $t('resultCard.dir') }}{{ '\xa0' }}
</span>

<span v-for="(item, index) in directeurs" :key="item.ppn">
<span :class="item.ppn ? 'clickable lightblue' : ''" @click="linkTo(item.ppn)">
<span v-for="(item, index) in directeurs" :key="item.ppn ? item.ppn : item.id">
<span :class="item.ppn || item.id ? 'clickable lightblue' : ''" @click="linkTo(item.ppn ? item.ppn : item.id)">
<span class="card-text">
{{ item.prenom }}{{ '\xa0' }}
</span>
Expand Down
5 changes: 4 additions & 1 deletion src/services/StrategyAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ function setSorting(value) {
}

function setDomaine(newDomain) {
domaine.value = newDomain;
if (newDomain !== 'undefined')
domaine.value = newDomain;
else
domaine.value = 'theses';
updateURL();
}

Expand Down
53 changes: 34 additions & 19 deletions src/views/PersonneView.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<Message-box ref="messageBox"></Message-box>
<!-- Mobile-->
<header-mobile v-if="mobile" class="header-mobile" @changeDomain="changeDomain" @search="search" @searchAndReinitializeAllFacets="searchAndReinitializeAllFacets" @displayError="displayError"
<header-mobile v-if="mobile" class="header-mobile" @displayError="displayError"
@activateMenu="activateMenu" @activateSearchBar="activateSearchBar" @activateFilterMenu="activateFilterMenu"
:loading="loading" :show-menu="showMenu" :show-search-bar="showSearchBar"
></header-mobile>
Expand All @@ -16,7 +16,7 @@
<h1>{{ $t("slogan") }}</h1>
</div>
<div class="sub_header__action">
<domain-selector @changeDomain="changeDomain" compact></domain-selector>
<domain-selector compact></domain-selector>
<search-bar @searchAndReinitializeAllFacets="searchAndReinitializeAllFacets" :loading="loading"
@onError="displayError"/>
</div>
Expand Down Expand Up @@ -99,7 +99,7 @@
import {useMeta} from 'vue-meta';
import {useI18n} from "vue-i18n";
import {defineAsyncComponent, onBeforeMount, onUpdated, ref, watchEffect} from 'vue';
import { defineAsyncComponent, onBeforeMount, onUpdated, ref, watch, watchEffect } from "vue";
import SearchBar from '../components/generic/GenericSearchBar.vue';
import DomainSelector from '@/components/common/DomainSelector.vue';
Expand All @@ -126,11 +126,6 @@ const showMenu = ref(false);
const {t} = useI18n();
const {meta} = useMeta({});
watchEffect(() => {
const titlePersonne = item.value.prenom ? item.value.prenom + " " + item.value.nom : "";
meta.title = titlePersonne;
meta.description = t("meta.descPersonne") + titlePersonne;
});
const props = defineProps({
id: {
Expand All @@ -141,7 +136,34 @@ const props = defineProps({
onBeforeMount(() => {
loadData();
});
onUpdated(() => {
if (currentRoute.hash) {
document.getElementById(currentRoute.hash.substring(1))?.scrollIntoView({behavior: "smooth"});
}
});
const messageBox = ref(null);
/**
* Watchers
*/
watchEffect(() => {
const titlePersonne = item.value.prenom ? item.value.prenom + " " + item.value.nom : "";
meta.title = titlePersonne;
meta.description = t("meta.descPersonne") + titlePersonne;
});
watch(() => props.id, () => {
loadData();
});
/**
* Fonctions
*/
function loadData() {
dataReady.value = false;
getPersonne(props.id).then(result => {
item.value = result;
Expand All @@ -158,15 +180,7 @@ onBeforeMount(() => {
displayError(error.message);
}
});
});
onUpdated(() => {
if (currentRoute.hash) {
document.getElementById(currentRoute.hash.substring(1))?.scrollIntoView({behavior: "smooth"});
}
});
const messageBox = ref(null);
}
/**
* Retourne le nom de l'ancre HTML en fonction de la clé du rôle
Expand Down Expand Up @@ -459,11 +473,12 @@ function sleep(ms) {
}
.skeleton {
margin-bottom: 3em;
margin-bottom: 1em;
display: flex;
}
.skeleton-wrapper {
padding: 2em 0;
display: unset;
}
:deep(.v-skeleton-loader__button) {
Expand Down

0 comments on commit f662a24

Please sign in to comment.