[ALOY-1087] baseController in widgets should look for local controller
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Widgets |
| Labels | baseContro, widgets |
| Reporter | Fokke Zandbergen |
| Assignee | Tim Poulsen |
| Created | 2014-06-17T08:46:28.000+0000 |
| Updated | 2016-12-08T14:21:51.000+0000 |
Description
When you try to define a baseController for a widget controller:
exports.baseController = 'foo';
The compiled widget controller will have:
require("alloy/controllers/foo').apply(this, Array.prototype.slice.call(arguments));
Using WPATH('foo') will only make things worse and result in a path like alloy/controllers/my.widget/foo.
Related code:
- https://github.com/appcelerator/alloy/blob/6e5496c545d67a4fe60bd967bda55a06d5807611/Alloy/template/component.js#L18
- https://github.com/appcelerator/alloy/blob/624da7094296bdabd5b9e53201948d6f3dac782d/Alloy/commands/compile/index.js#L584
Maybe at the lines mentioned second we can prefix either alloy/controllers or widgetDir?
template.parentController = (cCode.parentControllerName !== '') ?
(cCode.parentControllerName : "'BaseController'";
Original Reporter: [~fokke]
The workaround is to use a relative path:
the workaround doesn't work with Android SDK 6.0.0 :( I have to use
in my controllers.require("./field").apply($, Array.prototype.slice.call(arguments));