{"action":"created","issue":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/issues/39","repository_url":"https://api.github.com/repos/ckeditor/ckeditor5-ui","labels_url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/issues/39/comments","events_url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/issues/39/events","html_url":"https://github.com/ckeditor/ckeditor5-ui/pull/39","id":158093847,"number":39,"title":"T/3: An utility to extend existing templates","user":{"login":"oleq","id":1099479,"avatar_url":"https://avatars.githubusercontent.com/u/1099479?v=3","gravatar_id":"","url":"https://api.github.com/users/oleq","html_url":"https://github.com/oleq","followers_url":"https://api.github.com/users/oleq/followers","following_url":"https://api.github.com/users/oleq/following{/other_user}","gists_url":"https://api.github.com/users/oleq/gists{/gist_id}","starred_url":"https://api.github.com/users/oleq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleq/subscriptions","organizations_url":"https://api.github.com/users/oleq/orgs","repos_url":"https://api.github.com/users/oleq/repos","events_url":"https://api.github.com/users/oleq/events{/privacy}","received_events_url":"https://api.github.com/users/oleq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-06-02T09:14:01Z","updated_at":"2016-06-02T11:07:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/pulls/39","html_url":"https://github.com/ckeditor/ckeditor5-ui/pull/39","diff_url":"https://github.com/ckeditor/ckeditor5-ui/pull/39.diff","patch_url":"https://github.com/ckeditor/ckeditor5-ui/pull/39.patch"},"body":"Closes #3. \r\n\r\nNote: It requires changes in each View of the project to align template definitions to the new API first."},"comment":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/issues/comments/223261471","html_url":"https://github.com/ckeditor/ckeditor5-ui/pull/39#issuecomment-223261471","issue_url":"https://api.github.com/repos/ckeditor/ckeditor5-ui/issues/39","id":223261471,"user":{"login":"oleq","id":1099479,"avatar_url":"https://avatars.githubusercontent.com/u/1099479?v=3","gravatar_id":"","url":"https://api.github.com/users/oleq","html_url":"https://github.com/oleq","followers_url":"https://api.github.com/users/oleq/followers","following_url":"https://api.github.com/users/oleq/following{/other_user}","gists_url":"https://api.github.com/users/oleq/gists{/gist_id}","starred_url":"https://api.github.com/users/oleq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleq/subscriptions","organizations_url":"https://api.github.com/users/oleq/orgs","repos_url":"https://api.github.com/users/oleq/repos","events_url":"https://api.github.com/users/oleq/events{/privacy}","received_events_url":"https://api.github.com/users/oleq/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T11:07:38Z","updated_at":"2016-06-02T11:07:38Z","body":"```js\r\n// Parent class\r\nthis.template = new Template( {\r\n\ttag: 'p',\r\n\tchildren: [\r\n\t\t{\r\n\t\t\ttag: 'span',\r\n\t\t\tattributes: {\r\n\t\t\t\tclass: 'foo'\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n} );\r\n\r\n// -> <p><span class=\"foo\"></span></p>\r\n\r\n// Class which inherits parent\r\nthis.template.extend( {\r\n\tchildren: [\r\n\t\t{\r\n\t\t\tattributes: {\r\n\t\t\t\tclass: 'bar'\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n} );\r\n\r\n// -> <p><span class=\"foo bar\"></span></p>\r\n\r\n// Parent class gets upgraded to...\r\nthis.template = new Template( {\r\n\ttag: 'p',\r\n\tchildren: [\r\n\t\t{\r\n\t\t\ttag: 'b',\r\n\t\t\tchildren: [ 'Surprise' ]\r\n\t\t},\r\n\t\t{\r\n\t\t\ttag: 'span',\r\n\t\t\tattributes: {\r\n\t\t\t\tclass: 'foo'\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n} );\r\n\r\n// so the class which inherits extends <b> instead of <span>...\r\nthis.template.extend( {\r\n\tchildren: [\r\n\t\t{\r\n\t\t\tattributes: {\r\n\t\t\t\tclass: 'bar'\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n} );\r\n\r\n// -> <p><b class=\"bar\">Surprise</b><span class=\"foo\"></span></p>\r\n\r\n// -------------------------------------------------------------------\r\n\r\n// But the same would happen if extension was index-based...\r\nthis.template.children[ 0 ].extend( {\r\n\tattributes: {\r\n\t\tclass: 'bar'\r\n\t}\r\n} );\r\n\r\n// because `this.template.children[ 0 ]` points to <b> now.\r\n```"}}
{"actor":{"display_login":"oleq"}}