Last active
April 2, 2018 20:49
-
-
Save spbrien/0b33b45935fb908e5662a3d4700649d5 to your computer and use it in GitHub Desktop.
Mir Page Schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = { | |
"schema": { | |
"slug": { | |
"type": "string", | |
"regex": "^[a-z0-9]+(?:-[a-z0-9]+)*$", | |
"required": True, | |
"unique": True, | |
"minlength": 0, | |
"maxlength": 400, | |
"_metadata": { | |
"order": 1, | |
"help": "May only contain alpha-numeric characters and dashes", | |
"label": "Page Slug", | |
"field": "slug" | |
} | |
}, | |
"title": { | |
"type": "string", | |
"required": True, | |
"minlength": 0, | |
"maxlength": 400, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Page Title", | |
"field": "string" | |
} | |
}, | |
"published": { | |
"type": "boolean", | |
"_metadata": { | |
"order": 3, | |
"help": "Should this item appear publicly as a published item?", | |
"label": "Published", | |
"field": "checkbox" | |
} | |
}, | |
"featured_image": { | |
"type": ["objectid", "string"], | |
"data_relation": { | |
"resource": "sitemedia", | |
"field": "_id", | |
"embeddable": True | |
}, | |
"nullable": True, | |
"_metadata": { | |
"order": 4, | |
"help": "", | |
"label": "Featured Image", | |
"field": "imagefield" | |
} | |
}, | |
"page_content": { | |
"type": "list", | |
"nullable": True, | |
"schema": { | |
"type": "dict", | |
"anyof": [ | |
{ | |
"schema": { | |
"hero_title": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Hero Title", | |
"field": "string" | |
} | |
}, | |
"hero_subtitle": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Hero Subtitle", | |
"field": "string" | |
} | |
}, | |
"hero_image": { | |
"type": ["objectid", "string"], | |
"data_relation": { | |
"resource": "sitemedia", | |
"field": "_id", | |
"embeddable": True | |
}, | |
"nullable": True, | |
"_metadata": { | |
"order": 3, | |
"help": "", | |
"label": "Hero Image", | |
"field": "imagefield" | |
} | |
}, | |
"template": { | |
"type": "string", | |
"default": "hero", | |
} | |
}, | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Hero Section", | |
"field": "dict" | |
} | |
}, | |
{ | |
"schema": { | |
"section_title": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Title", | |
"field": "string" | |
} | |
}, | |
"section_content": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Content", | |
"field": "richtext" | |
} | |
}, | |
"cta": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 3, | |
"help": "", | |
"label": "CTA Text", | |
"field": "string" | |
} | |
}, | |
"cta_url": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 4, | |
"help": "", | |
"label": "CTA URL", | |
"field": "string" | |
} | |
}, | |
"template": { | |
"type": "string", | |
"default": "single_column", | |
} | |
}, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Single Column Section", | |
"field": "dict" | |
} | |
}, | |
{ | |
"schema": { | |
"section_title": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Section Title", | |
"field": "string" | |
} | |
}, | |
"section_content": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Section Intro", | |
"field": "richtext" | |
} | |
}, | |
"columns": { | |
"type": "list", | |
"schema": { | |
"type": "dict", | |
"schema": { | |
"column_title": { | |
"type": "string", | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Column Title", | |
"field": "string" | |
} | |
}, | |
"column_content": { | |
"type": "string", | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Column Content", | |
"field": "richtext" | |
} | |
}, | |
"cta": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 3, | |
"help": "", | |
"label": "CTA Text", | |
"field": "string" | |
} | |
}, | |
"cta_url": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 4, | |
"help": "", | |
"label": "CTA URL", | |
"field": "string" | |
} | |
} | |
}, | |
"_metadata": { | |
"field": "dict" | |
} | |
}, | |
"_metadata": { | |
"order": 3, | |
"help": "help", | |
"label": "Columns", | |
"field": "list" | |
} | |
}, | |
"template": { | |
"type": "string", | |
"default": "multiple_columns", | |
} | |
}, | |
"_metadata": { | |
"order": 3, | |
"help": "", | |
"label": "Multiple Column Section", | |
"field": "dict" | |
} | |
}, | |
{ | |
"schema": { | |
"image": { | |
"type": ["objectid", "string"], | |
"data_relation": { | |
"resource": "sitemedia", | |
"field": "_id", | |
"embeddable": True | |
}, | |
"nullable": True, | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Image", | |
"field": "imagefield" | |
} | |
}, | |
"cta_url": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "CTA URL", | |
"field": "string" | |
} | |
}, | |
"template": { | |
"type": "string", | |
"default": "full_width_image", | |
} | |
}, | |
"_metadata": { | |
"order": 4, | |
"help": "Full width image", | |
"label": "Image Section", | |
"field": "dict" | |
} | |
}, | |
{ | |
"schema": { | |
"title": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Hero Title", | |
"field": "string" | |
} | |
}, | |
"content": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 2, | |
"help": "", | |
"label": "Hero Subtitle", | |
"field": "richtext" | |
} | |
}, | |
"image": { | |
"type": ["objectid", "string"], | |
"data_relation": { | |
"resource": "sitemedia", | |
"field": "_id", | |
"embeddable": True | |
}, | |
"nullable": True, | |
"_metadata": { | |
"order": 3, | |
"help": "", | |
"label": "Image", | |
"field": "imagefield" | |
} | |
}, | |
"image_position": { | |
"type": "string", | |
"allowed": ["left", "right"], | |
"_metadata": { | |
"order": 4, | |
"help": "", | |
"label": "Image Position", | |
"field": "dropdown", | |
"choices": ["left", "right"] | |
} | |
}, | |
"cta_url": { | |
"type": "string", | |
"nullable": True, | |
"_metadata": { | |
"order": 5, | |
"help": "", | |
"label": "CTA URL", | |
"field": "string" | |
} | |
}, | |
"template": { | |
"type": "string", | |
"default": "two_column_image", | |
} | |
}, | |
"_metadata": { | |
"order": 5, | |
"help": "", | |
"label": "Two Column Image Section", | |
"field": "dict" | |
} | |
}, | |
], | |
"_metadata": { | |
"order": 1, | |
"help": "", | |
"label": "Page Section", | |
"field": "flexible_content" | |
} | |
}, | |
"_metadata": { | |
"order": 5, | |
"help": "help", | |
"label": "Flexible Page Sections", | |
"field": "list" | |
} | |
} | |
}, | |
"additional_lookup": { | |
"url": "regex('[\\w-]+')", | |
"field": "slug" | |
}, | |
"datasource": { | |
"default_sort": [("_created", -1)] | |
}, | |
"embedded_fields": ['featured_image'] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment