From 24caaf7bb214c568fe1c1d05e122f7449518ae64 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Tue, 20 Oct 2020 16:45:37 +0200 Subject: [PATCH] ordered items display on wall --- src/store/modules/project.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/store/modules/project.js b/src/store/modules/project.js index 15d7ea0..e09be0d 100644 --- a/src/store/modules/project.js +++ b/src/store/modules/project.js @@ -249,8 +249,8 @@ export default { // create level if not exists if (!grid[t]) { grid[t] = [] - // skip the first level's row as we will display wall title - continue + // // skip the first level's row as we will display wall title + // continue } // create cols for each rows for (var l = cols - 1; l >= 0; l--) { // cols @@ -519,7 +519,10 @@ export default { return GRAPHQL.post('', { query: `query { project(id: "${state.id}") { - visibles(where: { Published: "true" }){ + visibles( + where: {Published: "true"}, + sort: "Weight:desc" + ){ id Name Media { @@ -534,6 +537,7 @@ export default { id Name } + Weight } contexts(where: { Published: "true" }){ id @@ -580,8 +584,8 @@ export default { }, computeContents ({ dispatch, commit, state }, contents) { console.log('computeContents') - return Promise.all(Object.keys(contents).map(function (key) { - return Promise.all(contents[key].map(function (content) { + return Promise.all(Object.keys(contents).map(function (level) { + return Promise.all(contents[level].map(function (content) { if (content.Vimeo) { // console.log('Vimeo', content.Vimeo) // GET https://vimeo.com/api/oembed.json?url=https%3A//vimeo.com/286898202&width=480&height=360 @@ -605,10 +609,10 @@ export default { return content } })).then((cts) => { - // return an object with the right key (visible, etc, ...) - // console.log(`${key} cts`, cts) + // return an object with the right level (visible, etc, ...) + // console.log(`${level} cts`, cts) let o = {} - o[key] = cts + o[level] = cts return o }) })).then((a) => {