{ "id": "155771", "key": "ALOY-1368", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "17997", "name": "alloy 1.8.3", "archived": false, "released": true, "releaseDate": "2016-03-28" }, { "id": "18001", "name": "Release 5.2.2", "archived": false, "released": true, "releaseDate": "2016-06-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-28T18:11:14.000+0000", "created": "2016-03-16T12:22:48.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "17748", "name": "alloy 1.7.35", "archived": false, "released": true, "releaseDate": "2016-02-29" } ], "issuelinks": [ { "id": "51077", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "155773", "key": "ALOY-1369", "fields": { "summary": "Complex data binding for collection doesn't work with transform", "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": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "51164", "type": { "id": "10011", "name": "Includes", "inward": "is included by", "outward": "includes" }, "inwardIssue": { "id": "159078", "key": "ALOY-1474", "fields": { "summary": "Regression: Model data binding no longer works", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "51076", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "107000", "key": "ALOY-443", "fields": { "summary": "Enable more complex notation in binding", "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": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "updated": "2016-03-31T22:44:06.000+0000", "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" } }, "components": [ { "id": "13605", "name": "Models" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "The complex data binding introduced by ALOY-443 does not work if the model has a {{transform()}} method:\r\n\r\n{code:xml}\r\n\r\n\t\r\n\t\r\n\t\t\r\n\r\n{code}\r\n\r\nCompiles to:\r\n\r\n{code:js}\r\n var __alloyId13 = function() {\r\n $.__alloyId2.title = _.isFunction(Alloy.Models.user.transform) ? Alloy.Models.user.transform()[\"foo\"] : _.template(\"<%=user.foo%>\", {\r\n user: Alloy.Models.user.toJSON()\r\n });\r\n $.__alloyId3.title = _.isFunction(Alloy.Models.user.transform) ? Alloy.Models.user.transform()[\"foo\"] : _.template(\"the <%=user.foo%>\", {\r\n user: Alloy.Models.user.toJSON()\r\n });\r\n $.__alloyId4.title = _.isFunction(Alloy.Models.user.transform) ? Alloy.Models.user.transform()[\"foo\"] : _.template(\"<%=user.foo%> - <%=user.bar%>\", {\r\n user: Alloy.Models.user.toJSON()\r\n });\r\n };\r\n{code}\r\n\r\nSo, if the model has a {{transform()}} method all three labels will only show the value of the foo attribute.\r\n\r\nThe correct code should be:\r\n\r\n{code:js}\r\n var __alloyId13 = function() {\r\n var transformed = _.isFunction(Alloy.Models.user.transform) ? Alloy.Models.user.transform() : Alloy.Models.user.toJSON();\r\n $.__alloyId2.title = _.template(\"<%=user.foo%>\", {\r\n user: transformed\r\n });\r\n $.__alloyId3.title = _.template(\"the <%=user.foo%>\", {\r\n user: transformed\r\n });\r\n $.__alloyId4.title = _.template(\"<%=user.foo%> - <%=user.bar%>\", {\r\n user: transformed\r\n });\r\n };\r\n{code}", "attachment": [], "flagged": false, "summary": "Complex data binding for individual model doesn't work with transform() method", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "Alloy 1.7.35", "closedSprints": [ { "id": 615, "state": "closed", "name": "2016 Sprint 07 Tooling", "startDate": "2016-03-26T00:40:48.770Z", "endDate": "2016-04-09T00:40:00.000Z", "completeDate": "2016-04-11T04:48:57.781Z", "originBoardId": 121 } ], "comment": { "comments": [ { "id": "379862", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "PR: https://github.com/appcelerator/alloy/pull/767", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-16T12:26:56.000+0000", "updated": "2016-03-16T12:26:56.000+0000" }, { "id": "379881", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Updated PR to only call {{transform()}} once.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-16T15:32:24.000+0000", "updated": "2016-03-16T15:32:24.000+0000" }, { "id": "380797", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "New PR to include ALOY-1474:\r\nhttps://github.com/appcelerator/alloy/pull/776", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-28T15:17:38.000+0000", "updated": "2016-03-28T15:17:38.000+0000" }, { "id": "380829", "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": "2016-03-28T18:11:14.000+0000", "updated": "2016-03-28T18:11:14.000+0000" }, { "id": "380909", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Additionally, this also fixed that using strings before the first occurrence of a placeholder caused syntax errors like:\r\n\r\n{code:js}\r\n properties: {\r\n title: typeof __alloyId9.__transform['id'] !== 'undefined' ? __alloyId9.__transform['id'] : id: '+__alloyId9.get('\r\n id ') +',\r\n title: '+__alloyId9.get('\r\n title ') +',\r\n },\r\n{code}", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-03-29T10:09:14.000+0000", "updated": "2016-03-29T10:09:14.000+0000" }, { "id": "381244", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11.4 (15E65)\r\nStudio 4.5.0.201602170821\r\nTi SDK 5.2.2.v20160328141205\r\nAppc NPM 4.2.5-1\r\nAppc CLI 5.2.2-3\r\nAlloy 1.8.5\r\nXcode 7.3 (7D175)\r\n\r\nComplex data binding for models using transform are working as expected. Tested using the project in ALOY-1474 as well as custom apps using a model with a transform function. Code generated matches the form of the correct code in ticket description.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-03-31T22:44:06.000+0000", "updated": "2016-03-31T22:44:06.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }