Commit 1f56a98d authored by Jérémie Passerat's avatar Jérémie Passerat

Intégration totale de la notation

parent 2e091278
......@@ -26,7 +26,8 @@
"vue-js-modal": "^2.0.0-rc.6",
"vue-js-popover": "^1.2.1",
"vue-showdown": "^3.1.0",
"vue-simplemde": "^2.0.0"
"vue-simplemde": "^2.0.0",
"vue-star-rating": "^1.7.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
......@@ -19606,6 +19607,14 @@
"simplemde": "*"
}
},
"node_modules/vue-star-rating": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/vue-star-rating/-/vue-star-rating-1.7.0.tgz",
"integrity": "sha512-2qdONqnIlvFzJoallfr7VuFRB6hBzYgBVEbXC3yYZz2TfMhx36WtYQ5p7JRjW+pzZx2PGQYZ75UFoBE0jwIANw==",
"dependencies": {
"vue": "^2.3.3"
}
},
"node_modules/vue-style-loader": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz",
......@@ -36682,6 +36691,14 @@
"simplemde": "*"
}
},
"vue-star-rating": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/vue-star-rating/-/vue-star-rating-1.7.0.tgz",
"integrity": "sha512-2qdONqnIlvFzJoallfr7VuFRB6hBzYgBVEbXC3yYZz2TfMhx36WtYQ5p7JRjW+pzZx2PGQYZ75UFoBE0jwIANw==",
"requires": {
"vue": "^2.3.3"
}
},
"vue-style-loader": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz",
......@@ -29,7 +29,7 @@ import Contenu from "./Contenu";
import Menu from "./Menu";
import Maj from "./Maj";
import Profil from "./Profil";
import Tags from "./Tags";
import Tags from "./GererTags";
import NewContenu from "./NewContenu";
import ImporterFichier from "./ImporterFichier";
// import Service from "./service/Service";
......
......@@ -24,9 +24,9 @@
<tbody>
<tr v-for="(item, index) in contenusRecu" :key="index">
<td :id="JSON.stringify(item._id)" v-on:click="consulterContenuMaj(item)">{{item.titre}}</td>
<b-popover :target="JSON.stringify(item._id)" v-on:show="rechercherTexte(item.idContenuEnCours)" triggers="hover" placement="bottom">
<p id="beautiful" v-html="texteDuContenu"></p>
<td :id="'maj' + JSON.stringify(item._id)" v-on:click="consulterContenuMaj(item)">{{item.titre}}</td>
<b-popover :target="'maj' + JSON.stringify(item._id)" v-on:show="rechercherTexteMaj(item)" triggers="hover" placement="bottom">
<p id="beautiful" v-html="texteDuContenuMaj"></p>
</b-popover>
<td>{{ item.auteurDemande }}</td>
......@@ -66,8 +66,8 @@
<tr v-for="(item, index) in contenusPropose" :key="index">
<td :id="JSON.stringify(item._id)" v-on:click="consulterContenuMaj(item)">{{item.titre}}</td>
<b-popover :target="JSON.stringify(item._id)" v-on:show="rechercherTexte(item.idContenuEnCours)" triggers="hover" placement="bottom">
<p v-html="texteDuContenu"></p>
<b-popover :target="JSON.stringify(item._id)" v-on:show="rechercherTexteMaj(item.idContenuEnCours)" triggers="hover" placement="bottom">
<p v-html="texteDuContenuMaj"></p>
</b-popover>
<td>{{ item.auteurContenu }}</td>
<td>1</td>
......@@ -258,16 +258,32 @@ export default {
* @vuese
* Récupération et mise en forme du texte associé au contenu
*/
rechercherTexte: function (id) {
rechercherTexteMaj: function (item) {
let that = this
Service.recupererTexteContenuEnCours(JSON.stringify(id)).then(
function (response) {
let showdown = require('showdown'),
converter = new showdown.Converter()
let idContenu = null
if (Object.prototype.hasOwnProperty.call(item, 'idContenuEnCours')){
idContenu = item.idContenuEnCours
Service.recupererTexteContenuEnCours(JSON.stringify(idContenu)).then(
function (response) {
let showdown = require('showdown'),
converter = new showdown.Converter()
that.texteDuContenuMaj = converter.makeHtml(response.data)
}
)
} else {
idContenu = item._id
Service.recupererTexteContenu(JSON.stringify(idContenu)).then(
function (response) {
let showdown = require('showdown'),
converter = new showdown.Converter()
that.texteDuContenuMaj = converter.makeHtml(response.data)
}
)
}
that.texteDuContenu = converter.makeHtml(response.data)
}
)
},
/**
* @vuese
......@@ -290,7 +306,7 @@ export default {
detailContenu: false,
contenuChoisi: null,
contenuCliqueProvenance: '',
texteDuContenu: ''
texteDuContenuMaj: ''
}
},
watch: {
......
......@@ -268,11 +268,12 @@ export default {
border-radius: 30%;
height: 30px;
width: 30px;
margin-top: 1.5%;
z-index: 1;
margin-left: 90%;
background-image: url(assets/img/cloche.png);
background-size: cover;
margin-top: 0.5%;
margin-bottom: 0.5%;
}
......
<template>
<div>
Bienvenue sur la page ou vous pourrez ajouter les tags nécessaires à accoler à la question que vous venez de créer
</div>
</template>
<script>
export default {
name: "AjouterTags"
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -9,7 +9,7 @@
<option>auteur</option>
<option>type / source</option>
<option>date</option>
<option>note / popularité</option>
<option>note</option>
</select>
</form>
</div>
......
......@@ -27,6 +27,11 @@
<br v-show="(contenuCliqueProvenance === 'banque'
|| contenuCliqueProvenance === 'perso')
&& versionMax > 1">
<p v-if="contenuCliqueProvenance!=='en-cours'">Type du contenu : {{ typeContenu }}</p>
<p v-if="contenuCliqueProvenance!=='en-cours'">Source du contenu : {{sourceContenu}}</p>
<p v-if="contenuCliqueProvenance!=='en-cours'">Note du contenu (v {{versionChoisie}}) : {{noteContenu}}</p>
<p v-if="contenuCliqueProvenance!=='en-cours'">Popularite du contenu : {{populariteContenu}}</p>
<p> Voici l'intérieur de votre contenu dans sa version {{versionChoisie}} : </p>
<span contenteditable="false" v-html="formatterMarkdown()">
</span>
......@@ -75,7 +80,7 @@ export default {
this.$emit("actionContenu", {action: action, contenu: this.contenuClique, texte: this.contenu, version: this.versionChoisie})
}else
this.$emit("actionContenu", {action: action, contenu: this.contenuClique, texte: this.contenu})
this.$emit("actionContenu", {action: action, contenu: this.contenuClique, texte: this.contenu})
},
/**
* @vuese
......@@ -87,7 +92,7 @@ export default {
this.$emit("retour_arriere")
} else {
// Permet de revenir à Volet_Base
this.$emit("retour_arriere", {panierChoisi: this.contenuCliqueProvenance !== 'banque'})
this.$emit("retour_arriere", {panierChoisi: this.contenuCliqueProvenance !== 'banque'})
}
},
/**
......@@ -102,6 +107,32 @@ export default {
// alert(response.data)
}
)
},
calculerNoteDetailContenu: function() {
if(this.versionMax !== 0){
if (parseInt(this.versionChoisie) !== this.versionMax){
for (let it in this.contenuClique.historique){
if (this.contenuClique.historique[it].numero === parseInt(this.versionChoisie)){
if (this.contenuClique.historique[it].note === 0){
return 0
}
return (this.contenuClique.historique[it].note / this.contenuClique.historique[it].nbreNotes).toFixed(2)
}
}
return -1
} else {
if (this.contenuClique.versionEnCours.note === 0){
return 0
}
return (this.contenuClique.versionEnCours.note / this.contenuClique.versionEnCours.nbreNotes).toFixed(2)
}
/* return 0
}*/
} else {
return 0
}
}
},
data: function () {
......@@ -110,8 +141,15 @@ export default {
versionMax: 1,
versionChoisie: 1,
isContenuRefuse :false,
titreContenu: ''
titreContenu: '',
typeContenu: '',
sourceContenu: '',
populariteContenu: 0,
noteContenu: 0
}
},
computed: {
},
watch: {
/**
......@@ -122,9 +160,12 @@ export default {
let that = this
this.titreContenu = this.contenuClique.titre
this.populariteContenu = this.contenuClique.popularite
this.isContenuRefuse = false
this.noteContenu = this.calculerNoteDetailContenu()
if (Object.prototype.hasOwnProperty.call(this.contenuClique, 'refuse')){
this.isContenuRefuse = true
}
......@@ -138,12 +179,24 @@ export default {
}
else if (this.contenuCliqueProvenance === 'maj'){
Service.recupererTexteContenuEnCours(JSON.stringify(this.contenuClique.idContenuEnCours)).then(
function (response) {
that.contenu = response.data
// alert(response.data)
}
)
if (Object.prototype.hasOwnProperty.call(this.contenuClique, 'idContenuEnCours')){
Service.recupererTexteContenuEnCours(JSON.stringify(this.contenuClique.idContenuEnCours)).then(
function (response) {
that.contenu = response.data
// alert(response.data)
}
)} else {
Service.recupererTexteContenu(JSON.stringify(this.contenuClique._id)).then(
function (response) {
that.contenu = response.data
/* let showdown = require('showdown'),
converter = new showdown.Converter()
that.texteDuContenuMaj = converter.makeHtml(response.data)*/
}
)
}
}
else {
if (this.contenuCliqueProvenance === 'perso' || this.contenuCliqueProvenance === 'banque'){
......@@ -158,8 +211,11 @@ export default {
}
)
}
},
versionChoisie: function () {
this.noteContenu = this.calculerNoteDetailContenu()
}
},
}
}
</script>
......
......@@ -5,8 +5,8 @@
<Filtre_Tag v-show="filtre_choisi === 'tags officiels' || filtre_choisi === 'tags libres' " v-bind:filtreChoisi="filtre_choisi" @creer_filtre="creer_filtre"/>
<Filtre_Auteur v-bind:panierChoisi="panierChoisi" v-show="filtre_choisi === 'auteur'" v-bind:auteur="auteur" @creer_filtre="creer_filtre"/>
<Filtre_Date v-show="filtre_choisi === 'date' " @creer_filtre="creer_filtre"/>
<Filtre_Note_Popularite v-show="filtre_choisi === 'note / popularité' " @creer_filtre="creer_filtre"/>
<Filtre_Type_Source v-show="filtre_choisi === 'type / source'" @creer_filtre="creer_filtre"/>
<Filtre_Note_Popularite v-show="filtre_choisi === 'note' " @creer_filtre="creer_filtre" v-bind:deconnexion="deconnexion"/>
<Filtre_Type_Source v-show="filtre_choisi === 'type / source'" @creer_filtre="creer_filtre" v-bind:deconnexion="deconnexion"/>
</div>
</template>
......@@ -16,7 +16,7 @@
import Filtre_Tag from "../components/filtres/Filtre_Tag";
import Filtre_Auteur from "../components/filtres/Filtre_Auteur";
import Filtre_Date from "../components/filtres/Filtre_Date";
import Filtre_Note_Popularite from "../components/filtres/Filtre_Note_Popularite";
import Filtre_Note_Popularite from "./filtres/Filtre_Note";
import Filtre_Type_Source from "../components/filtres/Filtre_Type_Source";
......@@ -38,7 +38,9 @@ export default {
// auteur
auteur: {},
// mode panier enclenché ou non
panierChoisi: {}
panierChoisi: {},
// Signal de deconnexion
deconnexion: {}
},
methods: {
/**
......
......@@ -13,7 +13,9 @@ export default {
name: "Detail_Filtre",
props: {
// Variable de stockage des nouveaux filtres
nouveau_filtre: {}
nouveau_filtre: {},
// Signal de deconnexion
deconnexion: {}
},
methods: {
/**
......@@ -49,6 +51,30 @@ export default {
*/
filtreDejaPresent: function(nomFiltre) {
return this.filtres_Choisis.filter(filtre => filtre.filtre === nomFiltre).length > 0
},
/**
* @vuese
* Il n'est pas possible de cumuler plusieurs filtres de note qui se gêneraient, donc une fonction pour gérer ça
* Si on ajoute un filtre Borne -> on supprime les filtres noteMin et noteMax
* Et inversement, si on ajoute un filtre min ou max, on supprime l'éventuel filtre borne
*/
gererFiltreNote: function (typeFiltre) {
switch(typeFiltre){
case "noteMin":
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'noteMin')
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'noteBorne')
break
case "noteMax":
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'noteMax')
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'noteBorne')
break
case "noteBorne":
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'noteMin')
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'noteMax')
break
default:
break
}
}
},
watch: {
......@@ -57,6 +83,7 @@ export default {
* Fonction de traitement dès qu'on réceptionne un nouveau filtre
*/
nouveau_filtre: function(newVal) { // watch it
if (this.filtres_Choisis.length > 0){
if (this.filtreDejaPresent(newVal.filtre.filtre)){
return
......@@ -67,12 +94,21 @@ export default {
if (newVal.filtre.filtre === "Toutes les périodes"){
return
}
} else if (newVal.filtre.type === "noteMin" || newVal.filtre.type === "noteMax" || newVal.filtre.type === "noteBorne"){
this.gererFiltreNote(newVal.filtre.type)
}
}
this.filtres_Choisis.push(newVal.filtre)
// si les écueils ci dessus sont évités, on ajoute le filtre et on envoie l'array maj à Volet_Base, qui gère l'affichage des contenus
this.$emit("filtresChoisis", {filtres: this.filtres_Choisis})
},
/**
* @vuese
* A la deconnexion, on vide les filtres
*/
deconnexion: function () {
this.filtres_Choisis = []
}
}
, data: function () {
......
<template>
<div >
<div id="titreContenu">
<!-- <select v-show="(contenuCliqueProvenance === 'banque'
|| contenuCliqueProvenance === 'perso')
<!-- <select v-show="(contenuCliqueProvenance === 'banque'
|| contenuCliqueProvenance === 'perso')
&& versionMax > 1" v-model="versionChoisie" v-on:change="changerVersion" >-->
&& versionMax > 1" v-model="versionChoisie" v-on:change="changerVersion" >-->
<div id="typeEtSource">
Type : {{contenuClique.type}}<br>
<label>Titre du contenu : </label><br>
<select v-show="contenuCliqueProvenance === 'perso' && versionMax > 1" v-model="versionChoisie" v-on:change="changerVersion" >
<option v-for="i in versionMax" v-bind:key="i"> {{i}}</option>
</select>
<input type="text" placeholder="titre du contenu" v-model="titreContenu">
Source : {{contenuClique.source}}
</div>
<div id="notePopularite">
Note de la version : {{noteContenu}}<br>
Popularité : {{contenuClique.popularite}}<br>
</div>
<button v-on:click="actionContenu('supprimer')">Supprimer</button>
<button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance === 'en-cours' &&
<div id="modifTitre">
<div id="changerTitre">
<label>Titre du contenu : </label><br>
<select v-show="contenuCliqueProvenance === 'perso' && versionMax > 1" v-model="versionChoisie" v-on:change="changerVersion" >
<option v-for="i in versionMax" v-bind:key="i"> {{i}}</option>
</select>
<input type="text" id="titreDuContenu" placeholder="titre du contenu" v-model="titreContenu">
</div>
<div id="voirNote">
<button v-show="contenuCliqueProvenance === 'tiers' && !notePresente" id="noterContenu">{{ messageNoter }}</button>
<b-popover target="noterContenu" triggers="click" placement="bottom">
<star-rating @rating-selected ="setRating" v-model="rating" :read-only="notePresente" :show-rating="false" :increment=0.5 :star-size=25 />
</b-popover>
<star-rating v-show="notePresente" @rating-selected ="setRating" v-model="rating" :read-only="notePresente"
:show-rating="false" :increment=0.5 :star-size=25 />
</div>
</div>
<div id="actionsContenu">
<button v-on:click="actionContenu('supprimer')">Supprimer</button>
<button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance === 'en-cours' &&
contenuClique.origine === 'tiers' && contenuClique.anonyme !== 'oui'" v-on:click="actionContenu('publier')">Publier le contenu</button>
<button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance === 'en-cours' &&
<button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance === 'en-cours' &&
(contenuClique.origine === 'perso' || contenuClique.anonyme === 'oui')" v-on:click="actionContenu('validerModification')">Valider la modification</button>
</div>
</div>
<br>
<div class="mavonEditor">
<mavon-editor :language="'fr'" style="position: static; height: 78vh; margin-top: -0.5%" v-model="texteDuContenu"/>
<mavon-editor :language="'fr'" style="position: static; height: 79vh; margin-top: -0.5%" v-model="texteDuContenu"/>
</div>
<div class="markdown">
<br>
......@@ -30,16 +53,21 @@
<button id="retourArriere" v-on:click="action('arriere')"> revenir en arrière</button>
</div>
<star-rating v-show="false"/>
</div>
</template>
<script>
import Service from "@/service/Service";
import StarRating from 'vue-star-rating'
export default {
name: "Modifier_Contenu",
components: {
StarRating
},
props: {
// le texte du contenu cliqué
texteDuContenu: {},
......@@ -58,7 +86,12 @@ export default {
versionChoisie: 0,
titreContenu: '',
isContenuRefuse: false,
versionMax: 0
versionMax: 0,
rating: 0,
notePresente: false,
messageNoter: "noter",
populariteContenu: 0,
noteContenu: 0,
}
},
methods: {
......@@ -81,7 +114,7 @@ export default {
},
changerVersion: function () {
let that = this
Service.recupererTexteVersionContenu(JSON.stringify(this.contenuClique._id), this.versionChoisie).then(
Service.recupererTexteVersionContenu(JSON.stringify(this.contenuClique._id), this.versionChoisie).then(
function (response) {
that.texteDuContenu = response.data
}
......@@ -94,6 +127,21 @@ export default {
// @arg le texte associé au contenu (sert potentiellement à rien)
this.$emit("actionContenu", {action: action, contenu: this.contenuClique, texte: this.texteDuContenu})
},
setRating: function () {
let that = this
let data={id_contenu: JSON.stringify(this.contenuClique._id), note: this.rating, auteur: this.auteur, version: this.contenuClique.version}
Service.noterContenu(data).then(function (response) {
document.getElementById('noterContenu').click()
that.notePresente = true
that.messageNoter = "Voir votre note"
let notes = JSON.parse(response.data)
that.$emit("majMoyenne", {id: that.contenuClique._id, note: notes[0], nbreNotes: notes[1], notePerso: that.rating})
})
}
},/*,
......@@ -105,20 +153,53 @@ export default {
texteDuContenu: function () {
// this.titreContenu
}
}*/
}*/computed: {
calculerNoteContenu: function() {
if (parseInt(this.versionChoisie) !== this.versionMax){
for (let it in this.contenuClique.historique){
if (this.contenuClique.historique[it].numero === parseInt(this.versionChoisie)){
if (this.contenuClique.historique[it].note === 0){
return 0
}
return (this.contenuClique.historique[it].note / this.contenuClique.historique[it].nbreNotes).toFixed(2)
}
}
return -1
} else {
if (this.contenuClique.versionEnCours.note === 0){
return 0
}
return (this.contenuClique.versionEnCours.note / this.contenuClique.versionEnCours.nbreNotes).toFixed(2)
}
}
},
watch: {
contenuClique: function () {
console.log(this.contenuClique)
this.titreContenu = this.contenuClique.titre
this.noteContenu = this.calculerNoteContenu
this.isContenuRefuse = Object.prototype.hasOwnProperty.call(this.contenuClique, 'refuse');
if (this.contenuCliqueProvenance === 'perso'){
this.versionMax = this.contenuClique.versionEnCours.numero
this.versionChoisie = this.versionMax
if (this.contenuCliqueProvenance === 'perso'){
this.versionMax = this.contenuClique.versionEnCours.numero
this.versionChoisie = this.versionMax
}
let that = this
Service.recupererNoteContenu(JSON.stringify(this.contenuClique._id), this.auteur, this.contenuClique.version).then(function (result) {
let nombre = result.data
if (nombre !== '-1'){
nombre = JSON.parse(nombre)
that.rating = nombre.note
that.notePresente = true
}
})
},
versionChoisie: function () {
this.noteContenu = this.calculerNoteContenu
}
}
}
......@@ -134,6 +215,10 @@ button {
width: auto;
}
#titreDuContenu {
margin-left: 5px;
}
#validerModif {
margin-right: 5px;
margin-bottom: 5px;
......@@ -142,10 +227,46 @@ button {
#titreContenu {
text-align: center;
align-content: center;
margin: 0 auto 0;
display: flex;
margin: 0 auto -15px;
}
#typeEtSource, #notePopularite {
margin-top: 10px;
flex-basis: 12.5%;
margin-bottom: 10px;
}
#actionsContenu {
margin-top: 20px;
flex-basis: 25%;
}
#modifTitre {
margin-top: 5px;
flex-basis: 50%;
margin-right: 5px;
display: flex;
justify-content: center;
margin-bottom: 5px;
}
#noterContenu {
margin-left: 5px;
}
#changerTitre {
align-items: center;
position: absolute;
}
#modifTitre{
margin-top: -35px;
#voirNote {
margin-left: 400px;
margin-top: 24px;
align-items: inherit;
position: relative
}
</style>
\ No newline at end of file
......@@ -12,14 +12,15 @@
<button id="boutonVolet" v-on:click="desactiverVolet" v-bind:style="{'margin-top': '0%'}"></button>
<div class="full" id="volet" v-bind:style="darktheme ? {'border-color': 'white'} : {'border-color': 'black'}" v-show="isActif">
<Volet_Menu v-bind:darktheme="darktheme" v-bind:panierChoisi = "panierChoisi" @filtre_choisi="passerFiltre" @basculeRechercheFiltre="basculeRechercheFiltre"/>
<Volet_Contenu v-bind:darktheme="darktheme" @mode_choisi="ajusterMode" v-bind:filtre_choisi="filtre_choisi" v-bind:variante="variante" v-bind:auteur="auteur"
@filtresChoisis="filtresChoisis" v-bind:razModeVariante="razModeVariante" v-bind:modeFiltre="modeFiltre" />
<Volet_Contenu v-bind:darktheme="darktheme" @mode_choisi="ajusterMode" v-bind:filtre_choisi="filtre_choisi" v-bind:variante="variante"
v-bind:auteur="auteur" @filtresChoisis="filtresChoisis" v-bind:razModeVariante="razModeVariante"
v-bind:modeFiltre="modeFiltre" v-bind:deconnexion="deconnexion" />
</div>
</div>
<div id="tableau" :class="darktheme ? 'tableaudark' : ''" :style="isActif ? {width: '90%'} : {width: '98%'}" >
<div class="choixPanier" v-show="panierChoisi && (!modeModification && !modeConsultation)">
<label id="labelPerso" :style="isActif ? {'margin-left': '-5px'} : {'margin-left': '148px'}">Perso </label>
<label id="labelPerso" :style="isActif ? {'margin-left': '-5px'} : {'margin-left': '180px'}">Perso </label>
<input type="checkbox" class="filtreTableau" id="filtrePerso" v-model="persoChecked"
v-on:click="persoChecked = !persoChecked" name="perso" value="tiers"/>
<label> Tiers </label>
......@@ -38,7 +39,7 @@
}" >
<thead>
<tr>
<th v-bind:colspan="!isActif ? 10 : 8">Contenus</th>
<th v-bind:colspan="isActif ? 10 : (panierChoisi ? 12 : 11)">Contenus</th>
</tr>
</thead>
<tr v-bind:style="!darktheme ? {'background-color': 'orange'} : {'background-color': '#FF8C00'}">
......@@ -48,10 +49,12 @@
<th v-on:click="trierColonne">Date Version actuelle</th>
<th v-on:click="trierColonne">Nbre d'Utilisations</th>
<th v-on:click="trierColonne">Likes</th>
<th v-on:click="trierColonne">Tags</th>
<th v-on:click="trierColonne" v-show="!isActif">Type</th>
<th v-on:click="trierColonne" v-show="!isActif">Source</th>
<th v-on:click="trierColonne">Note</th>
<th v-on:click="trierColonne" v-show="panierChoisi">Note Perso</th>
<th v-on:click="trierColonne" v-show="!isActif">Tags Fixes </th>
<th v-on:click="trierColonne" v-show="!isActif && panierChoisi">Tags Libres</th>
<th v-on:click="trierColonne" >Type</th>
<th v-on:click="trierColonne">Source</th>
<th v-on:click="supprimerContenus" class="supprimerContenus">
<img v-bind:style="{'background-color': 'orange'}" v-bind:src="panierChoisi ? imgPoubelle : imgEtoile" alt='' height=20 width=20/></th>
......@@ -59,7 +62,7 @@
<tbody>
<tr v-show="panierChoisi && (persoChecked ** (item.provenance === 'perso')) && (tiersChecked ** (item.provenance === 'tiers'))
&& (enCoursChecked ** (item.provenance === 'en-cours'))" v-for="item in filterContenu" :key="item.titre"
&& (enCoursChecked ** (item.provenance === 'en-cours'))" v-for="item in filterContenu" :key="JSON.stringify(item._id)"
v-bind:style="{
'background-color': item.provenance === 'perso' ? 'white' : item.provenance === 'tiers' ? 'red' : 'blue'
}">
......@@ -67,9 +70,6 @@
<b-popover style="height: 700px; width: 700px" class="non" v-on:show="rechercherTexte(item._id, item.provenance, item.source)" :target="JSON.stringify(item._id)" triggers="hover" placement="bottom">
<p id="beautiful" v-html="texteDuContenu" v-if="!isMoodle"></p>
<Test v-else></Test>
<!-- <iframe src="http://localhost:8083/shimeta.html" style="height: 500px; width: 300px; zoom: 0.75" name="targetframe" allowTransparency="true" scrolling="no" frameborder="0" >
</iframe>-->
<!-- <div class="previsualisationPanier"></div>-->
</b-popover>
<!-- auteur -->
<td>{{item.auteur}}</td>
......@@ -81,19 +81,22 @@
<td v-else>{{ item.versionEnCours.date }}</td>
<!-- popularité -->
<td v-if="item.provenance === 'en-cours'"> - </td>
<td v-else>{{ item.versionEnCours.popularite }}</td>
<td v-else>{{ item.popularite }}</td>
<!-- note -->
<td v-if="item.provenance === 'en-cours'"> - </td>
<td v-else>{{ item.note }}</td>
<td v-if="item.provenance !== 'en-cours'" v-b-popover.hover.bottom="item.tags_banque_libres.toString()">{{item.tags_banque_libres.toString()}}</td>
<td v-else v-b-popover.hover.bottom="'tags non disponibles'">tags non disponibles</td>
<td v-show="!isActif">{{ item.type }}</td>
<td v-show="!isActif">{{ item.source }}</td>
<td class="boutonSupprimer"> <input type="checkbox" v-on:change="ajouterCoche(item._id, item.provenance)" class="horns" name="horns"/></td>
<td v-else>{{ calculerNote(item) }}</td>
<td>{{ item.note_perso }}</td>
<td v-show="!isActif" v-if="item.provenance !== 'en-cours'" v-b-popover.hover.bottom="item.tags_banque_fixes.toString()">{{item.tags_banque_fixes.toString()}}</td>
<td v-show="!isActif" v-else v-b-popover.hover.bottom="'tags non disponibles'">tags non disponibles</td>
<td v-show="!isActif" v-if="item.provenance !== 'en-cours'" v-b-popover.hover.bottom="item.tags_banque_libres.toString()">{{item.tags_banque_libres.toString()}}</td>
<td v-show="!isActif" v-else v-b-popover.hover.bottom="'tags non disponibles'">tags non disponibles</td>
<td>{{ item.type }}</td>
<td>{{ item.source }}</td>
<td class="boutonSupprimer"> <input type="checkbox" v-on:change="ajouterCoche(item._id, item.provenance, item.note_perso)" class="horns" name="horns"/></td>
</tr>
<tr v-show="!panierChoisi && (!modeModification && !modeConsultation)" v-for="item in contenusbanque" :key="item.titre"
<tr v-show="!panierChoisi && (!modeModification && !modeConsultation)" v-for="item in contenusbanque" :key="JSON.stringify(item._id)"
v-bind:style="{'background-color': 'white'}">
<td :id="'a' + JSON.stringify(item._id)" v-on:click="chargerContenu(item, 'banque')">{{ item.titre }}</td>
<b-popover :target="'a' + JSON.stringify(item._id)" v-on:show="rechercherTexte(item._id, 'banque', item.source)" triggers="hover" placement="bottom">
......@@ -103,10 +106,11 @@
<td>{{ item.auteur }}</td>
<td>{{item.versionEnCours.numero}}</td>
<td>{{item.versionEnCours.date}}</td>
<td class="prout">{{item.versionEnCours.popularite}}</td>
<td>{{item.note}}</td>
<td v-b-popover.hover.bottom="item.tags_banque_fixes.toString()">{{item.tags_banque_fixes.toString()}}</td>
<td class="prout">{{item.popularite}}</td>
<td>{{calculerNote(item)}}</td>
<td v-show="!isActif" v-b-popover.hover.bottom="item.tags_banque_fixes.toString()">{{item.tags_banque_fixes.toString()}}</td>
<td>{{ item.type }}</td>
<td>{{ item.source }}</td>
<td class="boutonSupprimer"> <input type="checkbox" v-on:change="ajouterCoche(item._id, item.versionEnCours)" class="horns" name="horns"/></td>
</tr>
......@@ -130,7 +134,7 @@
v-bind:contenuCliqueProvenance = "contenuCliqueProvenance" v-show="modeConsultation"/>
<Modifier_Contenu v-bind:auteur="auteur" v-bind:texteDuContenu = "texteDuContenu" v-bind:contenuCliqueProvenance = "contenuCliqueProvenance"
v-show="modeModification" @actionContenu="actionContenu" v-bind:contenuClique = "contenuClique"
@choixModif="choixModif" v-bind:titreContenu="titreContenu"/>
@choixModif="choixModif" v-bind:titreContenu="titreContenu" @majMoyenne="majMoyenne"/>
</div>
</template>
......@@ -199,8 +203,19 @@ export default {
modeFiltre: false,
isMoodle: false,
texteBoutonvariante: "changer",
// booléens pour le tri des colonnes du tableau
titreTrie: false,
auteurTrie: false,
versionTriee: false,
dateTriee: false,
populariteTriee: false,
noteTriee: false,
notePersoTriee: false,
typeTrie: false,
sourceTrie: false,
notePersonnelle: "-",
chocolat: '<h1 id="hellomarkdown">hello, markdown!</h1>',
isDeconnecte: false,
imgEtoile: "https://previews.123rf.com/images/ylivdesign/ylivdesign1612/ylivdesign161208906/67933171-ic%C3%B4ne-%C3%A9toile-%C3%A0-cinq-branches-jaunes-illustration-de-dessin-anim%C3%A9-d-ic%C3%B4ne-de-vecteur-%C3%A9toile-jaune-%C3%A0-cinq-branches-.jpg",
imgPoubelle: "data:image/png;base64,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"
}
......@@ -223,6 +238,7 @@ export default {
deconnexion: function () {
this.modeModification = false
this.panierChoisi = true
this.isDeconnecte = true
},
/**
* @vuese
......@@ -234,6 +250,8 @@ export default {
this.contenusDeLaBanque()
this.token = localStorage.token
this.panierChoisi = true
this.checkes = []
$(".horns").prop( "checked", false );
},
/**
* @vuese
......@@ -278,7 +296,9 @@ export default {
// Dès que l'auteur est connu, on charge tous ses contenus
Service.getPanierAuteur(this.auteur).then(function (response) {
// on récupère tous les contenus du panier de l'auteur
that.contenusTotal = Array.from(response.data)
// on les met dans l'array prévue à cet effet
that.contenus = that.contenusTotal
})
},
......@@ -344,7 +364,7 @@ export default {
}
)
} else if (this.checkes[i][1] === "tiers"){
Service.supprimerTiers(this.auteur, JSON.stringify(id)).then(
Service.supprimerTiers(this.auteur, JSON.stringify(id), this.checkes[i][2]).then(
function (response) {
let contenuSupprime = that.contenus.filter(contenu => contenu._id === id)
that.contenus = that.contenus.filter(contenu => contenu._id !== id)
......@@ -366,15 +386,18 @@ export default {
else {
for(let i = 0; i < this.checkes.length; i++) {
let id = this.checkes[i][0]
let data = {auteur: this.auteur, id_tiers:JSON.stringify(id) , version: this.checkes[i][1]["numero"]}
let version = this.checkes[i][1]["numero"]
let data = {auteur: this.auteur, id_tiers:JSON.stringify(id) , version: version}
Service.creerContenuTiers(data).then(
function (response) {
let nouveauTiers = response.data
nouveauTiers.provenance = "tiers"
nouveauTiers.version = nouveauTiers.versionEnCours["numero"]
nouveauTiers.version = version
that.contenus.push(nouveauTiers)
that.contenusbanque = that.contenusbanque.filter(contenu => contenu._id !== id)
// data= {id_contenu:JSON.stringify(id) , version: version}
//Service.incrementerPopularite(data)
}
)
}
......@@ -448,7 +471,7 @@ export default {
let that = this
let auteur = ""
let version = 0;
let id = ''
switch (event.action) {
......@@ -459,8 +482,8 @@ export default {
else {
version = parseInt(event.version)
}
data = {auteur: this.auteur, id_tiers:JSON.stringify(event.contenu._id) , version: version}
id = event.contenu._id
data = {auteur: this.auteur, id_tiers:JSON.stringify(id) , version: version}
Service.creerContenuTiers(data).then(
function (response) {
let nouveauTiers = response.data
......@@ -468,8 +491,13 @@ export default {
nouveauTiers.version = version
that.contenus.push(nouveauTiers)
that.contenusbanque = that.contenusbanque.filter(contenu => contenu._id !== event.contenu._id)
// data= {id_contenu:JSON.stringify(id) , version: version}
// Service.incrementerPopularite(data)
}
)
this.$emit("ChangerTitre", {titre: ""})
this.panierChoisi = false
break
case "modifier":
......@@ -538,12 +566,14 @@ export default {
* @vuese
* Sauvegarde des éléments cochés. Pour suppression (en mode banque) ou mise en tiers (en mode
*/
ajouterCoche: function (idContenu, provenance) {
ajouterCoche: function (idContenu, provenance, notePerso = "") {
let existant = false
for (let i = 0; i < this.checkes.length; i++){
if (this.checkes[i][0] === idContenu){
existant = true
alert('prout')
}
}
......@@ -551,7 +581,7 @@ export default {
this.checkes.splice(this.checkes.indexOf([idContenu, provenance]), 1)
}
else {
this.checkes.push([idContenu, provenance])
this.checkes.push([idContenu, provenance, notePerso])
}
},
/**
......@@ -560,6 +590,12 @@ export default {
*/
rechercherTexte: function (id, provenance, source) {
if (id === undefined)
return
/* console.log("id : " + id)
console.log("provenance : " + provenance)*/
let that = this
// alert('caca : ' + source)
......@@ -655,14 +691,50 @@ export default {
contenusFiltres = this.contenusTotalBanque
}
// on les filtre
let tmp = null
if (event.filtres.filter(contenu => contenu.type === 'auteur').length > 0){
// auteur
let filtre_auteur = (event.filtres.filter(contenu => contenu.type === 'auteur').map(contenu => contenu.filtre))
contenusFiltres = contenusFiltres.filter(contenu => filtre_auteur.includes(contenu.auteur))
}
// date
if (event.filtres.filter(contenu => contenu.type === 'date').length > 0) {
// date
let dt = new Date()
let filtre_date = (event.filtres.filter(contenu => contenu.type === 'date').map(contenu => contenu.filtre))
switch (filtre_date.toString()){
case "Les 7 derniers jours":
dt.setDate( dt.getDate() - 7 )
break
case "De ce mois":
tmp = dt.getDate() - 1
dt.setDate( dt.getDate() - (tmp))
break
case "De cette année":
dt = new Date(new Date().getFullYear(), 0, 1);
break
default:
console.log("Erreur")
break
}
for (let elt in contenusFiltres){
let contenu = contenusFiltres[elt]
if(contenu.provenance === 'perso'){
if (contenu.versionEnCours.date < dt){
contenusFiltres = contenusFiltres.filter(ct => ct._id !== contenu._id)
}
} else {
if (contenu.date < dt){
contenusFiltres = contenusFiltres.filter(ct => ct._id !== contenu._id)
}
}
}
contenusFiltres = contenusFiltres.filter(contenu => contenu.versionEnCours.date >= dt)
contenusFiltres = contenusFiltres.filter(contenu => contenu.date >= dt)
}
if (event.filtres.filter(contenu => contenu.type === 'tags libres').length > 0) {
// tags libres
let filtre_tags_libres = (event.filtres.filter(contenu => contenu.type === 'tags libres').map(contenu => contenu.filtre))
......@@ -687,8 +759,41 @@ export default {
// source
let filtre_source = (event.filtres.filter(contenu => contenu.type === 'source').map(contenu => contenu.filtre))
contenusFiltres = contenusFiltres.filter(contenu => filtre_source.includes(contenu.source))
// manque note, popularite
// manque note
}
if (event.filtres.filter(contenu => contenu.type === 'noteMin')) {
let filtre_source = (event.filtres.filter(contenu => contenu.type === 'noteMin').map(contenu => contenu.filtre))
for(let filtre in filtre_source){
let filtre_min = parseFloat(filtre_source[filtre].substring(1))
contenusFiltres = contenusFiltres.filter(contenu => this.calculerNote(contenu) > filtre_min)
}
}
if (event.filtres.filter(contenu => contenu.type === 'noteMax')) {
let filtre_source = (event.filtres.filter(contenu => contenu.type === 'noteMax').map(contenu => contenu.filtre))
for(let filtre in filtre_source){
let filtre_max = parseFloat(filtre_source[filtre].substring(1))
contenusFiltres = contenusFiltres.filter(contenu => this.calculerNote(contenu) < filtre_max)
//contenusFiltres = contenusFiltres.filter(contenu => contenu.versionEnCours.date <= filtre_max)
}
}
if (event.filtres.filter(contenu => contenu.type === 'noteBorne')) {
let filtre_source = (event.filtres.filter(contenu => contenu.type === 'noteBorne').map(contenu => contenu.filtre))
for(let filtre in filtre_source) {
let borne_min = parseInt(filtre_source[filtre].substring(0, 1))
let borme_max = parseInt(filtre_source[filtre].substring(filtre_source[filtre].indexOf("-")+1).trim())
contenusFiltres = contenusFiltres.filter(contenu => this.calculerNote(contenu) > borne_min)
contenusFiltres = contenusFiltres.filter(contenu => this.calculerNote(contenu) < borme_max)
}
}
// et on les réinjecte dans la "source"
if (this.panierChoisi){
this.contenus = contenusFiltres
......@@ -721,7 +826,7 @@ export default {
break
case "Nbre d'utilisations":
break
case "Likes":
case "Note":
break
case "Type":
break
......@@ -737,6 +842,46 @@ export default {
} else {
console.log(titreColonne)
}
},
calculerNote: function(item) {
if (item.version !== undefined){
for (let it in item.historique){
if (item.historique[it].numero === item.version){
if (item.historique[it].note === 0){
return 0
}
return (item.historique[it].note / item.historique[it].nbreNotes).toFixed(2)
}
}
return -1
} else {
if (item.versionEnCours.note === 0){
return 0
}
return (item.versionEnCours.note / item.versionEnCours.nbreNotes).toFixed(2)
}
},
recupererNotePerso: async function (item) {
if (item.provenance)
await Service.recupererNoteContenu(JSON.stringify(item._id), this.auteur, item.version).then(function (result) {
let nombre = JSON.parse(result.data)
if (nombre !== '-1') {
return nombre.note
} else {
return "-"
}
})
},
majMoyenne: function(event){
for (let elt in this.contenus){
if(this.contenus[elt]._id === event.id){
this.contenus[elt].versionEnCours.note = event.note
this.contenus[elt].versionEnCours.nbreNotes = event.nbreNotes
this.contenus[elt].note_perso = event.notePerso
break
}
}
}
}
}
......
......@@ -2,11 +2,11 @@
<div id="contenu">
<div id = "detailFiltre">
<Detail_Filtre v-bind:nouveau_filtre="nouveau_filtre" @filtresChoisis="filtresChoisis"/>
<Detail_Filtre v-bind:nouveau_filtre="nouveau_filtre" @filtresChoisis="filtresChoisis" v-bind:deconnexion="deconnexion"/>
</div>
<div id = "detailContenu">
<Detail_Contenu v-bind:modeFiltre="modeFiltre" v-bind:panierChoisi="panierChoisi" v-bind:filtre_choisi="filtre_choisi"
v-bind:auteur="auteur" @creer_filtre="creer_filtre"/>
v-bind:auteur="auteur" @creer_filtre="creer_filtre" v-bind:deconnexion="deconnexion"/>
</div>
<Choix_Mode v-show="!variante" v-bind:darktheme="darktheme" @mode_choisi="ajusterMode" v-bind:razModeVariante="razModeVariante" />
</div>
......@@ -36,7 +36,9 @@ export default {
// mode filtre enclenché ou non
modeFiltre: {},
// Signal d'activation ou non du theme sombre
darktheme: {}
darktheme: {},
// Signal de deconnexion
deconnexion: {}
},
methods: {
......
......@@ -23,7 +23,12 @@ export default {
}
},
props: ['auteur', 'panierChoisi'],
props: {
// l'auteur en cours
auteur: {},
// le mode panier est-il activé ou non?
panierChoisi: {}
},
computed: {
filteredList: function () {
if (!this.panierChoisi){
......@@ -34,6 +39,10 @@ export default {
}
},
watch:{
/**
* @vuese
* Dès que l'auteur est connu, on charge toues les auteurs disponibles en bd
*/
auteur: function () {
let that = this
Service.recupererAuteursExistants().then(function (reponse) {
......
......@@ -23,6 +23,7 @@ export default {
methods: {
choixDate: function () {
this.$emit("creer_filtre", {filtre: this.date, type: 'date'})
// this.date = 'Toutes les périodes'
}
},
data: function () {
......
<template>
<div>
<span>selectionner une note minimale</span><br>
<select id="choixNoteMin" v-model="noteMin" @change="choixNoteMin">
<option>>0.5</option>
<option>>1.5</option>
<option>>2.5</option>
<option>>3.5</option>
<option>>4.5</option>
</select>
<p>ou </p>
<span>selectionner une note maximale</span><br>
<select id="choixNoteMax" v-model="noteMax" @change="choixNoteMax">
<option>&lt;0.5</option>
<option>&lt;1.5</option>
<option>&lt;2.5</option>
<option>&lt;3.5</option>
<option>&lt;4.5</option>
</select>
<p>ou </p>
<span>selectionner une plage de notes</span><br>
<label>Borne min </label>
<input v-model="borneInf" type="text"/>
<label> Borne max </label>
<input v-model="borneSup" type="text"/><br>
<button v-on:click="validerPlage"></button>
</div>
</template>
<script>
export default {
name: "Filtre_Note_Popularite",
data: function () {
return {
noteMin: 0,
noteMax: 5,
borneInf: 0,
borneSup: 5
}
},
methods:{
choixNoteMin: function () {
let vraieNoteMin = parseFloat(this.noteMin.substring(1))
let vraieNoteMax = 5
if (this.noteMax !== 5)
vraieNoteMax = parseFloat(this.noteMax.substring(1))
if (vraieNoteMin >= vraieNoteMax){
alert ("note min : " + vraieNoteMin + " note max : " + vraieNoteMax)
alert ('error')
} else {
this.$emit("creer_filtre", {filtre: this.noteMin, type: "noteMin"})
}
this.noteMin = ""
},
choixNoteMax: function () {
let vraieNoteMin = 0
if (this.noteMin !== 0)
vraieNoteMin = parseFloat(this.noteMin.substring(1))
let vraieNoteMax = parseFloat(this.noteMax.substring(1))
if (vraieNoteMin >= vraieNoteMax){
alert ("note min : " + vraieNoteMin + " note max : " + vraieNoteMax)
alert ('error')
} else {
this.$emit("creer_filtre", {filtre: this.noteMax, type: "noteMax"})
}
this.noteMax = ""
},
validerPlage: function () {
this.$emit("creer_filtre", {filtre: this.borneInf + " - " + this.borneSup, type: "noteBorne"})
this.borneInf = 0
this.borneSup = 5
}
},
props: {
// Signal de deconnexion
deconnexion: {}
},
watch: {
/**
* @vuese
* A la deconnexion, on vide l'affichage des notes
*/
deconnexion: function () {
this.noteMin = ""
this.noteMax = ""
}
}
}
</script>
<style scoped>
input {
width: 20px;
margin-left: 2px;
}
button {
padding: 0;
border: none;
background: none;
}
</style>
\ No newline at end of file
<template>
<div>
<p> (Modalités du filtre à définir ultérieurement)</p>
<div id="selectionnerNote"><span>selectionner une "note"</span></div>
<br>
ou
<br>
<br>
<div id="selectionnerPopularité"><span>selectionner une popularité</span></div>
</div>
</template>
<script>
export default {
name: "Filtre_Note_Popularite"
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -50,7 +50,10 @@
export default {
name: "Filtre_Tag",
props: ['filtreChoisi'],
props: {
// permet de déterminer si on est en mode tag_libre ou tag_fixe
filtreChoisi: {}
},
methods: {
naviguer: function (e) {
if (e.offsetX > e.target.offsetLeft) {
......
......@@ -4,18 +4,15 @@
<div id="selectionnerType">
<span>selectionner un type</span><br><br>
<select id="type" name="type" size="1" v-model="type" v-on:change="choixType()">
<option>type1</option>
<option>type2</option>
<option>type3</option>
<option>quiz</option>
</select>
</div>
<div id="selectionnerSource">
<br> <span>selectionner une source</span><br><br>
<select id="source" name="source" size="1" v-model="source" v-on:change="choixSource()">
<option>source1</option>
<option>source2</option>
<option>source3</option>
<option>markdown</option>
<option>moodle</option>
</select>
</div>
......@@ -34,13 +31,25 @@ export default {
methods: {
choixType: function () {
this.$emit("creer_filtre", {filtre: this.type, type: 'type'})
this.type = ""
},
choixSource: function () {
this.$emit("creer_filtre", {filtre: this.source, type: 'source'})
this.source = ""
}
},
props: {
// Signal de deconnexion
deconnexion: {}
},
watch: {
deconnexion: function () {
this.type = ""
this.source = ""
}
}
}
......
......@@ -70,8 +70,8 @@ export default {
return axios.delete(urlBase + contenus + "deletePerso/" + idContenu, this.getHeader(localStorage.token))
},
supprimerTiers(auteur, id_tiers) {
return axios.delete(urlBase + contenus + "deleteTiers?auteur=" + auteur + "&id_tiers=" + id_tiers, this.getHeader(localStorage.token))
supprimerTiers(auteur, id_tiers, note) {
return axios.delete(urlBase + contenus + "deleteTiers?auteur=" + auteur + "&id_tiers=" + id_tiers + "&note=" + note, this.getHeader(localStorage.token))
},
creerNouveauContenu(data) {
......@@ -102,7 +102,15 @@ export default {
recupererTexteVersionContenu(idContenu, version){
return axios.get(urlBase + contenus + "getTexteVersionContenu/" + idContenu + "/" + version, this.getHeader(localStorage.token))
},
incrementerPopularite(data){
return axios.patch(urlBase + contenus + "incrementerPopularite", data, this.getHeader(localStorage.token))
},
noterContenu(data){
return axios.patch(urlBase + contenus + "noterContenu", data, this.getHeader(localStorage.token))
},
recupererNoteContenu(idContenu, auteur, version){
return axios.get(urlBase + contenus + "recupererNote?auteur=" + auteur + "&version=" + version + "&id_contenu=" + idContenu, this.getHeader(localStorage.token))
},
// gestion des en-cours
creerEnCours(data) {
return axios.post(urlBase + en_cours + "newEnCours", data, this.getHeader(localStorage.token))
......@@ -118,6 +126,7 @@ export default {
return axios.get(urlBase + en_cours + "getTexteContenuEnCours/" + idContenu, this.getHeader(localStorage.token))
},
// gestion des demandes de publication
getPublicationsRecues(auteur) {
......@@ -134,5 +143,6 @@ export default {
},
supprimerDemandePublication(idDemandePublication) {
return axios.delete(urlBase + demande_pub + "demandePublication/" + idDemandePublication, this.getHeader(localStorage.token))
},
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@ import Login from "../Login.vue";
import {mount} from "@vue/test-utils";
import { shallowMount } from '@vue/test-utils'
import Service from "../service/Service";
import Tags from "../Tags";
import Tags from "../GererTags";
// Rien a tester dans Index.vue, car c'est juste un "aggrégateur" pour d'autres composants.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment