Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1087] baseController in widgets should look for local controller

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsWidgets
LabelsbaseContro, widgets
ReporterFokke Zandbergen
AssigneeTim Poulsen
Created2014-06-17T08:46:28.000+0000
Updated2016-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'";

Comments

  1. Mauro Parra-Miranda 2014-07-15

    Original Reporter: [~fokke]
  2. Fokke Zandbergen 2014-11-10

    The workaround is to use a relative path:
       exports.baseController = '../widgets/theWidgetYouWantToExtend/controllers/widget';
       
  3. Sergey Nosenko 2016-12-08

    the workaround doesn't work with Android SDK 6.0.0 :( I have to use
    require("./field").apply($, Array.prototype.slice.call(arguments));
    in my controllers.

JSON Source