aled
This commit is contained in:
parent
a168d41aee
commit
e998fb2ab4
@ -2,8 +2,7 @@
|
|||||||
import { ref} from "vue";
|
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 { 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);
|
||||||
@ -34,23 +33,6 @@ const closeResearch = () => {
|
|||||||
articleToDisplay.value = null;
|
articleToDisplay.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const downloadBibTex = (research) => {
|
|
||||||
getFile(research.bibTexLocation)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function downloadArticle (research){
|
|
||||||
await addView(research.pdfLocation)
|
|
||||||
await getFile(research.pdfLocation)
|
|
||||||
articleToDisplay.value = await fetchResearch(articleToDisplay.value.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadCoAuthors(){
|
|
||||||
//todo
|
|
||||||
const data = JSON.stringify(researcher.value);
|
|
||||||
const blob = new Blob([data], {type:"application/json"});
|
|
||||||
return URL.createObjectURL(blob);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function searchInList(list, searchInput) {
|
function searchInList(list, searchInput) {
|
||||||
let retList = []
|
let retList = []
|
||||||
@ -91,7 +73,7 @@ function lDistance(s,t){
|
|||||||
<template>
|
<template>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters()"></FilterComponent>
|
<FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters()"></FilterComponent>
|
||||||
<ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" :manage="false" @modal-close="closeResearch" @downloadPdf="downloadArticle(articleToDisplay)" @downloadBibTex="downloadBibTex(articleToDisplay)"></ArticleComponent>
|
<ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" :manage="false" @modal-close="closeResearch" ></ArticleComponent>
|
||||||
<div id="researches">
|
<div id="researches">
|
||||||
<div id="search">
|
<div id="search">
|
||||||
<input v-if="!isResearcher" type="text" id="search-input" placeholder="search for researches" v-model="input"/>
|
<input v-if="!isResearcher" type="text" id="search-input" placeholder="search for researches" v-model="input"/>
|
||||||
|
@ -8,13 +8,17 @@
|
|||||||
<script setup xmlns="http://www.w3.org/1999/html">
|
<script setup xmlns="http://www.w3.org/1999/html">
|
||||||
import {ref } from "vue";
|
import {ref } from "vue";
|
||||||
import {onClickOutside} from '@vueuse/core'
|
import {onClickOutside} from '@vueuse/core'
|
||||||
import {patchArticle, deleteArticle} from "@/rest/ScientificPublications/ManageResearch.js";
|
import {patchArticle, deleteArticle, addView} from "@/rest/ScientificPublications/ManageResearch.js";
|
||||||
|
|
||||||
|
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isOpen: Boolean,
|
isOpen: Boolean,
|
||||||
article: ref(Object),
|
article: ref(Object),
|
||||||
manage:Boolean,
|
manage:Boolean,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function format(date){
|
function format(date){
|
||||||
let split = date.split("-")
|
let split = date.split("-")
|
||||||
let month = split[1]
|
let month = split[1]
|
||||||
@ -23,7 +27,7 @@ function format(date){
|
|||||||
return day +"/"+ month +"/"+ year
|
return day +"/"+ month +"/"+ year
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits(["modal-close","downloadPdf","downloadBibTex","modified"]);
|
const emit = defineEmits(["modal-close","modified"]);
|
||||||
|
|
||||||
const target = ref(null)
|
const target = ref(null)
|
||||||
onClickOutside(target, ()=>emit('modal-close'))
|
onClickOutside(target, ()=>emit('modal-close'))
|
||||||
@ -34,6 +38,7 @@ function cancelChanges(){
|
|||||||
toModify= Object.assign({}, {});
|
toModify= Object.assign({}, {});
|
||||||
emit('modal-close')
|
emit('modal-close')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function confirmChanges(){
|
async function confirmChanges(){
|
||||||
await patchArticle(props.article.id, toModify)
|
await patchArticle(props.article.id, toModify)
|
||||||
toModify= Object.assign({}, {});
|
toModify= Object.assign({}, {});
|
||||||
@ -46,7 +51,26 @@ async function deleteThisArticle(){
|
|||||||
emit('modal-close')
|
emit('modal-close')
|
||||||
emit("modified")
|
emit("modified")
|
||||||
}
|
}
|
||||||
|
function downloadPdf(){
|
||||||
|
return (restURL + "/" + props.article.pdfLocation)
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadBibTex(){
|
||||||
|
return (restURL + "/" + props.article.bibTexLocation)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function articleClicked(){
|
||||||
|
await addView(props.article.pdfLocation)
|
||||||
|
emit('modal-close')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
function downloadCoAuthors(){
|
||||||
|
//todo
|
||||||
|
const data = JSON.stringify(researcher.value);
|
||||||
|
const blob = new Blob([data], {type:"application/json"});
|
||||||
|
return URL.createObjectURL(blob);
|
||||||
|
} **/
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -55,7 +79,6 @@ async function deleteThisArticle(){
|
|||||||
<div class="modal-wrapper">
|
<div class="modal-wrapper">
|
||||||
<div class="modal-container" ref="target">
|
<div class="modal-container" ref="target">
|
||||||
<div ><ul>
|
<div ><ul>
|
||||||
|
|
||||||
<li>Article Id : {{article.id}}</li>
|
<li>Article Id : {{article.id}}</li>
|
||||||
<li>Title : {{article.title}}</li>
|
<li>Title : {{article.title}}</li>
|
||||||
<li>Author : {{article.researcher.user.lastName + " " + article.researcher.user.firstName}}</li>
|
<li>Author : {{article.researcher.user.lastName + " " + article.researcher.user.firstName}}</li>
|
||||||
@ -67,11 +90,10 @@ async function deleteThisArticle(){
|
|||||||
<li>Views : {{article.views}}</li>
|
<li>Views : {{article.views}}</li>
|
||||||
<li>Access : {{article.access}}</li>
|
<li>Access : {{article.access}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="downloads" v-if="article.pdfLocation !== null && !manage">
|
<button @click="console.log(props.article)"> infos</button>
|
||||||
<button @click.stop="emit('downloadBibTex')">Download BibTex</button>
|
<div id="downloads" v-if="article !== null && !manage">
|
||||||
<button @click.stop="emit('downloadPdf')">Download Research</button>
|
<a :href=downloadPdf() @click.stop="articleClicked" target="_blank">See Research</a>
|
||||||
</div>
|
<a :href=downloadBibTex() @click.stop="emit('modal-close')" target="_blank">See bibTex</a> </div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="manage">
|
<div v-if="manage">
|
||||||
<div>
|
<div>
|
||||||
@ -125,7 +147,7 @@ async function deleteThisArticle(){
|
|||||||
#downloads {
|
#downloads {
|
||||||
text-align: end;
|
text-align: end;
|
||||||
}
|
}
|
||||||
#downloads button {
|
#downloads a {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
font-size: large;
|
font-size: large;
|
||||||
@ -133,6 +155,8 @@ async function deleteThisArticle(){
|
|||||||
background: rgba(191, 64, 191,0.5);
|
background: rgba(191, 64, 191,0.5);
|
||||||
border:2px solid black;
|
border:2px solid black;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
text-underline-mode: none;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
#downloads button:hover{
|
#downloads button:hover{
|
||||||
background: rgba(191, 64, 191);
|
background: rgba(191, 64, 191);
|
||||||
|
@ -29,7 +29,7 @@ export async function fetchAllResearches(){
|
|||||||
|
|
||||||
export async function getFile(url){
|
export async function getFile(url){
|
||||||
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
|
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
|
||||||
await fetch(restURL + "/" + url, {method: "GET"})
|
return await fetch(restURL + "/" + url, {method: "GET"})
|
||||||
}
|
}
|
||||||
export async function addView(url){
|
export async function addView(url){
|
||||||
return restPost("/addview/" + url)
|
return restPost("/addview/" + url)
|
||||||
|
Loading…
Reference in New Issue
Block a user