{"action":"created","issue":{"url":"https://api.github.com/repos/superdesk/web-renderer/issues/37","labels_url":"https://api.github.com/repos/superdesk/web-renderer/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/superdesk/web-renderer/issues/37/comments","events_url":"https://api.github.com/repos/superdesk/web-renderer/issues/37/events","html_url":"https://github.com/superdesk/web-renderer/issues/37","id":117144431,"number":37,"title":"[WIP] [Proposal] Template containers system","user":{"login":"ahilles107","id":298610,"avatar_url":"https://avatars.githubusercontent.com/u/298610?v=3","gravatar_id":"","url":"https://api.github.com/users/ahilles107","html_url":"https://github.com/ahilles107","followers_url":"https://api.github.com/users/ahilles107/followers","following_url":"https://api.github.com/users/ahilles107/following{/other_user}","gists_url":"https://api.github.com/users/ahilles107/gists{/gist_id}","starred_url":"https://api.github.com/users/ahilles107/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahilles107/subscriptions","organizations_url":"https://api.github.com/users/ahilles107/orgs","repos_url":"https://api.github.com/users/ahilles107/repos","events_url":"https://api.github.com/users/ahilles107/events{/privacy}","received_events_url":"https://api.github.com/users/ahilles107/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/superdesk/web-renderer/labels/proposal","name":"proposal","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-16T15:07:09Z","updated_at":"2015-11-18T14:11:33Z","closed_at":null,"body":"Container - special twig block in templates witch can contain widgets (or default content). Container have his representation in database and provides api to change it - so it can be modified without changes in template file. Container is registered on first render or theme scanning. \r\n\r\nExample code in template:\r\n```twig \r\n{{ container 'container_name' { \r\n    'width': 400, \r\n    'height': 500, \r\n    'styles': 'border: solid 1px red', \r\n    'class': 'css_class_name', \r\n    'data': {'custom-key': value}\r\n}}}\r\nHere is default content - if there is no widgets attached to container. \r\n{{ endcontainer }}\r\n```\r\nit would render smth like that\r\n```html\r\n<div id=\"container_id\" class=\"css_class_name\" style=\"width: 400px; height: 500px; border: solid 1px red\" data-custom-key=\"value\">\r\nHere is default content - if there is no widgets attached to container. \r\n</div>\r\n```\r\nContainer Entity:\r\n```yml \r\nSWP\\TemplateEngineBundle\\Model\\Container:\r\n    type: entity\r\n    table: null\r\n    repositoryClass: SWP\\TemplateEngineBundle\\Repository\\ContainerRepository\r\n    id:\r\n        id:\r\n            type: integer\r\n            id: true\r\n            generator:\r\n                strategy: AUTO\r\n    fields:\r\n        name:\r\n            type: string\r\n            length: 255\r\n        type:\r\n            type: integer\r\n        width:\r\n            type: integer\r\n        height:\r\n            type: integer\r\n        styles:\r\n            type: text\r\n        class:\r\n            type: string\r\n            length: 255\r\n        visible:\r\n            type: boolean\r\n    oneToMany:\r\n        data:\r\n            targetEntity: SWP\\TemplateEngineBundle\\Model\\ContainerData\r\n            mappedBy: container\r\n```\r\nContainer Data Entity:\r\n```yml \r\nSWP\\TemplateEngineBundle\\Model\\ContainerData:\r\n    type: entity\r\n    table: null\r\n    repositoryClass: SWP\\TemplateEngineBundle\\Repository\\ContainerDataRepository\r\n    id:\r\n        id:\r\n            type: integer\r\n            id: true\r\n            generator:\r\n                strategy: AUTO\r\n    fields:\r\n        key:\r\n            type: string\r\n            length: 255\r\n        value:\r\n            type: string\r\n            length: 255\r\n    manyToOne:\r\n        container:\r\n            targetEntity: SWP\\TemplateEngineBundle\\Model\\Container\r\n            joinColumn:\r\n                name: container_id\r\n                referencedColumnName: id\r\n```\r\n\r\nContainer object (used by twig)\r\n\r\n```php\r\n\r\n<?php\r\n\r\nnamespace SWP\\TemplateEngine\\Container;\r\n\r\nclass Container\r\n{\r\n   private $containerModel;\r\n\r\n   /**\r\n    * Renders container (div) with all parameters from $containerModel object, \r\n    * also foreach on all widgets in Container and renders them\r\n    */\r\n    private function render(){};\r\n}\r\n```\r\nWe need provide REST API to control containers\r\n\r\nMethod | Endpoint | Description\r\n------------ | ------------- | ----------------\r\n|POST  | /api/container/{id} | update container |\r\n|GET |  /api/container/{id} | get container |\r\n|LINK/UNLINK |  /api/container/{id}/widget | link unlink widgets to container |"},"comment":{"url":"https://api.github.com/repos/superdesk/web-renderer/issues/comments/157724402","html_url":"https://github.com/superdesk/web-renderer/issues/37#issuecomment-157724402","issue_url":"https://api.github.com/repos/superdesk/web-renderer/issues/37","id":157724402,"user":{"login":"m038","id":164319,"avatar_url":"https://avatars.githubusercontent.com/u/164319?v=3","gravatar_id":"","url":"https://api.github.com/users/m038","html_url":"https://github.com/m038","followers_url":"https://api.github.com/users/m038/followers","following_url":"https://api.github.com/users/m038/following{/other_user}","gists_url":"https://api.github.com/users/m038/gists{/gist_id}","starred_url":"https://api.github.com/users/m038/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m038/subscriptions","organizations_url":"https://api.github.com/users/m038/orgs","repos_url":"https://api.github.com/users/m038/repos","events_url":"https://api.github.com/users/m038/events{/privacy}","received_events_url":"https://api.github.com/users/m038/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T14:11:33Z","updated_at":"2015-11-18T14:11:33Z","body":"How is a widget linked to the container?"}}