added Co Author
This commit is contained in:
@ -106,14 +106,14 @@ const emit = defineEmits(["modified"]);
|
||||
<div id="researches">
|
||||
<FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters"></FilterComponent>
|
||||
<ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" :manage="props.manage" @modal-close="closeResearch" @modified="emit('modified')"></ArticleComponent>
|
||||
<div id="search">
|
||||
<input v-if="!isResearcher" type="text" id="search-input" placeholder="search for researches" v-model="input"/>
|
||||
<input v-else type="text" id="search-input" placeholder="search for researcher" v-model="input"/>
|
||||
<button v-if="!isResearcher" id="filterButton" @click="openFilter"> Filters </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>
|
||||
</div>
|
||||
<div id="researches">
|
||||
<div id="search">
|
||||
<input v-if="!isResearcher" type="text" id="search-input" placeholder="search for researches" v-model="input"/>
|
||||
<input v-else type="text" id="search-input" placeholder="search for researcher" v-model="input"/>
|
||||
<button v-if="!isResearcher" id="filterButton" @click="openFilter"> Filters </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>
|
||||
</div>
|
||||
<ul id="researchUL">
|
||||
<li id="researchLi" v-for="n in searchInList(researchList,input)">
|
||||
<div class="vl"> {{n.title}}</div>
|
||||
@ -128,6 +128,11 @@ const emit = defineEmits(["modified"]);
|
||||
|
||||
<style scoped>
|
||||
|
||||
#researches{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: scroll;
|
||||
}
|
||||
#search{
|
||||
width: 100%;
|
||||
height: 10%;
|
||||
|
@ -64,14 +64,6 @@ async function articleClicked(){
|
||||
emit('modified')
|
||||
}
|
||||
|
||||
/**
|
||||
function downloadCoAuthors(){
|
||||
//todo
|
||||
const data = JSON.stringify(researcher.value);
|
||||
const blob = new Blob([data], {type:"application/json"});
|
||||
return URL.createObjectURL(blob);
|
||||
} **/
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -82,6 +74,7 @@ function downloadCoAuthors(){
|
||||
<li>Article Id : {{article.id}}</li>
|
||||
<li>Title : {{article.title}}</li>
|
||||
<li>Author : {{article.researcher.user.lastName + " " + article.researcher.user.firstName}}</li>
|
||||
<li> Co Authors : <ul id="coAuthors" v-for="n in article.coAuthors"> <li id="coAuthorsLi"> {{n.user.firstName}} {{n.user.lastName}}, </li></ul></li>
|
||||
<li>Summary : {{article.summary}}</li>
|
||||
<li>ReleaseDate: {{format(article.releaseDate)}}</li>
|
||||
<li>Language : {{article.language}}</li>
|
||||
@ -125,7 +118,7 @@ function downloadCoAuthors(){
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: 120%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
@ -142,6 +135,15 @@ function downloadCoAuthors(){
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
#coAuthors{
|
||||
list-style: none;
|
||||
display: inline;
|
||||
padding: 0;
|
||||
}
|
||||
#coAuthorsLi{
|
||||
display: inline;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
#downloads {
|
||||
text-align: end;
|
||||
|
@ -2,8 +2,13 @@
|
||||
|
||||
import { ref } from "vue";
|
||||
import {onClickOutside} from '@vueuse/core'
|
||||
import {uploadPdf,postResearch} from "@/rest/ScientificPublications/ManageResearch.js";
|
||||
let toPost = Object.assign({}, {});
|
||||
import {uploadFile, postResearch, fetchAllResearchers} from "@/rest/ScientificPublications/ManageResearch.js";
|
||||
const allResearcher = ref(await fetchAllResearchers())
|
||||
|
||||
const coAuthors = ref([])
|
||||
|
||||
let toPost = Object.assign({}, {coAuthors:[]});
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
isOpen: Boolean,
|
||||
@ -12,19 +17,20 @@ const props = defineProps({
|
||||
|
||||
|
||||
async function uploadResearchPdf(pdf){
|
||||
const data = await uploadPdf(pdf);
|
||||
const data = await uploadFile(pdf);
|
||||
toPost.pdfLocation = data.url;
|
||||
}
|
||||
async function uploadBibTex(pdf){
|
||||
const data = await uploadPdf(pdf);
|
||||
const data = await uploadFile(pdf);
|
||||
toPost.bibTexLocation = data.url;
|
||||
}
|
||||
|
||||
// Date when sent!!
|
||||
|
||||
async function postNewResearch(){
|
||||
toPost.releaseDate = new Date()
|
||||
toPost.author = props.researcher
|
||||
toPost.coAuthors = coAuthors.value
|
||||
console.log()
|
||||
//the Pdf and a title are required
|
||||
if (toPost.pdfLocation == null || toPost.title == null || toPost.title === "") {
|
||||
emit("modal-close")
|
||||
@ -32,6 +38,7 @@ async function postNewResearch(){
|
||||
}
|
||||
await postResearch(toPost)
|
||||
toPost = Object.assign({}, {});
|
||||
coAuthors.value = []
|
||||
emit("modal-close")
|
||||
emit("posted")
|
||||
}
|
||||
@ -69,6 +76,8 @@ onClickOutside(target, ()=>emit('modal-close'))
|
||||
<option value="Restricted">Restricted</option>
|
||||
<option value="Private">Private</option>
|
||||
</select></li>
|
||||
|
||||
|
||||
<li> Research Pdf :
|
||||
<form novalidate enctype="multipart/form-data" class="inputBox">
|
||||
<input type="file" @change="uploadResearchPdf($event.target.files);" accept="application/pdf">
|
||||
@ -79,11 +88,19 @@ onClickOutside(target, ()=>emit('modal-close'))
|
||||
</form></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="CoAuthorList"> Co-Authors List:
|
||||
<ul style="list-style-type: none;" v-for="n in allResearcher">
|
||||
<li v-if="n.id !== props.researcher.id"> <input type="checkbox" :value=n v-model="coAuthors"> {{n.id}} : {{n.user.firstName}} {{n.user.lastName}}</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div></div>
|
||||
<div>
|
||||
<button id="confirmButton" @click="postNewResearch">Confirm Publish</button>
|
||||
<button id="cancelButton" @click="cancelPost">Cancel Publish</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -101,6 +118,8 @@ onClickOutside(target, ()=>emit('modal-close'))
|
||||
}
|
||||
|
||||
.modal-container {
|
||||
display: grid;
|
||||
grid-template-columns: 40% 60%;
|
||||
width: 70%;
|
||||
margin: 150px auto;
|
||||
padding: 20px 30px;
|
||||
@ -113,6 +132,12 @@ onClickOutside(target, ()=>emit('modal-close'))
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
#coAuthorList{
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#downloads button {
|
||||
align-self: center;
|
||||
margin-left: 2px;
|
||||
|
@ -51,7 +51,14 @@ async function downloadArticle (research) {
|
||||
}
|
||||
|
||||
function downloadCoAuthors(){
|
||||
const data = JSON.stringify(researcher.value);
|
||||
let coAuthors = []
|
||||
for (let i in researchList.value) {
|
||||
for (const j in researchList.value[i].coAuthors){
|
||||
const coAuthor = researchList.value[i].coAuthors[j]
|
||||
coAuthors.push(coAuthor)
|
||||
}
|
||||
}
|
||||
const data = JSON.stringify(coAuthors);
|
||||
const blob = new Blob([data], {type:"application/json"});
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export async function deleteArticle(id){
|
||||
export async function patchArticle(id, data){
|
||||
await restPatch("/research/" + id, data)
|
||||
}
|
||||
export async function uploadPdf(file){
|
||||
export async function uploadFile(file){
|
||||
const formData = new FormData();
|
||||
formData.append("file", file[0]);
|
||||
|
||||
@ -27,3 +27,6 @@ export async function getFile(url){
|
||||
export async function addView(url){
|
||||
return restPost("/addview/" + url)
|
||||
}
|
||||
export async function fetchAllResearchers(){
|
||||
return await restGet("/researchers")
|
||||
}
|
Reference in New Issue
Block a user