{"action":"created","issue":{"url":"https://api.github.com/repos/responsiv/uploader-plugin/issues/47","repository_url":"https://api.github.com/repos/responsiv/uploader-plugin","labels_url":"https://api.github.com/repos/responsiv/uploader-plugin/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/responsiv/uploader-plugin/issues/47/comments","events_url":"https://api.github.com/repos/responsiv/uploader-plugin/issues/47/events","html_url":"https://github.com/responsiv/uploader-plugin/issues/47","id":298104570,"number":47,"title":"Question: When Using imageUploader inside of custom component, scripts are not appended to page","user":{"login":"oscarnevarezleal","id":129272,"avatar_url":"https://avatars1.githubusercontent.com/u/129272?v=4","gravatar_id":"","url":"https://api.github.com/users/oscarnevarezleal","html_url":"https://github.com/oscarnevarezleal","followers_url":"https://api.github.com/users/oscarnevarezleal/followers","following_url":"https://api.github.com/users/oscarnevarezleal/following{/other_user}","gists_url":"https://api.github.com/users/oscarnevarezleal/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarnevarezleal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarnevarezleal/subscriptions","organizations_url":"https://api.github.com/users/oscarnevarezleal/orgs","repos_url":"https://api.github.com/users/oscarnevarezleal/repos","events_url":"https://api.github.com/users/oscarnevarezleal/events{/privacy}","received_events_url":"https://api.github.com/users/oscarnevarezleal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-18T18:05:21Z","updated_at":"2018-03-09T17:08:35Z","closed_at":null,"author_association":"NONE","body":"Uploaders Scripts are not added unless I manually call OnRun from a component reference.\r\nIs this the right thing to do or I´m missing something.\r\n\r\n```\r\n<?php namespace Namespace\\Core\\Components;\r\n\r\nuse Cms\\Classes\\ComponentBase;\r\nuse NetSTI\\Uploader\\Components\\ImageUploader;\r\nuse RainLab\\User\\Facades\\Auth;\r\nuse RainLab\\User\\Models\\User;\r\n\r\n/**\r\n * @property  user\r\n * @property  imageUploader\r\n * this component is aliased as 'profile_photos'\r\n */\r\nclass ProfilePhotoUploader extends ComponentBase\r\n{\r\n    private $imageUploader;\r\n\r\n    public function componentDetails()\r\n    {\r\n        return [\r\n            'name' => 'ProfilePhotoUploader Component',\r\n            'description' => 'No description provided yet...'\r\n        ];\r\n    }\r\n\r\n    /**\r\n     * Returns the logged in user, if available\r\n     */\r\n    public function user()\r\n    {\r\n        if (!Auth::check()) {\r\n            return null;\r\n        }\r\n\r\n        return Auth::getUser();\r\n    }\r\n\r\n    /**\r\n     *\r\n     */\r\n    public function onRun()\r\n    {\r\n        $this->prepareVars();\r\n        $this->imageUploader->onRun(); // without this, scripts are not added\r\n    }\r\n\r\n    /**\r\n     * Executed when this component is initialized\r\n     */\r\n    public function prepareVars()\r\n    {\r\n        $user = $this->user();\r\n\r\n        if ($user) {\r\n\r\n            /** @var ImageUploader $imageUploader */\r\n            $this->imageUploader = $this->addComponent(\r\n                'NetSTI\\Uploader\\Components\\ImageUploader',\r\n                'imageUploader',\r\n                ['modelClass' => 'RainLab\\User\\Models\\User', 'modelKeyColumn' => 'avatar', 'deferredBinding' => true]\r\n            );\r\n\r\n            $this->imageUploader->bindModel('avatar', $user);\r\n            $this->page['user_profile'] = $user;\r\n        }\r\n    }\r\n\r\n    public function defineProperties()\r\n    {\r\n        return [\r\n\r\n        ];\r\n    }\r\n}\r\n\r\n```\r\n\r\n```\r\ntitle = \"Account\"\r\nurl = \"/account\"\r\nlayout = \"default\"\r\n\r\n[session]\r\nsecurity = \"user\"\r\nredirect = \"home\"\r\n\r\n[profile_photos]\r\n==\r\n\r\n{% component 'profile_photos' %}\r\n\r\nCurrent user is {{ user.name }}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/responsiv/uploader-plugin/issues/comments/371876979","html_url":"https://github.com/responsiv/uploader-plugin/issues/47#issuecomment-371876979","issue_url":"https://api.github.com/repos/responsiv/uploader-plugin/issues/47","id":371876979,"user":{"login":"oscarnevarezleal","id":129272,"avatar_url":"https://avatars1.githubusercontent.com/u/129272?v=4","gravatar_id":"","url":"https://api.github.com/users/oscarnevarezleal","html_url":"https://github.com/oscarnevarezleal","followers_url":"https://api.github.com/users/oscarnevarezleal/followers","following_url":"https://api.github.com/users/oscarnevarezleal/following{/other_user}","gists_url":"https://api.github.com/users/oscarnevarezleal/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarnevarezleal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarnevarezleal/subscriptions","organizations_url":"https://api.github.com/users/oscarnevarezleal/orgs","repos_url":"https://api.github.com/users/oscarnevarezleal/repos","events_url":"https://api.github.com/users/oscarnevarezleal/events{/privacy}","received_events_url":"https://api.github.com/users/oscarnevarezleal/received_events","type":"User","site_admin":false},"created_at":"2018-03-09T17:08:35Z","updated_at":"2018-03-09T17:08:35Z","author_association":"NONE","body":"Hi @rajakhoury that make the trick.\r\nThanks 👍 "}}
{"actor":{"display_login":"oscarnevarezleal"}}