Fix sorting on builds list

This commit is contained in:
Piotr Sarnacki 2016-01-14 15:40:06 +01:00
parent 557797ab19
commit c70ed06848
2 changed files with 8 additions and 8 deletions

View File

@ -1,8 +1,8 @@
import Ember from 'ember';
export default Ember.Controller.extend({
sortAscending: false,
sortProperties: ['number'],
buildsSorting: ['number:desc'],
builds: Ember.computed.sort('model', 'buildsSorting'),
repoController: Ember.inject.controller('repo'),
repoBinding: 'repoController.repo',
tabBinding: 'repoController.tab',
@ -12,14 +12,14 @@ export default Ember.Controller.extend({
showMore() {
var id, number, type;
id = this.get('repo.id');
number = this.get('model.lastObject.number');
number = this.get('builds.lastObject.number');
type = this.get('tab') === "builds" ? 'push' : 'pull_request';
return this.get('model').load(this.olderThanNumber(id, number, type));
return this.get('builds').load(this.olderThanNumber(id, number, type));
},
displayShowMoreButton: function() {
return this.get('tab') !== 'branches' && parseInt(this.get('model.lastObject.number')) > 1;
}.property('tab', 'model.lastObject.number'),
return this.get('tab') !== 'branches' && parseInt(this.get('builds.lastObject.number')) > 1;
}.property('tab', 'builds.lastObject.number'),
displayPullRequests: function() {
return this.get('tab') === 'pull_requests';

View File

@ -1,7 +1,7 @@
{{#builds-wrapper contentType=contentType repo=repo}}
{{#if model.isLoaded}}
{{#if isLoaded}}
<ul class="build-list">
{{#each model as |build|}}
{{#each builds as |build|}}
{{builds-item build=build}}
{{else}}
{{no-builds repo=noticeData isPR=displayPullRequests isBranch=displayBranches}}