Commit 045f8d04 authored by Jérémie Passerat's avatar Jérémie Passerat

modification en-cours finie

parent bd8b9014
...@@ -719,53 +719,60 @@ export default { ...@@ -719,53 +719,60 @@ export default {
//this.contenuClique = [] //this.contenuClique = []
//this.contenuCliqueProvenance = '' //this.contenuCliqueProvenance = ''
this.$emit("ChangerTitre", {titre: ""}) if (event.action !== 'arriere') {
let data = {}
// on prépare les données suivant le type de contenu ('valider' -> markdown, 'modifier' -> XML moodle) this.$emit("ChangerTitre", {titre: ""})
if (event.action === "valider") { let data = {}
let nouveau_titre = event.titre // on prépare les données suivant le type de contenu ('valider' -> markdown, 'modifier' -> XML moodle)
data = {nouveau_texte: event.nouveauTexte, nouveau_titre: nouveau_titre} if (event.action === "valider") {
} else if (event.action === "modifier") { let nouveau_titre = event.titre
let questionParsee = event.questionParsee data = {nouveau_texte: event.nouveauTexte, nouveau_titre: nouveau_titre}
questionParsee["nom_question"] = event.titre } else if (event.action === "modifier") {
data = { let questionParsee = event.questionParsee
id_contenu: JSON.stringify(this.contenuClique._id), questionParsee["nom_question"] = event.titre
elements_contenu: JSON.stringify(questionParsee) data = {
} id_contenu: JSON.stringify(this.contenuClique._id),
} elements_contenu: JSON.stringify(questionParsee)
// on créée ou on met à jour un contenu en cours }
if (this.contenuCliqueProvenance !== 'en-cours') {
let dataDeux = {
auteur: this.auteur, provenance: this.contenuCliqueProvenance, contenu: JSON.stringify(this.contenuClique), titre: event.titre
} }
let that = this // on créée ou on met à jour un contenu en cours
Service.creerEnCours(dataDeux).then(function (reponse) { if (this.contenuCliqueProvenance !== 'en-cours') {
//console.log(reponse.data) let dataDeux = {
let contenuEC = reponse.data auteur: this.auteur,
contenuEC.provenance = "en-cours" provenance: this.contenuCliqueProvenance,
contenuEC.titre = event.titre contenu: JSON.stringify(this.contenuClique),
that.contenus.push(contenuEC) titre: event.titre
}
let that = this
Service.creerEnCours(dataDeux).then(function (reponse) {
//console.log(reponse.data)
let contenuEC = reponse.data
contenuEC.provenance = "en-cours"
contenuEC.titre = event.titre
that.contenus.push(contenuEC)
if (event.action === "valider") {
Service.changerTexte(data, JSON.stringify(reponse.data._id))
} else if (event.action === "modifier") {
data["id_contenu"] = JSON.stringify(reponse.data._id)
Service.modifierXMLEnCours(data)
}
})
} else {
if (event.action === "valider") { if (event.action === "valider") {
Service.changerTexte(data, JSON.stringify(reponse.data._id))
Service.changerTexte(data, JSON.stringify(this.contenuClique._id))
} else if (event.action === "modifier") { } else if (event.action === "modifier") {
Service.modifierXML(data) Service.modifierXMLEnCours(data)
} }
})
} else {
if (event.action === "valider") {
Service.changerTexte(data, JSON.stringify(this.contenuClique._id)) for (let i = 0; i < this.contenus.length; i++) {
} else if (event.action === "modifier") { if (this.contenus[i]._id === this.contenuClique._id) {
Service.modifierXMLEnCours(data) this.contenus[i].titre = event.titre
} }
for (let i = 0; i < this.contenus.length; i++) {
if (this.contenus[i]._id === this.contenuClique._id) {
this.contenus[i].titre = event.titre
} }
} }
} }
}, },
/** /**
* @vuese * @vuese
......
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