{"action":"created","issue":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/3647","repository_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle","labels_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/3647/labels{/name}","comments_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/3647/comments","events_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/3647/events","html_url":"https://github.com/sonata-project/SonataAdminBundle/pull/3647","id":140429813,"number":3647,"title":"[BC break] Refactors JS to remove inline scripts and centralize association handling.","user":{"login":"ju1ius","id":218404,"avatar_url":"https://avatars.githubusercontent.com/u/218404?v=3","gravatar_id":"","url":"https://api.github.com/users/ju1ius","html_url":"https://github.com/ju1ius","followers_url":"https://api.github.com/users/ju1ius/followers","following_url":"https://api.github.com/users/ju1ius/following{/other_user}","gists_url":"https://api.github.com/users/ju1ius/gists{/gist_id}","starred_url":"https://api.github.com/users/ju1ius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ju1ius/subscriptions","organizations_url":"https://api.github.com/users/ju1ius/orgs","repos_url":"https://api.github.com/users/ju1ius/repos","events_url":"https://api.github.com/users/ju1ius/events{/privacy}","received_events_url":"https://api.github.com/users/ju1ius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/labels/major","name":"major","color":"e11d21"},{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/labels/Needs:%20Changelog%20note","name":"Needs: Changelog note","color":"006b75"},{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/labels/Needs:%20Upgrade%20note","name":"Needs: Upgrade note","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/milestones/6","html_url":"https://github.com/sonata-project/SonataAdminBundle/milestones/4.0","labels_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/milestones/6/labels","id":1742331,"number":6,"title":"4.0","description":null,"creator":{"login":"greg0ire","id":657779,"avatar_url":"https://avatars.githubusercontent.com/u/657779?v=3","gravatar_id":"","url":"https://api.github.com/users/greg0ire","html_url":"https://github.com/greg0ire","followers_url":"https://api.github.com/users/greg0ire/followers","following_url":"https://api.github.com/users/greg0ire/following{/other_user}","gists_url":"https://api.github.com/users/greg0ire/gists{/gist_id}","starred_url":"https://api.github.com/users/greg0ire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greg0ire/subscriptions","organizations_url":"https://api.github.com/users/greg0ire/orgs","repos_url":"https://api.github.com/users/greg0ire/repos","events_url":"https://api.github.com/users/greg0ire/events{/privacy}","received_events_url":"https://api.github.com/users/greg0ire/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":4,"state":"open","created_at":"2016-05-02T12:47:01Z","updated_at":"2016-05-17T05:59:12Z","due_on":null,"closed_at":null},"comments":63,"created_at":"2016-03-13T00:13:20Z","updated_at":"2016-05-18T19:18:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/3647","html_url":"https://github.com/sonata-project/SonataAdminBundle/pull/3647","diff_url":"https://github.com/sonata-project/SonataAdminBundle/pull/3647.diff","patch_url":"https://github.com/sonata-project/SonataAdminBundle/pull/3647.patch"},"body":"Hi ! :facepunch: \r\n\r\n| Q  |  A |\r\n------------ | -------------\r\n| Branch | master |\r\n| Bugfix? | yes |\r\n| New feature? | yes |\r\n| BC breaks | yes |\r\n| Tests pass? |\tyes |\r\n| Fixed tickets | At least: #3646, #3173, #1076, [SonataDoctrineORMAdminBundle/#522](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/522) |\r\n\r\nThis PR is related to, and inseparable from [SonataDoctrineORMAdminBundle#526](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/526).\r\n\r\n## Addressed issues:\r\n\r\n* [SonataDoctrineORMAdminBundle/#522](https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/522): Adds the missing error handling and progress visual feedback to the AJAX requests.\r\n\r\n* #1076: Enhances UX of form validation failures:\r\nWhen errors are detected in a form: \r\n  * All tabs containing errors are clearly marked as such.\r\n  * The first tab containing an error is activated.\r\n  * The page is scrolled to the position of the first invalid field label.\r\n  * The offending field is focused.\r\n\r\n* #3173 Removes **all** inline, twig-entangled obtrusive javascript from the templates in AdminBundle & SonataDoctrineORMAdminBundle. All data is now passed to javascript as JSON in data attributes, and  event delegation is used whenever possible.\r\n\r\n* #3646 Adds PHPUnit assertions properly test Twig's DOM output without relying on it's string representation.\r\n\r\n## New Features\r\n\r\n* Modularize JS & CSS for maintainability (thanks to webpack, babel, postcss).\r\n\r\n* Association CRUD buttons (show/list/edit/create/unlink) are now potentially available to any form type, provided they listen to the right events and handle them correctly. An implementation is currently provided for sonata_type_model, sonata_type_model_list and sonata_type_model_autocomplete. I will also provide an implementation for sonata_type_admin.\r\n\r\n* Display list view's show & delete actions in a modal.\r\n\r\n* Adds Shift+Click batch selection support for the list views\r\n\r\n* Introduces [new, consistently named javascript events](https://github.com/sonata-project/SonataAdminBundle/pull/3647/files#diff-5132598d0fed630b04f7cdace40a0ab0R1) for custom code to hook into.\r\n\r\n* Introduces public JS DOM helpers to interact with the sonata ui elements.\r\n\r\n* Replaces the unmaintained iCheck javascript library by a CSS only implementation.\r\n\r\n* Adds a javascript linting task (eslint)\r\n\r\n* Adds an .editorconfig file\r\n\r\n* Adds two new classes to the body tag, for easier styling by sonata users. The first class is the snake-cased version of the result of calling `Admin::getCode()` (i.e. `sonata_news_admin_post`). The other is the current action name, prefixed with `action_` (i.e. `action_edit`).\r\n\r\n## What's left\r\n\r\n### Mongo/PHPCR/Propel\r\nI still haven't updated the other doctrine admin bundles.\r\nThe main reason is the following:\r\nCurrently the admin bundle delegates to the presistence bundles all the template rendering of the following association form types: `sonata_type_model`, `sonata_type_model_list` and `sonata_type_admin`.\r\n**I strongly question myself about why this is the case at all.**\r\nIMO, it should be part of their contract that these bundles provide view data that is directly consumable by the admin bundle templates.\r\nMaybe we should abstract the mapping type constants (`ClassMetadata::MANY_TO_ONE` et al.) in the ModelManagerInterface ?\r\nHaving this separation of concerns would greatly ease future changes.\r\nMore importantly, it would allow to test the ui, which can't be done atm since the templates and the logic reside in separate bundles.\r\n\r\nThe other reason is that the templates are shared between the `sonata_type_model` and `sonata_type_admin` types, and they seem to contain legacy logic to handle the `['edit' => 'list']` option.\r\nThis option is no longer allowed on any type other than `sonata_type_admin`, and setting it's value to 'list' turns a `sonata_type_admin` form into something that looks like a `sonata_type_model_list`, except broken.\r\n\r\n### Docs\r\nI've made a particular effort to document the code as much as possible, to make future dev & documentation work easier.\r\nWhen (if) this gets merged, I'll be more than happy to make a PR for updating the docs.\r\n\r\nThanks for taking the time to review this."},"comment":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/comments/220130168","html_url":"https://github.com/sonata-project/SonataAdminBundle/pull/3647#issuecomment-220130168","issue_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/3647","id":220130168,"user":{"login":"core23","id":3440437,"avatar_url":"https://avatars.githubusercontent.com/u/3440437?v=3","gravatar_id":"","url":"https://api.github.com/users/core23","html_url":"https://github.com/core23","followers_url":"https://api.github.com/users/core23/followers","following_url":"https://api.github.com/users/core23/following{/other_user}","gists_url":"https://api.github.com/users/core23/gists{/gist_id}","starred_url":"https://api.github.com/users/core23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/core23/subscriptions","organizations_url":"https://api.github.com/users/core23/orgs","repos_url":"https://api.github.com/users/core23/repos","events_url":"https://api.github.com/users/core23/events{/privacy}","received_events_url":"https://api.github.com/users/core23/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T19:18:36Z","updated_at":"2016-05-18T19:18:36Z","body":"Sounds like a good process to shrink this big PR 👍 "}}