Created
September 20, 2012 02:58
-
-
Save ericf/3753703 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Y.PullsList = Y.Base.create('pullsList', Y.ModelList, [], { | |
| sync: function (action, options, callback) { | |
| var url = 'https://api.github.com/repos/yui/yui3/pulls?callback={callback}'; | |
| Y.jsonp(url, function (res) { | |
| var meta = res.meta, | |
| data = res.data; | |
| if (meta.status >= 200 && meta.status < 300) { | |
| callback(null, res); | |
| } else { | |
| callback(data.message, res); | |
| } | |
| }); | |
| }, | |
| parse: function (res) { | |
| return res.data.map(function (pull) { | |
| return { | |
| id : pull.number, | |
| url : pull.html_url, | |
| title : pull.title, | |
| assignee: pull.assignee && pull.assignee.login | |
| }; | |
| }); | |
| }, | |
| unassigned: function () { | |
| return this.filter({asList: true}, function (pull) { | |
| return !pull.get('assignee'); | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment