Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fully JSON based attachment configuration #38

Closed
sheppard opened this issue Mar 25, 2015 · 2 comments
Closed

fully JSON based attachment configuration #38

sheppard opened this issue Mar 25, 2015 · 2 comments

Comments

@sheppard
Copy link
Member

Move the attachmentTypes configuration from being JavaScript hardcoded in wq/app.js to JSON embedded in the the wq configuration object.

For example,

var attachmentTypes = {
    relationship: {
        'predicate': 'related',
        'type': 'relationshiptype',
        'getTypeFilter': function(page, context) {
            /* jshint unused: false */
            return {'from_type': page};
        },
        'getChoiceList': function(type, context) {
            /* jshint unused: false */
            return type.to_type;
        },
        'getChoiceListFilter': function(type, context) {
            /* jshint unused: false */
            return {};
        },
        'getDefaults': function(type, context) {
            /* jshint unused: false */
            return {
                'type_label': type.name,
                'to_type': type.to_type
            };
        }
    }
};

might become:

{
    "pages": {
        "relationship": {
            "name": "relationship",
            "url": "relationships",
            "list": true,
            "parents": {
                "relationshiptype": [
                    "type"
                ]
            },
            "children": [],

            "attachment": {
                "predicate": "related",
                "type": "relationshiptype",
                "typeFilter": {
                    "from_type": "{{page}}"
                },
                "choiceListPage": "{{type.to_type}}",
                "choiceListFilter": {},
                "getDefaults": {
                    "type_label": "{{type.name}}",
                    "to_type": "{{type.to_type}}",
                }
          }
    }
}
@sheppard sheppard added this to the 1.0 milestone Mar 25, 2015
@sheppard sheppard changed the title fully JSON based attachment configuraiton fully JSON based attachment configuration Mar 25, 2015
@sheppard sheppard mentioned this issue Sep 18, 2015
42 tasks
@sheppard
Copy link
Member Author

Also, the attachmentTypes configuration is redundant with, and should likely replace, the children configuration. (See e.g. 849457c).

sheppard added a commit to wq/wq.db that referenced this issue Mar 3, 2016
 * unifies 'parents', 'children' and 'choices' config options
 * replaces attachment predicates and attachmentTypes config
sheppard added a commit to wq/wq-django-template that referenced this issue Mar 3, 2016
@sheppard
Copy link
Member Author

sheppard commented Mar 3, 2016

This is essentially done. The children, attachmentTypes, parentFilters, parents, and choices configurations have been merged into a single XLSForm-style field list.

sheppard added a commit to wq/wq that referenced this issue Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant