{ "id": "130558", "key": "ALOY-1018", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "16692", "name": "Alloy 1.7.0", "archived": false, "released": true, "releaseDate": "2015-07-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-10-30T05:44:53.000+0000", "created": "2014-05-16T17:48:30.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [ { "id": "49621", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "152553", "key": "ALOY-1323", "fields": { "summary": "Alloy: module-tag in Alloy element effects all controller-views", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2015-11-03T21:41:11.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "Alloy currently has a feature of specifying a module attribute against tags, allowing a custom JS module to be used to create the elements, enabling developers to return modified or different elements.\r\n\r\ne.g:\r\n\r\n\r\n\r\nIt's a very powerful feature and means we can create our custom tags for elements that are OS specific e.g. TitleControl and have that return a TitleControl for iOS (no change) or a Ti.UI.View for Android, with custom title text etc.\r\n\r\nIt would be useful to be able to add this namespace / module element ONCE so that you don't have to add it to every / multiple tags in a view.\r\n\r\nSo, adding the ability to specify it in the Alloy tag would mean for every tag instance, the custom module is checked first.\r\n\r\n for example?", "attachment": [], "flagged": false, "summary": "Add defaultNamespace or module attribute to Alloy Tag", "creator": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "environment": null, "closedSprints": [ { "id": 248, "state": "closed", "name": "2014 Sprint 22 Alloy", "startDate": "2014-10-27T13:32:25.636Z", "endDate": "2014-11-10T13:32:00.000Z", "completeDate": "2014-11-10T15:54:03.714Z", "originBoardId": 124 } ], "comment": { "comments": [ { "id": "305328", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "1) You mean {{}} without {{.js}}\r\n2) This would require the compiler to require the module and check if {{create[Tag]}} exists.\r\n3) {{module}} rocks: http://fokkezb.nl/2013/10/21/cross-platform-ui/", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-05-16T18:47:35.000+0000", "updated": "2014-05-16T18:47:35.000+0000" }, { "id": "305334", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "1. Yes of course\r\n2. Yep\r\n3. Good plug.", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2014-05-16T19:24:05.000+0000", "updated": "2014-05-16T19:24:05.000+0000" }, { "id": "316190", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "So, I can implement this. However, since I don't know which of your tags would implement some custom functionality, I have to basically copy the module attribute to every tag. This, naturally breaks the runtime code generated for every tag that your custom function doesn't implement a specific `create` function for. To fix that, I have to implement some pretty inefficient code with lots of duplication. For example, this:\r\n\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\ngenerates this:\r\n\r\n{code}\r\n$.__views.index = require(\"testmod\").createWindow ? require(\"testmod\").createWindow({\r\n backgroundColor: \"#fff\",\r\n fullscreen: false,\r\n exitOnClose: true,\r\n id: \"index\"\r\n}) : Ti.UI.createWindow({\r\n backgroundColor: \"#fff\",\r\n fullscreen: false,\r\n exitOnClose: true,\r\n id: \"index\"\r\n});\r\n{code}\r\n\r\nI'm sure I could optimize this more than I have here. Still, the change is going to make for rather different code generated if you do or don't use the default module attribute. I hesitate to implement such a minor productivity enhancement that comes with the potential for such results. Thoughts? Suggestions?", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-07-29T19:59:01.000+0000", "updated": "2014-07-29T19:59:01.000+0000" }, { "id": "316257", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Or:\r\n\r\n{code}\r\n$.__views.index = (require(\"testmod\").createWindow || Ti.UI.createWindow)({\r\n backgroundColor: \"#fff\",\r\n fullscreen: false,\r\n exitOnClose: true,\r\n id: \"index\"\r\n});\r\n{code}", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-07-30T07:38:43.000+0000", "updated": "2014-07-30T07:38:43.000+0000" }, { "id": "316266", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "like it", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2014-07-30T11:04:41.000+0000", "updated": "2014-07-30T11:04:41.000+0000" }, { "id": "316286", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Right, like I said, I can do some optimization. But is the slowdown of a runtime check for every API call in a controller worth it for the few minutes of developer time saved by not having to specify module=\"foo\" for those couple of components for which you'll be using custom modules for?", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-07-30T13:43:35.000+0000", "updated": "2014-07-30T13:43:35.000+0000" }, { "id": "316288", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "I think treat this like the Dynamic TSS in Alloy - If not used sparingly it can be an overhead. If a developer wants to go this route then it's their choice?\r\n\r\nFor my TabGroup concept, I have to add the attribute to the TabGroup, Tab and Window tags. Wouldn't this have the same overhead as adding it once to the Alloy Tag wrapping the TabGroup?", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2014-07-30T13:48:49.000+0000", "updated": "2014-07-30T13:48:49.000+0000" }, { "id": "316289", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "I'd be interested in seeing it added to run some simple speed tests - see how much it does affect performance.", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2014-07-30T13:50:28.000+0000", "updated": "2014-07-30T13:50:28.000+0000" }, { "id": "316345", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Can you grab from here and do some tests? https://github.com/skypanther/alloy/tree/ALOY-1018 \r\n\r\n(generated code now matches Fokke's comment)", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-07-30T20:05:54.000+0000", "updated": "2014-07-30T20:05:54.000+0000" }, { "id": "316638", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "I'm in France on a beach so if you don't mind [~jasonkneen], please test twice - one for me ;)", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-08-01T13:07:15.000+0000", "updated": "2014-08-01T13:07:15.000+0000" }, { "id": "329565", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "PR https://github.com/appcelerator/alloy/pull/614\r\n\r\nFunctional test: Run the included ALOY\\-1018 test app. You should get an app with a blue-bordered button and a pink-background label which were created with custom tags defined in the testmod module. ", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-10-27T18:51:11.000+0000", "updated": "2014-10-27T18:51:11.000+0000" }, { "id": "330046", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "Additional test note: \r\n1. {color:blue} Blue {color} bordered custom button on iOS\r\n2. {color:green} Green {color} bordered custom button on Android", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-10-30T05:41:12.000+0000", "updated": "2014-10-30T05:41:12.000+0000" }, { "id": "330047", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR merged.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-10-30T05:44:53.000+0000", "updated": "2014-10-30T05:44:53.000+0000" }, { "id": "362553", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Not work for widget children. Work only if set module attribute of Alloy tag.", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-09-08T17:56:28.000+0000", "updated": "2015-09-08T18:06:24.000+0000" }, { "id": "362555", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "Why would you add custom tags in a widget?", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2015-09-08T18:11:48.000+0000", "updated": "2015-09-08T18:11:48.000+0000" }, { "id": "362557", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "@jasonkneen for example:\r\n\r\n{code:xml|title=anyView.xml}\r\n\r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nIn widget lib folder:\r\n{code:javascript|title=tags.js}\r\nfunction RadioGroup() {\r\n\tthis.items = [];\r\n}\r\n\r\nRadioGroup.prototype.add = function(radioItem) {\r\n\tif(!(radioItem instanceof RadioItem)) {\r\n\t\tthrow \"Must contains only Radio tag!\";\r\n\t}\r\n\tthis.items.push(radioItem);\r\n};\r\n\r\nfunction RadioItem(opts) {\r\n\t_.extend(this, _.pick(opts, 'value', 'checked', 'title'));\r\n}\r\n\r\nRadioItem.prototype.add = function() {\r\n\tthrow \"Radio tag cant' contains children!\";\r\n};\r\n\r\n\r\nexports.createGroup = function(opts) {\r\n\treturn new RadioGroup(opts);\r\n};\r\n\r\nexports.createRadio = function(opts) {\r\n\treturn new RadioItem(opts);\r\n};\r\n{code}\r\n\r\nThen use args.children to initialize widget.", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-09-08T18:19:30.000+0000", "updated": "2015-09-08T18:19:30.000+0000" }, { "id": "362559", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "Don't get why you need the widget. Just use the custom tags directly in your app. But I guess you have good reason so good luck!", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2015-09-08T18:28:00.000+0000", "updated": "2015-09-08T18:28:00.000+0000" }, { "id": "362564", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Anyway if I can add tags to the widget why I can't use module for this tags ?", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-09-08T18:43:25.000+0000", "updated": "2015-09-08T18:43:25.000+0000" } ], "maxResults": 18, "total": 18, "startAt": 0 } } }