{"action":"created","issue":{"url":"https://api.github.com/repos/apostrophecms/apostrophe/issues/1485","repository_url":"https://api.github.com/repos/apostrophecms/apostrophe","labels_url":"https://api.github.com/repos/apostrophecms/apostrophe/issues/1485/labels{/name}","comments_url":"https://api.github.com/repos/apostrophecms/apostrophe/issues/1485/comments","events_url":"https://api.github.com/repos/apostrophecms/apostrophe/issues/1485/events","html_url":"https://github.com/apostrophecms/apostrophe/pull/1485","id":340081774,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNTc5NTk5","number":1485,"title":"Make it possible to set field classes and attributes on form fields","user":{"login":"houmark","id":467330,"node_id":"MDQ6VXNlcjQ2NzMzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/467330?v=4","gravatar_id":"","url":"https://api.github.com/users/houmark","html_url":"https://github.com/houmark","followers_url":"https://api.github.com/users/houmark/followers","following_url":"https://api.github.com/users/houmark/following{/other_user}","gists_url":"https://api.github.com/users/houmark/gists{/gist_id}","starred_url":"https://api.github.com/users/houmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houmark/subscriptions","organizations_url":"https://api.github.com/users/houmark/orgs","repos_url":"https://api.github.com/users/houmark/repos","events_url":"https://api.github.com/users/houmark/events{/privacy}","received_events_url":"https://api.github.com/users/houmark/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-11T03:48:49Z","updated_at":"2018-07-12T09:28:52Z","closed_at":"2018-07-11T12:23:47Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apostrophecms/apostrophe/pulls/1485","html_url":"https://github.com/apostrophecms/apostrophe/pull/1485","diff_url":"https://github.com/apostrophecms/apostrophe/pull/1485.diff","patch_url":"https://github.com/apostrophecms/apostrophe/pull/1485.patch"},"body":"This PR adds the possibity of setting a schema field with the following configuration:\r\n\r\n```\r\nname: 'name',\r\ntype: 'string',\r\nlabel: 'Name',\r\n...\r\nfieldClasses: 'custom-class',\r\nfieldAttributes: 'data-custom-attribute'\r\n```\r\n\r\nCurrently Apostrophe supports adding both `classes` and `attributes` in the same way, but those are added to the `fieldset` which wraps the form field. Some CSS frameworks requires a class put on the field itself (this is related to a submit piece where schema fields are used for a frontend submit).\r\n\r\n**Note:**\r\nThere's a slight annoynce here in naming, as `classes` and `attributes` are already in use for the`fieldset` but for bc compatibility, it's not really possible to use the existing ones for the field and create new ones for the `fieldset` so this is the only way, even if it's not 100% obvious that this is a bit opposite of what one would expect. Maybe this can be \"swapped\" For 3.0, as this seems to be an undocumented feature, it's maybe not much in use yet.\r\n\r\n**Also note:** I also did a small cleanup of how `disabled` is added to the element. Before it would always add a space inside the html tag, even if the field was not disabled, it will now only add the spacing if `disabled` is set. I've seen this behavior many places in the core, and I think this should be gradually cleaned up for a more \"clean\" html output."},"comment":{"url":"https://api.github.com/repos/apostrophecms/apostrophe/issues/comments/404450498","html_url":"https://github.com/apostrophecms/apostrophe/pull/1485#issuecomment-404450498","issue_url":"https://api.github.com/repos/apostrophecms/apostrophe/issues/1485","id":404450498,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDQ1MDQ5OA==","user":{"login":"houmark","id":467330,"node_id":"MDQ6VXNlcjQ2NzMzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/467330?v=4","gravatar_id":"","url":"https://api.github.com/users/houmark","html_url":"https://github.com/houmark","followers_url":"https://api.github.com/users/houmark/followers","following_url":"https://api.github.com/users/houmark/following{/other_user}","gists_url":"https://api.github.com/users/houmark/gists{/gist_id}","starred_url":"https://api.github.com/users/houmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houmark/subscriptions","organizations_url":"https://api.github.com/users/houmark/orgs","repos_url":"https://api.github.com/users/houmark/repos","events_url":"https://api.github.com/users/houmark/events{/privacy}","received_events_url":"https://api.github.com/users/houmark/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T09:28:52Z","updated_at":"2018-07-12T09:28:52Z","author_association":"CONTRIBUTOR","body":"Yes, I thought about that also, considering I did that kind of work recently for the body tag attributes. There's some inconsistency in the core here both on naming and also arguments to functions, but I guess a later cleanup could take of that. For 3.0 it could be interesting to do a deprecation approach where wrapper functions are set to accept the old behavior but warns about the correct use, and then in 4.0 for example, the code is removed to only accept the new way.\r\n\r\nI will put the documentation on my list :) "}}
{"actor":{"display_login":"houmark"}}