Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Abstracting Pages to Containers #8

Merged
merged 12 commits into from
Apr 22, 2016
Merged

Abstracting Pages to Containers #8

merged 12 commits into from
Apr 22, 2016

Conversation

idlefingers
Copy link
Contributor

This is a fairly big rewrite, changing the models to be more generic, so we can now use a Container to refer to a Page or Layout. A page belongs to a layout, and a layout has many pages (using STI on containers). When fetching a page, the layout is included in the container. When fetching a layout, you just get the layout.

The resulting json from a page fetch is something like this:

{
  "container": {
    "id": 1,
    "name": "Home",
    "url": "/",
    "revisionId": 1,
    "type": "Ninetails::Page",
    "layout": {
      "container": {
        "name": "GB Layout",
        "revisionId": 2,
        "type": "Ninetails::Layout",
        "sections": [
          {
            "id": 1,
            "type": "Header",
            "elements": {
              "menuItems": [
                {
                  "type": "Button",
                  "reference": "c9dc3fcc-617a-49ef-ae47-032eb43c0422",
                  "link": {
                    "reference": "aaef6097-0f13-4512-b48c-f4dad1b8dc16",
                    "pageId": "1",
                    "title": "",
                    "text": "Service"
                  }
                }
              ]
            }
          },
          {
            "id": 2,
            "name": "",
            "type": "Page",
            "locationName": "body"
          },
          {
            "type": "Footer",
            "elements": {
              "disclaimer": {
                "type": "Text",
                "reference": "c9dc3fcc-617a-49ef-ae47-032ee43c0422",
                "content": {
                  "reference": "ad83809e-2fae-4b0c-95a3-eebfeeeef6ba",
                  "text": "iZettle is an E-money Institution and is under the supervision of the Swedish Financial Supervisory Authority."
                }
              }
            }
          }
        ]
      }
    },
    "sections": [
      {
        "type": "Billboard",
        "locatedIn": "body",
        "elements": {
          "title": {
            "type": "Text",
            "reference": "4be267d2-c02f-4191-9a95-43e1a4b08ce3",
            "content": {
              "reference": "ad83ee9e-2fae-4b0c-a5a3-eebf123ef6ba",
              "text": "Grow your business with iZettle"
            }
          },
          "backgroundImage": {
            "type": "BackgroundImage",
            "reference": "ec1a9292-d7f5-497c-8f55-3a36ee08ddfd",
            "image": {
              "reference": "aaef6097-0f73-4512-b48c-f4d0dbb8dc56",
              "src": "https://cdn.izettle.com/billboards/start/v4/en_GB.jpg",
              "alt": "Billboard image"
            }
          },
          "signupButton": {
            "type": "Button",
            "reference": "1e01ee34-8d2a-4db9-8e4c-124f38aa591c",
            "link": {
              "reference": "aaef60f7-0f73-4512-b48c-f4dadbb8dc56",
              "pageId": "2",
              "title": "Sign up now!",
              "text": "Get a free card reader!"
            }
          }
        }
      }
    ]
  }
}

@marreman thoughts?

@marreman marreman merged commit 84f1f7a into master Apr 22, 2016
@marreman marreman deleted the layout branch April 22, 2016 12:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants