Skip to content

Instantly share code, notes, and snippets.

@ericf
Created September 20, 2012 02:58
Show Gist options
  • Select an option

  • Save ericf/3753703 to your computer and use it in GitHub Desktop.

Select an option

Save ericf/3753703 to your computer and use it in GitHub Desktop.
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