1
0
forked from PGL/Clyde

link listResearchers to ResearcherProfile

This commit is contained in:
Bartha Maxime 2024-04-19 12:35:07 +02:00
parent 3f4f6ed49a
commit a168d41aee
6 changed files with 33 additions and 20 deletions

View File

@ -165,7 +165,7 @@ window.addEventListener('hashchange', () => {
border-color:black; border-color:black;
height: 100%; height: 100%;
position: fixed; position: fixed;
overflow:; overflow: scroll;
transition-duration: .3s; transition-duration: .3s;
} }

View File

@ -3,6 +3,7 @@ import { ref} from "vue";
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue"; import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue"; import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
import {getFile, fetchAllResearches, addView} from "@/rest/ScientificPublications/ManageResearch.js"; import {getFile, fetchAllResearches, addView} from "@/rest/ScientificPublications/ManageResearch.js";
import {fetchResearch} from "@/rest/ScientificPublications/ResearcherProfile.js";
const input = ref("") const input = ref("")
const isFilterOpened = ref(false); const isFilterOpened = ref(false);
const isResearchOpened = ref(false); const isResearchOpened = ref(false);
@ -37,9 +38,10 @@ const downloadBibTex = (research) => {
getFile(research.bibTexLocation) getFile(research.bibTexLocation)
} }
const downloadArticle = (research) => { async function downloadArticle (research){
addView(research.pdfLocation) await addView(research.pdfLocation)
getFile(research.pdfLocation) await getFile(research.pdfLocation)
articleToDisplay.value = await fetchResearch(articleToDisplay.value.id)
} }
function downloadCoAuthors(){ function downloadCoAuthors(){
@ -97,12 +99,12 @@ function lDistance(s,t){
<button id="filterButton" @click="openFilter"> Filters </button> <button id="filterButton" @click="openFilter"> Filters </button>
<button v-if="!isResearcher" id="unToggledResearchButton" @click="isResearcher = !isResearcher"> Toggle Researcher Search</button> <button v-if="!isResearcher" id="unToggledResearchButton" @click="isResearcher = !isResearcher"> Toggle Researcher Search</button>
<button v-if="isResearcher" id="toggledResearchButton" @click="isResearcher = !isResearcher"> UnToggle Researcher Search</button> <button v-if="isResearcher" id="toggledResearchButton" @click="isResearcher = !isResearcher"> UnToggle Researcher Search</button>
</div> </div>
<ul id="researchUL"> <ul id="researchUL">
<li id="researchLi" v-for="n in searchInList(researchList,input)"> <li id="researchLi" v-for="n in searchInList(researchList,input)">
<div class="vl"> {{n.title}}</div> <div class="vl"> {{n.title}}</div>
<div class="vl"> {{ n.researcher.user.firstName +" "+ n.researcher.user.lastName }}</div> <div class="vl"> <a :href="'#/researcher-profile?id=' + n.researcher.id"> {{ n.researcher.user.firstName +" "+ n.researcher.user.lastName }}</a>
</div>
<a @click="openResearch(n)"> MoreInfo </a></li> <a @click="openResearch(n)"> MoreInfo </a></li>
</ul> </ul>
</div> </div>

View File

@ -9,7 +9,7 @@
import { ref, reactive } from "vue"; import { ref, reactive } from "vue";
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue"; import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue"; import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
import {fetchResearcher, fetchResearches, fetchStats} from "@/rest/ScientificPublications/ResearcherProfile.js"; import {fetchResearcher, fetchResearches, fetchStats, fetchResearch} from "@/rest/ScientificPublications/ResearcherProfile.js";
import {getFile, addView} from "@/rest/ScientificPublications/ManageResearch.js"; import {getFile, addView} from "@/rest/ScientificPublications/ManageResearch.js";
const input = ref(""); const input = ref("");
const statsOf = ref(""); const statsOf = ref("");
@ -20,16 +20,18 @@ const articleToDisplay = ref(Object)
const filters = ref([]); const filters = ref([]);
let chart; let chart;
const researchList = ref(await fetchResearches(1)); const researcherId = window.location.href.split("=")[1]
//todo changer dynamiquement le 1 ici en fct de sur quel profil on est
const researcher = ref(await fetchResearcher(1));
const stats = ref(await fetchStats(1))
const props = defineProps({ const props = defineProps({
researcherId: ref(), //int filters: ref([]),
filters: ref([""]),
}); });
const researchList = ref(await fetchResearches(researcherId));
const researcher = ref(await fetchResearcher(researcherId));
const stats = ref(await fetchStats(researcherId))
const openFilter = () => { const openFilter = () => {
isFilterOpened.value = true; isFilterOpened.value = true;
}; };
@ -52,9 +54,12 @@ const downloadBibTex = (research) => {
getFile(research.bibTexLocation) getFile(research.bibTexLocation)
} }
const downloadArticle = (research) => { async function downloadArticle (research) {
addView(research.pdfLocation) await addView(research.pdfLocation)
getFile(research.pdfLocation) await getFile(research.pdfLocation)
articleToDisplay.value = await fetchResearch(articleToDisplay.value.id)
stats.value = await fetchStats(researcher.value.id)
update()
} }
function downloadCoAuthors(){ function downloadCoAuthors(){

View File

@ -11,3 +11,7 @@ export async function fetchResearches(id){
export async function fetchStats(id){ export async function fetchStats(id){
return restGet("/stats/" +id) return restGet("/stats/" +id)
} }
export async function fetchResearch(id){
return restGet("/research/" +id)
}

View File

@ -14,6 +14,7 @@ import Msg from "@/Apps/Msg.vue"
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue"; import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue"; import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue";
import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue"; import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue";
import ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.vue";
const apps = { const apps = {
'/login': LoginPage, '/login': LoginPage,
@ -24,7 +25,8 @@ const apps = {
'/students-list' : Students, '/students-list' : Students,
'/manage-researcher-profile' : ManageResearcherProfile, '/manage-researcher-profile' : ManageResearcherProfile,
'/msg' : Msg, '/msg' : Msg,
'/researches' : ListResearches '/researches' : ListResearches,
'/researcher-profile': ResearcherProfile
} }
const appsList = { const appsList = {
@ -44,7 +46,7 @@ const appsList = {
const currentPath = ref(window.location.hash) const currentPath = ref(window.location.hash)
export const currentView = computed(() => { export const currentView = computed(() => {
return apps[currentPath.value.slice(1) || '/'] return apps[currentPath.value.split("?")[0].slice(1) || '/']
}) })
/** /**