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 {
//this.contenuClique = []
//this.contenuCliqueProvenance = ''
this.$emit("ChangerTitre", {titre: ""})
let data = {}
// on prépare les données suivant le type de contenu ('valider' -> markdown, 'modifier' -> XML moodle)
if (event.action === "valider") {
let nouveau_titre = event.titre
data = {nouveau_texte: event.nouveauTexte, nouveau_titre: nouveau_titre}
} else if (event.action === "modifier") {
let questionParsee = event.questionParsee
questionParsee["nom_question"] = event.titre
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
if (event.action !== 'arriere') {
this.$emit("ChangerTitre", {titre: ""})
let data = {}
// on prépare les données suivant le type de contenu ('valider' -> markdown, 'modifier' -> XML moodle)
if (event.action === "valider") {
let nouveau_titre = event.titre
data = {nouveau_texte: event.nouveauTexte, nouveau_titre: nouveau_titre}
} else if (event.action === "modifier") {
let questionParsee = event.questionParsee
questionParsee["nom_question"] = event.titre
data = {
id_contenu: JSON.stringify(this.contenuClique._id),
elements_contenu: JSON.stringify(questionParsee)
}
}
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)
// 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
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") {
Service.changerTexte(data, JSON.stringify(reponse.data._id))
Service.changerTexte(data, JSON.stringify(this.contenuClique._id))
} else if (event.action === "modifier") {
Service.modifierXML(data)
Service.modifierXMLEnCours(data)
}
})
} else {
if (event.action === "valider") {
Service.changerTexte(data, JSON.stringify(this.contenuClique._id))
} else if (event.action === "modifier") {
Service.modifierXMLEnCours(data)
}
for (let i = 0; i < this.contenus.length; i++) {
if (this.contenus[i]._id === this.contenuClique._id) {
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
......
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