1
0
forked from PGL/Clyde

added addview and download PDF

This commit is contained in:
2024-04-17 00:09:30 +02:00
parent 388c53e47b
commit 821377a72f
8 changed files with 63 additions and 39 deletions

View File

@ -22,7 +22,7 @@ function format(date){
}
const emit = defineEmits(["modal-close"]);
const emit = defineEmits(["downloadPdf","downloadBibTex"]);
const target = ref(null)
onClickOutside(target, ()=>emit('modal-close'))
@ -43,11 +43,12 @@ onClickOutside(target, ()=>emit('modal-close'))
<li>PaperType : {{article.paperType}}</li>
<li>Domain : {{article.domain}}</li>
<li>Access : {{article.access}}</li>
</ul>
<div id="downloads" v-if="article.pdfLocation !== null">
<button @click.stop="emit('modal-close')">Download BibTex</button>
<button @click.stop="emit('modal-close')">Download Research</button>
<button @click.stop="emit('downloadBibTex')">Download BibTex</button>
<form method="get" :action=article.pdfLocation>
<button @click.stop="emit('downloadPdf', article)">Download Research</button>
</form>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@
import { ref, reactive } from "vue";
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
import {fetchResearcher, fetchResearches} from "@/rest/ScientificPublications/ResearcherProfile.js";
import {fetchResearcher, fetchResearches, fetchStats, addView} from "@/rest/ScientificPublications/ResearcherProfile.js";
const input = ref("");
const statsOf = ref("");
const statsBy = ref("");
@ -17,16 +17,15 @@ const isFilterOpened = ref(false);
const isResearchOpened = ref(false);
const articleToDisplay = ref(Object)
const filters = ref([]);
const researchList = ref(await fetchResearches(1));
let chart;
const researchList = ref(await fetchResearches(1));
//todo changer dynamiquement le 1 ici en fct de sur quel profil on est
const researcher = ref(await fetchResearcher(1));
const researcher = ref(await fetchResearcher(1));
const stats = ref(await fetchStats(1))
const props = defineProps({
researcher: ref(Object),
researcherId: ref(), //int
filters: ref([""]),
});
@ -53,7 +52,8 @@ const downloadBibTex = (research) => {
}
const downloadArticle = (research) => {
//todo
addView(research.url)
}
function downloadCoAuthors(){
@ -63,14 +63,6 @@ function downloadCoAuthors(){
}
const jsonMockViewsByYears= [
{label: "2004", y:4},
{label: "2005", y:99},
{label: "2007", y:555},
{label: "2009", y:22},
{label: "2011", y:1666},
]
function searchInList(list, searchInput) {
let retList = []
for (let i = 0; i < list.length; i++) {
@ -121,23 +113,25 @@ const options = reactive({
});
function update(){
options.title = {
fontColor: "white",
text: statsOf.value + " By "+ statsBy.value,
}
if (statsOf.value === "views" && statsBy.value === "years") {
options.data[0].dataPoints = jsonMockViewsByYears;
}
options.title = {
fontColor: "white",
text: statsOf.value + " By "+ statsBy.value,
}
const index = (0 ?statsOf.value === "views": 3 ? statsOf.value === "researches":6) + (0?statsBy.value ==="years":1?statsBy.value==="months":2)
options.title.text = statsOf.value + " By "+ statsBy.value;
chart.render()
}
options.data[0].dataPoints = stats.value[index]
options.title.text = statsOf.value + " By "+ statsBy.value;
chart.render();
}
</script>
<template>
<div id="main">
<FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters()"></FilterComponent>
<ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" @modal-close="closeResearch"></ArticleComponent>
<ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" @modal-close="closeResearch" @downloadPdf="downloadArticle" @downloadBibTex="downloadBibTex"></ArticleComponent>
<div id="profilePicture">
<img src="/Clyde.png" />
</div>
@ -157,13 +151,13 @@ function update(){
<select @change="update()" id="stats-select" v-model="statsOf">
<option value="views">Views</option>
<option value="researches">Researches</option>
<option value="language">Languages</option>
<option value="languages">Languages</option>
</select>
</div>
<div class="surrounded">
Class by:
<select @change="update()" id="classed-select" v-model="statsBy">
<option selected="selected" value="years">Years</option>
<option value="years">Years</option>
<option value="months">Months</option>
<option value="topics">Topics</option>
</select>

View File

@ -8,4 +8,10 @@ export async function fetchResearches(id){
return restGet("/researches/" + id)
}
export async function fetchStats(id){
return restGet("/stats/" +id)
}
export async function addView(url){
return restPost("/addView/" +url)
}