diff --git a/js/gamutable.js b/js/gamutable.js
index 3703aa8..3c2a9cc 100644
--- a/js/gamutable.js
+++ b/js/gamutable.js
@@ -211,15 +211,26 @@ var monTableau = {
triProps: [],
selectTr: [],
champ_search: 'html',
- chargement: true
+ chargement: true,
+ vuebloc: ''
};
},
mounted: function mounted() {
+ var _this = this;
+
this.chargerJson();
+ var url = 'spip.php?page=vuebloc';
+ fetch(url).then(function (response) {
+ return response.text();
+ }).then(function (data) {
+ if (data) {
+ _this.vuebloc = data;
+ }
+ });
},
computed: {
tableau: function tableau() {
- var _this = this;
+ var _this2 = this;
this.setPages();
@@ -228,7 +239,7 @@ var monTableau = {
}
return this.pagination(this.table.filter(function (ligne) {
- return Object.values(ligne[_this.champ_search]).toString().toLowerCase().indexOf(_this.search.toLowerCase()) < 0 ? false : true;
+ return Object.values(ligne[_this2.champ_search]).toString().toLowerCase().indexOf(_this2.search.toLowerCase()) < 0 ? false : true;
}));
}
},
@@ -252,7 +263,7 @@ var monTableau = {
},
methods: {
chargerJson: function chargerJson(id) {
- var _this2 = this;
+ var _this3 = this;
var url = this.apiuri;
@@ -288,32 +299,32 @@ var monTableau = {
return response.json();
}).then(function (data) {
var config = data.shift();
- _this2.header = config.header;
+ _this3.header = config.header;
if (config.crayons !== undefined) {
- _this2.crayons = config.crayons;
+ _this3.crayons = config.crayons;
}
if (config.classes !== undefined) {
- _this2.classes = config.classes;
+ _this3.classes = config.classes;
}
if (parseInt(id) > 0) {
- var i = _this2.table.findIndex(function (ligne) {
+ var i = _this3.table.findIndex(function (ligne) {
return ligne.html.id === parseInt(id);
});
- Vue.set(_this2.table, i, data[0]);
+ Vue.set(_this3.table, i, data[0]);
} else {
- _this2.table = data;
+ _this3.table = data;
if (data[0] && data[0].search) {
- _this2.champ_search = 'search';
+ _this3.champ_search = 'search';
}
}
Vue.nextTick(function () {
- _this2.chargement = false;
+ _this3.chargement = false;
console.timeEnd('Chargement de VueJs APRES Ajax');
});
}).catch(function (error) {
@@ -378,7 +389,7 @@ var monTableau = {
}
},
exportCSV: function exportCSV() {
- var _this3 = this;
+ var _this4 = this;
var $csv = [];
var $header = [];
@@ -388,16 +399,26 @@ var monTableau = {
});
$tableau = this.tableau.reduce(function (acc, ligne) {
var $uneLigne = [];
- Object.values(ligne[_this3.champcsv]).forEach(function (l) {
+ Object.values(ligne[_this4.champcsv]).forEach(function (l) {
return $uneLigne.push(l);
});
return [].concat(_toConsumableArray(acc), [[].concat($uneLigne)]);
}, []);
$csv = [[].concat($header)].concat(_toConsumableArray($tableau));
exporterCSV($csv, this.delimitercsv, this.namecsv);
+ },
+ replaceBloc: function replaceBloc(ligne) {
+ var html = this.vuebloc;
+ console.log(ligne);
+ Object.keys(ligne).forEach(function (key) {
+ html = html.replace("@@".concat(key, "@@"), ligne[key]);
+ }); //console.log(html);
+ //console.log('coucou');
+
+ return html;
}
},
- template: "\n\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tMise \xE0 jour de la base de donn\xE9e\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tBase de donn\xE9es synchronis\xE9e\n\t\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tMise \xE0 jour de la base de donn\xE9e\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tBase de donn\xE9es synchronis\xE9e\n\t\t\t\n\t\t