Commit b1dbf237 authored by Jérémie Passerat's avatar Jérémie Passerat

Configuration du filtrage des contenus

parent ac381ee3
...@@ -2,21 +2,15 @@ ...@@ -2,21 +2,15 @@
<div> <div>
<Login v-show="etat === 'unlogged'" @user_logged="setLogged"></Login> <Login v-show="etat === 'unlogged'" @user_logged="setLogged"></Login>
<Menu v-show="etat !== 'unlogged'" v-bind:auteur="auteur" v-bind:etat="etat" v-bind:variante="variante" @menu_choisi="changerPage"></Menu> <Menu v-show="etat !== 'unlogged'" v-bind:auteur="auteur" v-bind:etat="etat" v-bind:variante="variante"
v-bind:recalculerNotif="recalculerNotif" @menu_choisi="changerPage"></Menu>
<Contenu v-show="etat === 'Contenu'" v-bind:auteur="auteur" v-bind:contenuAjoute="contenuAjoute" @choix_variante="choixVariante" @newContenu="newContenu"></Contenu> <Contenu v-show="etat === 'Contenu'" v-bind:auteur="auteur" v-bind:contenuAjoute="contenuAjoute" @choix_variante="choixVariante" @newContenu="newContenu"></Contenu>
<Maj v-show="etat === 'Mises à jour'" v-bind:auteur="auteur" v-bind:isRecu="isRecu" v-bind:isPropose="isPropose" <Maj v-show="etat === 'Mises à jour'" v-bind:auteur="auteur" v-bind:isRecu="isRecu" v-bind:isPropose="isPropose"
v-bind:contenuEnPublication="contenuEnPublication" ></Maj> v-bind:contenuEnPublication="contenuEnPublication" @recalculerNotif="recalculerNotification" ></Maj>
<Profil v-show="etat === 'Profil'" ></Profil> <Profil v-show="etat === 'Profil'" ></Profil>
<Tags v-show="etat === 'Tags'" ></Tags> <Tags v-show="etat === 'Tags'" ></Tags>
<p style="text-align: center" v-show="errorLogin">Login ou mot de passe erroné</p> <p style="text-align: center" v-show="errorLogin">Login ou mot de passe erroné</p>
<NewContenu v-show="etat === 'newContenu'" v-bind:auteur="auteur" @contenuAjoute="ajouterUnContenu" @retourArriere="retourArriere"></NewContenu> <NewContenu v-show="etat === 'newContenu'" v-bind:auteur="auteur" @contenuAjoute="ajouterUnContenu" @retourArriere="retourArriere"></NewContenu>
<!-- <p id="popover-target-1" style="text-align: center">
Hover Me
</p>
<b-popover target="popover-target-1" triggers="click" placement="bottom">
<template #title>Popover Title</template>
<h1>I am</h1> popover <b>component</b> content!
</b-popover>-->
</div> </div>
</template> </template>
...@@ -42,7 +36,8 @@ export default { ...@@ -42,7 +36,8 @@ export default {
auteur: "", auteur: "",
isRecu: false, isRecu: false,
isPropose: false, isPropose: false,
contenuAjoute: false contenuAjoute: false,
recalculerNotif: false
} }
}, },
methods: { methods: {
...@@ -58,8 +53,9 @@ export default { ...@@ -58,8 +53,9 @@ export default {
} }
}, },
changerPage: function (event) { changerPage: function (event) {
if (event.choix === "Deconnexion") if (event.choix === "Deconnexion"){
this.etat = "unlogged" this.etat = "unlogged"
}
else else
this.etat = event.choix this.etat = event.choix
if (event.choix === "Mises à jour"){ if (event.choix === "Mises à jour"){
...@@ -79,6 +75,9 @@ export default { ...@@ -79,6 +75,9 @@ export default {
}, },
retourArriere: function () { retourArriere: function () {
this.etat= "Contenu" this.etat= "Contenu"
},
recalculerNotification: function () {
this.recalculerNotif = !this.recalculerNotif
} }
}, },
......
<template> <template>
<div> <div>
<div v-show="!detailContenu">
<p> Vous êtes {{auteur}}</p>
<span v-bind:class="['niveau', {'niveau-down' : isRecu}]" id="recues" v-on:click="naviguer">Maj Recues</span><br> <span v-bind:class="['niveau', {'niveau-down' : isRecu}]" id="recues" v-on:click="naviguer">Maj Recues</span><br>
<div id="detailRecues" class="masque" v-bind:class="{'affiche' : isRecu}"> <div id="detailRecues" class="masque" v-bind:class="{'affiche' : isRecu}">
<table> <table>
...@@ -9,7 +11,7 @@ ...@@ -9,7 +11,7 @@
</tr> </tr>
</thead> </thead>
<tr> <tr>
<th>Titre</th> <th>Titrette</th>
<th>Auteur</th> <th>Auteur</th>
<th>Version actuelle</th> <th>Version actuelle</th>
<th>Date Version actuelle</th> <th>Date Version actuelle</th>
...@@ -18,23 +20,14 @@ ...@@ -18,23 +20,14 @@
</tr> </tr>
<tbody> <tbody>
<!-- <tr v-show="!panierChoisi" v-for="item in contenusbanque" :key="item.titre">
<td class="modal titreContenu" v-on:click="chargerContenu(item, 'banque')" v-popover:tooltip="'prévisualisation'">{{ item._id }}</td>
<td>{{ item.auteur }}</td>
<td>The table body</td>
<td>with two columns</td>
<td>with two columns</td>
<td>with two columns</td>
<td class="modal tagContenu" v-popover:tooltip="'tags'">with two columns</td>
<td class="boutonSupprimer"> <input type="checkbox" v-on:change="ajouterCoche(item._id, item.versionEnCours)" class="horns" name="horns"/></td>
</tr>-->
<tr v-for="(item, index) in contenusRecu" :key="index"> <tr v-for="(item, index) in contenusRecu" :key="index">
<td>Contenu1</td> <td :id="JSON.stringify(item._id)" v-on:click="consulterContenuMaj(item)">Contenu1</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>
</b-popover>
<td>{{ item.auteurDemande }}</td> <td>{{ item.auteurDemande }}</td>
<td>1</td> <td>prout : {{contenusRecu.length}}</td>
<td>01/06/2021</td> <td>01/06/2021</td>
<td id="valider" v-on:click="gererPublication(item, 'o')"><img v-bind:src="imageCoche" alt='' height=20 width=20></td> <td id="valider" v-on:click="gererPublication(item, 'o')"><img v-bind:src="imageCoche" alt='' height=20 width=20></td>
<td id="refuser" v-on:click="gererPublication(item, 'n')"><img v-bind:src="imageCroix" alt='' height=20 width=20></td> <td id="refuser" v-on:click="gererPublication(item, 'n')"><img v-bind:src="imageCroix" alt='' height=20 width=20></td>
...@@ -66,26 +59,39 @@ ...@@ -66,26 +59,39 @@
<tbody> <tbody>
<tr v-for="(item, index) in contenusPropose" :key="index"> <tr v-for="(item, index) in contenusPropose" :key="index">
<td>Contenu1</td> <td :id="JSON.stringify(item._id)" v-on:click="consulterContenuMaj(item)">Contenu1</td>
<b-popover :target="JSON.stringify(item._id)" v-on:show="rechercherTexte(item._id, 'banque')" triggers="hover" placement="bottom">
<p v-html="texteDuContenu"></p>
</b-popover>
<td>{{ item.auteurContenu }}</td> <td>{{ item.auteurContenu }}</td>
<td>1</td> <td>1</td>
<td>01/06/2021</td> <td>01/06/2021</td>
<td>{{ item.etat }}</td> <td>{{ item.etat }}</td>
<td v-if="item.etat === 'enCours'" v-on:click="conserver(item)"><img v-bind:src="imageCoche" alt='' height=20 width=20></td> <td v-if="item.etat === 'refus'" v-on:click="conserver(item)"><img v-bind:src="imageCoche" alt='' height=20 width=20></td>
<td v-if="item.etat === 'enCours'" v-on:click="creerNouveau(item)"><img v-bind:src="imgNouveau" alt='' height=20 width=20></td> <td v-else></td>
<td v-if="item.etat === 'enCours'" v-on:click="supprimer(item)"><img v-bind:src="imgPoubelle" alt='' height=20 width=20></td> <td v-if="item.etat === 'refus'" v-on:click="creerNouveau(item)"><img v-bind:src="imgNouveau" alt='' height=20 width=20></td>
<td v-else></td>
<td v-if="item.etat !== 'enCours'" v-on:click="supprimer(item)"><img v-bind:src="imgPoubelle" alt='' height=20 width=20></td>
<td v-else></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<Consulter_Contenu v-show="detailContenu" @retour_arriere="retourArriere" v-bind:auteur="auteur" v-bind:contenuClique="contenuChoisi" v-bind:contenu-clique-provenance="contenuCliqueProvenance"/>
</div>
</template> </template>
<script> <script>
import Service from "@/service/Service"; import Service from "@/service/Service";
import Consulter_Contenu from "@/components/Consulter_Contenu";
export default { export default {
name: "Maj", name: "Maj",
components: {
Consulter_Contenu
},
props: ['contenuEnPublication', 'auteur', 'isRecu', 'isPropose'], props: ['contenuEnPublication', 'auteur', 'isRecu', 'isPropose'],
methods: { methods: {
naviguer: function (e) { naviguer: function (e) {
...@@ -94,10 +100,12 @@ export default { ...@@ -94,10 +100,12 @@ export default {
}, },
conserver: function (item) { conserver: function (item) {
let that = this let that = this
let data = {auteur: this.auteur, id_contenu: JSON.stringify(item.idContenu), version: item.version_en_cours.toString()} let data = {id_contenu_en_cours: JSON.stringify(item.idContenuEnCours)}
Service.creerEnCoursRefuse(data).then( function () { Service.creerEnCoursRefuse(data).then( function () {
Service.supprimerDemandePublication(JSON.stringify(item._id)).then(function () {
that.publicationsProposees() that.publicationsProposees()
})
} }
) )
}, },
...@@ -119,6 +127,8 @@ export default { ...@@ -119,6 +127,8 @@ export default {
gererPublication: function (item, reponse) { gererPublication: function (item, reponse) {
let that = this let that = this
let data = "" let data = ""
// auteurContenu -> undefined == nous sommes sur une maj tiers. Le cas contraire = maj d'un contenu perso à faire
if (item.auteurContenu === undefined) { if (item.auteurContenu === undefined) {
data = {id_tiers: JSON.stringify(item[0]._id), reponse: reponse, auteur: this.auteur} data = {id_tiers: JSON.stringify(item[0]._id), reponse: reponse, auteur: this.auteur}
...@@ -127,12 +137,17 @@ export default { ...@@ -127,12 +137,17 @@ export default {
}) })
}else { }else {
// item._id -> id de la demande de publication
data = {id_publication: JSON.stringify(item._id), reponse: reponse, auteur: item.auteurDemande} data = {id_publication: JSON.stringify(item._id), reponse: reponse, auteur: item.auteurDemande}
this.contenusRecu = [] this.contenusRecu = []
Service.gererDemandePublication(data).then(function () { Service.gererDemandePublication(data).then(function () {
that.publicationsRecues() that.publicationsRecues()
}) })
} }
this.$emit("recalculerNotif")
}, },
publicationsRecues: function () { publicationsRecues: function () {
let that = this let that = this
...@@ -140,25 +155,51 @@ export default { ...@@ -140,25 +155,51 @@ export default {
Service.getPublicationsRecues(this.auteur).then(function (response) { Service.getPublicationsRecues(this.auteur).then(function (response) {
let reception = response.data let reception = response.data
that.contenusRecu = []
for (let i = 0; i < reception.length; i++) { for (let i = 0; i < reception.length; i++) {
if (reception[i].etat === "enCours") { if (reception[i].etat === "enCours") {
that.contenusRecu.push(reception[i]) that.contenusRecu.push(reception[i])
} }
} }
Service.listeMajTiers(that.auteur).then(function (response){
if(response.data.length > 0)
that.contenusRecu.push(response.data)
})
}) })
Service.listeMajTiers(this.auteur).then(function (response){
that.contenusRecu.push(response.data)
})
}, },
publicationsProposees: function () { publicationsProposees: function () {
let that = this let that = this
// Dès que l'auteur est connu, on charge tous ses contenus // Dès que l'auteur est connu, on charge tous ses contenus
Service.getPublicationsProposees(this.auteur).then(function (response) { Service.getPublicationsProposees(this.auteur).then(function (response) {
that.contenusPropose = []
that.contenusPropose = response.data that.contenusPropose = response.data
}) })
},
consulterContenuMaj: function (item) {
this.detailContenu = true
this.contenuChoisi = item
this.contenuCliqueProvenance = "maj"
},
retourArriere: function () {
this.detailContenu = false
},
rechercherTexte(id){
let that = this
Service.recupererTexteContenuEnCours(JSON.stringify(id)).then(
function (response) {
let showdown = require('showdown'),
converter = new showdown.Converter()
that.texteDuContenu = converter.makeHtml(response.data)
}
)
} }
}, },
data: function () { data: function () {
...@@ -169,14 +210,17 @@ export default { ...@@ -169,14 +210,17 @@ export default {
imgNouveau: "https://png.pngtree.com/png-vector/20190129/ourmid/pngtree-vector-new-icon-png-image_423422.jpg", imgNouveau: "https://png.pngtree.com/png-vector/20190129/ourmid/pngtree-vector-new-icon-png-image_423422.jpg",
contenusRecu: [], contenusRecu: [],
contenusPropose: [], contenusPropose: [],
action: false action: false,
detailContenu: false,
contenuChoisi: null,
contenuCliqueProvenance: '',
texteDuContenu: ''
} }
}, },
watch: { watch: {
auteur: function () { auteur: function () {
this.publicationsRecues() this.publicationsRecues()
this.publicationsProposees() this.publicationsProposees()
} }
}, },
} }
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
isPropose: false isPropose: false
} }
}, },
props: ['etat', 'variante', 'auteur'], props: ['etat', 'variante', 'auteur', 'recalculerNotif'],
methods: { methods: {
choixMenuAnnexe: function (e) { choixMenuAnnexe: function (e) {
this.$emit("menu_choisi", {choix: e.target.innerText}) this.$emit("menu_choisi", {choix: e.target.innerText})
...@@ -47,6 +47,7 @@ export default { ...@@ -47,6 +47,7 @@ export default {
let that = this let that = this
Service.getPublicationsRecues(this.auteur).then(function (response) { Service.getPublicationsRecues(this.auteur).then(function (response) {
let contenusRecu = response.data let contenusRecu = response.data
for (let i = 0; i < contenusRecu.length; i++) { for (let i = 0; i < contenusRecu.length; i++) {
if (contenusRecu[i].etat === "enCours") { if (contenusRecu[i].etat === "enCours") {
...@@ -54,13 +55,16 @@ export default { ...@@ -54,13 +55,16 @@ export default {
that.isRecu = that.isNotif that.isRecu = that.isNotif
} }
} }
that.majTiers()
}) })
}, },
publicationsProposees: function () { publicationsProposees: function () {
let that = this let that = this
Service.getPublicationsProposees(this.auteur).then(function (response) { Service.getPublicationsProposees(this.auteur).then(function (response) {
let contenusPropose = response.data let contenusPropose = response.data
for (let i = 0; i < contenusPropose.length; i++) { for (let i = 0; i < contenusPropose.length; i++) {
if (contenusPropose[i].etat !== "enCours") { if (contenusPropose[i].etat !== "enCours") {
that.isNotif = true that.isNotif = true
that.isPropose = that.isNotif that.isPropose = that.isNotif
...@@ -71,6 +75,7 @@ export default { ...@@ -71,6 +75,7 @@ export default {
majTiers: function () { majTiers: function () {
let that = this let that = this
Service.isMajTiersDisponible(this.auteur).then(function (response) { Service.isMajTiersDisponible(this.auteur).then(function (response) {
if (response.data === "True") { if (response.data === "True") {
that.isNotif = true that.isNotif = true
that.isRecu = that.isNotif that.isRecu = that.isNotif
...@@ -83,10 +88,13 @@ export default { ...@@ -83,10 +88,13 @@ export default {
}, },
watch: { watch: {
auteur: function () { auteur: function () {
this.isNotif = false
this.publicationsRecues() this.publicationsRecues()
this.publicationsProposees() this.publicationsProposees()
this.majTiers() },
recalculerNotif: function () {
this.isNotif = false
this.publicationsRecues()
} }
} }
} }
......
<template> <template>
<div> <div>
<p>Bonjour, je suis l'intérieur de {{contenuClique.versionEnCours}}</p>
<p>(Dans le futur, ces actions varieront en fonction du type de contenu cliqué dans la 'fenetre principale')</p> <p>(Dans le futur, ces actions varieront en fonction du type de contenu cliqué dans la 'fenetre principale')</p>
<div id="actionsContenu">
<button v-show="contenuCliqueProvenance !== 'banque'" v-on:click="actionContenu('modifier')">modifier le contenu</button> <div id="actionsContenu" v-show="!isContenuRefuse">
<button v-show="contenuCliqueProvenance !== 'banque'" v-on:click="actionContenu('supprimer')">supprimer le contenu</button> <button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance !== 'banque'" v-on:click="actionContenu('modifier')">modifier le contenu</button>
<button v-show="contenuCliqueProvenance === 'en-cours' && contenuClique.origine === 'tiers'" v-on:click="actionContenu('publier')">publier le contenu</button> <button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance !== 'banque'" v-on:click="actionContenu('supprimer')">supprimer le contenu</button>
<button v-show="contenuCliqueProvenance === 'en-cours' && contenuClique.origine === 'perso'" v-on:click="actionContenu('validerModification')">valider la modification</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 === 'banque'" v-on:click="actionContenu('mettreFavori')">mettre le contenu en tiers</button> <button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance === 'en-cours' && (contenuClique.origine === 'perso' || contenuClique.anonyme === 'oui')" v-on:click="actionContenu('validerModification')">valider la modification</button>
<button v-show="contenuCliqueProvenance !== 'maj' && contenuCliqueProvenance === 'banque'" v-on:click="actionContenu('mettreFavori')">mettre le contenu en tiers</button>
<br> <br>
<select v-show="(contenuCliqueProvenance === 'banque' <select v-show="(contenuCliqueProvenance === 'banque'
|| contenuCliqueProvenance === 'perso') || contenuCliqueProvenance === 'perso')
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
</span> </span>
<br> <br>
</div> </div>
<p style="text-align: center" v-show="isContenuRefuse"> Ceci est un contenu en cours ayant fait l'objet d'un refus de publication. Aucune action disponible</p>
<button id="ren" v-on:click="revenirArriere">Retour en arrière</button> <button id="ren" v-on:click="revenirArriere">Retour en arrière</button>
</div> </div>
...@@ -41,7 +42,11 @@ export default { ...@@ -41,7 +42,11 @@ export default {
this.$emit("actionContenu", {action: action, contenu: this.contenuClique, texte: this.contenu}) this.$emit("actionContenu", {action: action, contenu: this.contenuClique, texte: this.contenu})
}, },
revenirArriere: function () { revenirArriere: function () {
if (this.contenuCliqueProvenance === 'maj'){
this.$emit("retour_arriere")
} else {
this.$emit("retour_arriere", {panierChoisi: this.contenuCliqueProvenance !== 'banque'}) this.$emit("retour_arriere", {panierChoisi: this.contenuCliqueProvenance !== 'banque'})
}
}, },
changerVersion: function () { changerVersion: function () {
let that = this let that = this
...@@ -57,12 +62,17 @@ export default { ...@@ -57,12 +62,17 @@ export default {
return { return {
contenu: '', contenu: '',
versionMax: 1, versionMax: 1,
versionChoisie: 1 versionChoisie: 1,
isContenuRefuse :false
} }
}, },
watch: { watch: {
contenuClique: function () { contenuClique: function () {
let that = this let that = this
if (Object.prototype.hasOwnProperty.call(this.contenuClique, 'refuse')){
this.isContenuRefuse = true
}
if(this.contenuCliqueProvenance === 'en-cours') { if(this.contenuCliqueProvenance === 'en-cours') {
Service.recupererTexteContenuEnCours(JSON.stringify(this.contenuClique._id)).then( Service.recupererTexteContenuEnCours(JSON.stringify(this.contenuClique._id)).then(
function (response) { function (response) {
...@@ -72,8 +82,16 @@ export default { ...@@ -72,8 +82,16 @@ export default {
) )
} }
else if (this.contenuCliqueProvenance === 'maj'){
Service.recupererTexteContenuEnCours(JSON.stringify(this.contenuClique.idContenuEnCours)).then(
function (response) {
that.contenu = response.data
// alert(response.data)
}
)
}
else { else {
if (this.contenuCliqueProvenance !== 'tiers'){ if (this.contenuCliqueProvenance === 'perso'){
this.versionMax = this.contenuClique.versionEnCours.numero this.versionMax = this.contenuClique.versionEnCours.numero
this.versionChoisie = this.versionMax this.versionChoisie = this.versionMax
} }
......
<template> <template>
<div> <div>
<p v-show="filtre_choisi.length === 0">Ajoutez des filtres pour restreindre la recherche, ou effectuez une recherche libre (bouton en haut à droite)</p> <p v-show="filtre_choisi.length === 0">Ajoutez des filtres pour restreindre la recherche, ou effectuez une recherche libre (bouton en haut à droite)</p>
<Filtre_Tag v-show="filtre_choisi === 'tags officiels' || filtre_choisi === 'tags libres' " @creer_filtre="creer_filtre"/> <Filtre_Tag v-show="filtre_choisi === 'tags officiels' || filtre_choisi === 'tags libres' " v-bind:filtreChoisi="filtre_choisi" @creer_filtre="creer_filtre"/>
<Filtre_Auteur v-show="filtre_choisi === 'auteur'" @creer_filtre="creer_filtre"/> <Filtre_Auteur v-show="filtre_choisi === 'auteur'" @creer_filtre="creer_filtre"/>
<Filtre_Date v-show="filtre_choisi === 'date' " @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_Note_Popularite v-show="filtre_choisi === 'note / popularité' " @creer_filtre="creer_filtre"/>
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
props: ['filtre_choisi'], props: ['filtre_choisi'],
methods: { methods: {
creer_filtre: function (event) { creer_filtre: function (event) {
this.$emit("creer_filtre", {filtre: event.filtre}) this.$emit("creer_filtre", {filtre: event})
} }
} }
......
<template> <template>
<div id="detail_filtre"> <div id="detail_filtre">
<button id="effacerFiltres" v-on:click="effacer_Filtres"></button> <button id="effacerFiltres" v-on:click="effacer_Filtres"></button>
<div id="filtresChoisis" v-for="(index) in filtres_Choisis" :key="index"> <div id="filtresChoisis" v-for="(index) in filtres_Choisis" :key="index.filtre">
<span class="filtreChoisi"> {{index}} <button class="supprimerFiltre" v-on:click="supprimer"></button></span> <span class="filtreChoisi"> {{index.filtre}} <button class="supprimerFiltre" v-on:click="supprimer($event, index)"></button></span>
</div> </div>
</div> </div>
...@@ -13,18 +13,41 @@ export default { ...@@ -13,18 +13,41 @@ export default {
name: "Detail_Filtre", name: "Detail_Filtre",
props: ['nouveau_filtre'], props: ['nouveau_filtre'],
methods: { methods: {
supprimer: function (e) { supprimer: function (e, index) {
e.target.parentElement.remove() e.target.parentElement.remove()
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre !== index)
this.$emit("filtresChoisis", {filtres: this.filtres_Choisis})
}, },
effacer_Filtres: function () { effacer_Filtres: function () {
this.filtres_Choisis = [] this.filtres_Choisis = []
},
changer_filtre_date: function() {
console.log(this.filtres_Choisis)
this.filtres_Choisis = this.filtres_Choisis.filter(filtre => filtre.type !== 'date')
},
filtreDejaPresent: function(nomFiltre) {
return this.filtres_Choisis.filter(filtre => filtre.filtre === nomFiltre).length > 0
} }
}, },
watch: { watch: {
nouveau_filtre: function(newVal) { // watch it nouveau_filtre: function(newVal) { // watch it
//alert('Prop changed: ' + newVal + ' | was: ' + oldVal) if (this.filtres_Choisis.length > 0){
this.filtres_Choisis.push(newVal) if (this.filtreDejaPresent(newVal.filtre.filtre)){
return
}
else if(newVal.filtre.type === 'date'){
this.changer_filtre_date()
if (newVal.filtre.filtre === "Toutes les périodes"){
return
}
}
}
this.filtres_Choisis.push(newVal.filtre)
this.$emit("filtresChoisis", {filtres: this.filtres_Choisis})
} }
} }
, data: function () { , data: function () {
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div id = "detailFiltre"> <div id = "detailFiltre">
<Detail_Filtre v-bind:nouveau_filtre="nouveau_filtre" /> <Detail_Filtre v-bind:nouveau_filtre="nouveau_filtre" @filtresChoisis="filtresChoisis"/>
</div> </div>
<div id = "detailContenu"> <div id = "detailContenu">
<Detail_Contenu v-bind:filtre_choisi="filtre_choisi" @creer_filtre="creer_filtre"/> <Detail_Contenu v-bind:filtre_choisi="filtre_choisi" @creer_filtre="creer_filtre"/>
...@@ -33,7 +33,12 @@ export default { ...@@ -33,7 +33,12 @@ export default {
}, },
creer_filtre: function (event) { creer_filtre: function (event) {
this.nouveau_filtre = event.filtre this.nouveau_filtre = event
},
filtresChoisis: function (event) {
this.$emit("filtresChoisis", {filtres: event.filtres})
} }
}, },
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
<div id="selectionnerAuteur"> <div id="selectionnerAuteur">
<span>selectionner un auteur : </span><br><br> <span>selectionner un auteur : </span><br><br>
<select id="auteur" name="auteur" size="1" v-model="auteur" v-on:change="choixAuteur()"> <select id="auteur" name="auteur" size="1" v-model="auteur" v-on:change="choixAuteur()">
<option>Auteur 1</option> <option v-for="item in listeAuteurs" v-bind:key="item.id">{{ item.nom }}</option>
<option>Auteur 2</option>
<option>Auteur 3</option>
</select> </select>
</div> </div>
...@@ -14,18 +12,27 @@ ...@@ -14,18 +12,27 @@
</template> </template>
<script> <script>
import Service from "@/service/Service";
export default { export default {
name: "Filtre_Auteur", name: "Filtre_Auteur",
methods: { methods: {
choixAuteur: function () { choixAuteur: function () {
// alert(this.auteur) // alert(this.auteur)
this.$emit("creer_filtre", {filtre: this.auteur}) this.$emit("creer_filtre", {filtre: this.auteur, type: 'auteur'})
} }
}, },
mounted() {
let that = this
Service.recupererAuteursExistants().then(function (reponse) {
that.listeAuteurs = reponse.data
})
},
data: function () { data: function () {
return { return {
auteur: "", auteur: "",
listeAuteurs: []
} }
} }
......
<template> <template>
<div id="selectionnerDateunique"> <div id="selectionnerDateunique">
<span>selectionner une plage de dates</span><br> <span>selectionner une période de recherche (une active à la fois)</span><br>
<label for="dateDebut">Date début</label>
<input id="dateDebut" type="date" required="required"/><br> <select v-model="date" @change="choixDate">
<label for="dateFin">Date fin</label>
<input id="dateFin" type="date" required="required"/><br> <option>Toutes les périodes</option>
<button class="validerFiltre" id="validerDates" value="valider" v-on:click="choixDate"/> <option>Les 7 derniers jours</option>
<option>De ce mois</option>
<option>De cette année</option>
</select>
</div> </div>
...@@ -17,7 +22,12 @@ export default { ...@@ -17,7 +22,12 @@ export default {
name: "Filtre_Date", name: "Filtre_Date",
methods: { methods: {
choixDate: function () { choixDate: function () {
this.$emit("creer_filtre", {filtre: this.date, type: 'date'})
}
},
data: function () {
return {
date: 'Toutes les périodes'
} }
} }
} }
......
...@@ -50,12 +50,13 @@ ...@@ -50,12 +50,13 @@
export default { export default {
name: "Filtre_Tag", name: "Filtre_Tag",
props: ['filtreChoisi'],
methods: { methods: {
naviguer: function (e) { naviguer: function (e) {
if (e.offsetX > e.target.offsetLeft) { if (e.offsetX > e.target.offsetLeft) {
//alert(e.target.text()) //alert(e.target.text())
//alert("Je veux mettre" + e.target.innerText + "en filtre") //alert("Je veux mettre" + e.target.innerText + "en filtre")
this.$emit("creer_filtre", {filtre: e.target.innerText}) this.$emit("creer_filtre", {filtre: e.target.innerText, type: this.filtreChoisi})
} }
else{ else{
...@@ -64,7 +65,7 @@ export default { ...@@ -64,7 +65,7 @@ export default {
} }
}, },
nouveauFiltre: function (e) { nouveauFiltre: function (e) {
this.$emit("creer_filtre", {filtre: e.target.innerText}) this.$emit("creer_filtre", {filtre: e.target.innerText, type: this.filtreChoisi})
} }
} }
......
...@@ -33,11 +33,11 @@ export default { ...@@ -33,11 +33,11 @@ export default {
}, },
methods: { methods: {
choixType: function () { choixType: function () {
this.$emit("creer_filtre", {filtre: this.type}) this.$emit("creer_filtre", {filtre: this.type, type: 'type'})
}, },
choixSource: function () { choixSource: function () {
this.$emit("creer_filtre", {filtre: this.source}) this.$emit("creer_filtre", {filtre: this.source, type: 'source'})
} }
......
...@@ -13,6 +13,7 @@ Vue.config.productionTip = false ...@@ -13,6 +13,7 @@ Vue.config.productionTip = false
Vue.use(VPopover, { tooltip: true }) Vue.use(VPopover, { tooltip: true })
Vue.use(mavonEditor) Vue.use(mavonEditor)
Vue.use(BootstrapVue) Vue.use(BootstrapVue)
Vue.prototype.$appName = 'Yumede'
new Vue({ new Vue({
render: h => h(Index), render: h => h(Index),
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
}, },
creerEnCoursRefuse(data) { creerEnCoursRefuse(data) {
return axios.post(urlBase + "newEnCoursRefuse", data) return axios.patch(urlBase + "newEnCoursRefuse", data)
}, },
supprimerEnCours(idContenu) { supprimerEnCours(idContenu) {
...@@ -108,4 +108,7 @@ export default { ...@@ -108,4 +108,7 @@ export default {
recupererTexteVersionContenu(idContenu, version){ recupererTexteVersionContenu(idContenu, version){
return axios.get(urlBase + "getTexteVersionContenu/" + idContenu + "/" + version) return axios.get(urlBase + "getTexteVersionContenu/" + idContenu + "/" + version)
}, },
recupererAuteursExistants(){
return axios.get(urlBase + "auteursExistants")
}
} }
\ No newline at end of file
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