Bladeren bron

ordered items display on wall

Bachir Soussi Chiadmi 4 jaren geleden
bovenliggende
commit
24caaf7bb2
1 gewijzigde bestanden met toevoegingen van 12 en 8 verwijderingen
  1. 12 8
      src/store/modules/project.js

+ 12 - 8
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) => {