juliankrispel / Pollock

A canvas-based application which paints by itself.
2 stars 1 forks source link

Input JSON declaration #19

Open juliankrispel opened 10 years ago

juliankrispel commented 10 years ago

To automate the generation of input interface, or forms, I'd like to implement some sort of JSON declaration. Here's a vague example of a list of form elements.

[
    {
        "name": "Filename",
        "type": "text",
        "placeholder": "file_name",
    },
    {
        "name": "Source Images",
        "type": "images",
        "defaults": [
            "src/image01.jpeg",
            "src/image02.jpeg"
        ]
    },
    {
        "name": "",
        "type": "dropdown",
        "options": [
            {
                "name": "Option 1",
                "value": "1"
            },
            {
                "name": "Option 2",
                "value": "2"
            },
            {
                "name": "Option 3",
                "value": "3"
            }
        ]
    }
]
juliankrispel commented 10 years ago

Ok.

Let's say we have this Json Schema. Then the other parts of this should be templates for each type and a kind of WidgetBuilder that takes the json identifies what templates are needed and puts them onto the page.

juliankrispel commented 10 years ago

the other thing that the WidgetBuilder (that's a really bad name) thing needs to do is to use the publish/subscribe mechanism to glue together the form elements and the model.