Titanium JIRA Archive
Alloy (ALOY)

[ALOY-662] Feature Request - "alloy generate controller" custom templates and arguments

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTooling
LabelsAlloy, notable
ReporterDaniel Sefton
AssigneeFeon Sua Xin Miao
Created2013-05-10T22:50:59.000+0000
Updated2015-11-27T02:56:16.000+0000

Description

Problem

It would be awesome to be able to override the default template Alloy generates for a controller/style/view. Currently, whenever you generate a controller, it creates and empty controller, a style.tss with a .container class, and a view. You can edit these files in the alloy directory, but you are stuck with just one template. It would be nice to specify a custom template depending on the controller you are generating. Examples of things that you could include in custom templates would make Ti/Alloy development much faster: - a row-like view with horizontally positioned elements with decent looking classes already applied to them with argument assignment already included. - code to load app libs/modules common in your app - certain classes you like to use/modify often based on the type of view you're creating - certain controller conventions/methods/exports etc that you use commonly in a lot of controllers to aid in window management/control flow/memory management/controller Suggestion would be to have a place in the project to store templates and add to "alloy generate controller someController" another argument to specify "--template someTemplate" In addition, one could conceivably use alloy generate to add custom fields to a template. i.e. alloy generate controller bookRow --template row --elements ImageView:bookImage:arg Label:bookTitle:arg Button:buyButton This would take a preconfigured row xml/tss/js (or you could use the default template) and add an ImageView with id bookImage, a Label with id bookTitle, and a Button with id buyButton. Some sort of flag is passed on bookImage and bookTitle to have stub controller code written to assign the values for this from the args passed to the controller.

Discussions

http://developer.appcelerator.com/question/152233/overriding-alloy-generate

Comments

No comments

JSON Source