Fix show more button and simplify builds controller

This commit is contained in:
Piotr Sarnacki 2016-01-13 11:25:27 +01:00
parent 13d2eba016
commit 271b8f89ea

View File

@ -12,38 +12,22 @@ export default Ember.Controller.extend({
showMore() { showMore() {
var id, number, type; var id, number, type;
id = this.get('repo.id'); id = this.get('repo.id');
number = this.get('lastObject.number'); number = this.get('model.lastObject.number');
type = this.get('tab') === "builds" ? 'push' : 'pull_request'; type = this.get('tab') === "model" ? 'push' : 'pull_request';
return this.get('model').load(this.olderThanNumber(id, number, type)); return this.get('model').load(this.olderThanNumber(id, number, type));
}, },
displayShowMoreButton: function() { displayShowMoreButton: function() {
return this.get('tab') !== 'branches' && parseInt(this.get('lastObject.number')) > 1; return this.get('tab') !== 'branches' && parseInt(this.get('model.lastObject.number')) > 1;
}.property('tab', 'lastObject.number'), }.property('tab', 'model.lastObject.number'),
displayPullRequests: function() { displayPullRequests: function() {
if (this.get('tab') === 'pull_requests') { return this.get('tab') === 'pull_requests';
if (Ember.isEmpty(this.get('repo.pullRequests.content'))) { }.property('tab'),
return true;
} else {
return false;
}
} else {
return false;
}
}.property('tab', 'repo.builds', 'repo.pullRequests'),
displayBranches: function() { displayBranches: function() {
if (this.get('tab') === 'branches') { return this.get('tab') === 'branches';
if (Ember.isEmpty(this.get('repo.branches.content.content'))) { }.property('tab'),
return true;
} else {
return false;
}
} else {
return false;
}
}.property('tab', 'repo.builds', 'repo.branches'),
noticeData: function() { noticeData: function() {
return { return {