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

field options seem to not have effect #2

Closed
pauloamgomes opened this issue Jan 10, 2019 · 4 comments
Closed

field options seem to not have effect #2

pauloamgomes opened this issue Jan 10, 2019 · 4 comments

Comments

@pauloamgomes
Copy link

pauloamgomes commented Jan 10, 2019

When defining custom components and using options (e.g. required, default inside a set) they seem to be ignored:

{
  "fields": [
    {
      "name": "autoplay",
      "type": "boolean",
      "label": "Autoplay",
      "options": {"default": true}
    },
    {
      "name": "title",
      "type": "text",
      "label": "Title",
       "options": {"default": "default title"}
    }
  ]
}

Initially was thinking that was an issue on cockpit core but then realized that was working for collection fields (the reason that I opened agentejo/cockpit#965 and then closed - the PR changes make it work)!

Any ideas?

@aheinze
Copy link
Member

aheinze commented Jan 10, 2019

the defaults are set in the collection item view. I have to think about a generic improvement solution

@pauloamgomes
Copy link
Author

Seems solved in Cockpit field layout as per other thread discussion there

@mortensassi
Copy link

Is this fixed? A look at the Response shows that the styles of an image does not get output:

components.js

{
    "custom_image": {
        "label": "Custom Image",
        "dialog": "normal",
        "children": false,
        "fields": [
            {
                "name": "image",
                "label": "Image",
                "type": "asset",
                "default": "",
                "info": "",
                "group": "",
                "localize": false,
                "width": "1-1",
                "lst": true,
                "acl": [],
                "options": {
                    "styles": [
                        "Default",
                        "Placeholder"
                    ]
                }
            }
        ],
        "group": "media"
    }
}

Response

{
          "component": "custom_image",
          "settings": {
            "id": "",
            "class": "",
            "style": "",
            "image": {
              "path": "\/2019\/01\/24\/5c49eeada1071slide5.jpg",
              "title": "slide5.jpg",
              "mime": "image\/jpeg",
              "description": "",
              "tags": [],
              "size": 262747,
              "image": true,
              "video": false,
              "audio": false,
              "archive": false,
              "document": false,
              "code": false,
              "created": 1548349101,
              "modified": 1548351106,
              "_by": "5c49dd3c3361356bf0000243",
              "width": 1600,
              "height": 1069,
              "colors": [
                "#cbcbcb",
                "#272727",
                "#585858",
                "#7a7a7a",
                "#646464"
              ],
              "folder": "",
              "_id": "5c49eeae34366200290003b1"
            }
          }
        }

@pauloamgomes
Copy link
Author

Hey @mortensassi , the original issue was not related with image styles (styles are provided by custom addon), but with passing defaults to custom components fields, e.g.: default value of a textfield, dropdown, etc..

can you kindly open an issue on the image styles addon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants