MEH-Design / frix

A CMS based on atomic design principles.
MIT License
2 stars 1 forks source link

nested loops not working #61

Closed MiniXC closed 7 years ago

MiniXC commented 7 years ago

I could not pin this down exactly yet, but it seems that nested loops are only working when the first loop element of the outer loop has only one element. example

Both lines are generated.

"lines": [
    {
      "type": "contentline",
      "data": {
        "color": "green",
        "modules": [
          {
            "type": "titledbox",
            "data": {
              "heading": "Einzelberatung",
              "text": "Coaching und Lebensberatung in einem vertraulichen Rahmen.",
              "image": "https://cdn4.iconfinder.com/data/icons/file-extensions-1/64/pdfs-512.png"
            }
          }
        ]
      }
    },
    {
      "type": "contentline",
      "data": {
        "color": "beige",
        "modules": [
          {
            "type": "calltoaction",
            "data": {
              "borderimage": "resources/portrait.jpg",
              "heading": "Herzlich Willkommen!",
              "text": "Meine Angebote sind sehr vielfältig und doch haben sie alle eines gemeinsam - <br><strong>Achtsam mit sich selbst und anderen.</strong>",
              "button": {
                "text": "Mehr über mich erfahren..."
              }
            }
          },
          {
            "type": "review",
            "data": {}
          }
        ]
      }
    }
  ]

Only the first line is generated.

  "lines": [
    {
      "type": "contentline",
      "data": {
        "color": "beige",
        "modules": [
          {
            "type": "calltoaction",
            "data": {
              "borderimage": "resources/portrait.jpg",
              "heading": "Herzlich Willkommen!",
              "text": "Meine Angebote sind sehr vielfältig und doch haben sie alle eines gemeinsam - <br><strong>Achtsam mit sich selbst und anderen.</strong>",
              "button": {
                "text": "Mehr über mich erfahren..."
              }
            }
          },
          {
            "type": "review",
            "data": {}
          }
        ]
      }
    },
    {
      "type": "contentline",
      "data": {
        "color": "green",
        "modules": [
          {
            "type": "titledbox",
            "data": {
              "heading": "Einzelberatung",
              "text": "Coaching und Lebensberatung in einem vertraulichen Rahmen.",
              "image": "https://cdn4.iconfinder.com/data/icons/file-extensions-1/64/pdfs-512.png"
            }
          }
        ]
      }
    }
  ]
MiniXC commented 7 years ago

The upper loop works with more than one element... So maybe this doesn't have to do with loops at all? Maybe the empty data: { } attribute of the review element is the culprit?

MiniXC commented 7 years ago

Update - I just did a bit of troubleshooting and discovered that even with a "proper" data attribute, the issue remains. Edit - If the syntax further below is incorrect (I used an empty string to upset the "/.+/" regex) an error is still thrown. Edit2 - The loop only runs for the first element, definitely, I tested it using a dummy element beside the <target/> element.

MiniXC commented 7 years ago

This is a problem with the specific template, not frix. The iframe seems to consume everything that is placed after it ``¯_(ツ)_/¯```

MiniXC commented 7 years ago

The iframe problem is addressed in #62