From b0df09fb22f129b520c975c00b7c702370427f6c Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 15 Jan 2016 15:43:29 +0100 Subject: [PATCH] Fix displaying no-builds message with an index view --- app/controllers/repo.js | 4 ++++ app/routes/repo/index.js | 6 +----- app/templates/builds/not-found.hbs | 1 - app/templates/repo.hbs | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 app/templates/builds/not-found.hbs diff --git a/app/controllers/repo.js b/app/controllers/repo.js index 2e03d10c..6208278b 100644 --- a/app/controllers/repo.js +++ b/app/controllers/repo.js @@ -27,6 +27,10 @@ export default Ember.Controller.extend({ return statusImage(this.get('repo.slug')); }.property('repo.slug'), + showCurrentBuild: function() { + return this.get('repo.lastBuildId') && this.get('repo.active'); + }.property('repo.lastBuildId', 'repo.active'), + actions: { statusImages() { this.get('popup').open('status-images'); diff --git a/app/routes/repo/index.js b/app/routes/repo/index.js index 2fc1fbd2..3ae29393 100644 --- a/app/routes/repo/index.js +++ b/app/routes/repo/index.js @@ -8,11 +8,7 @@ export default TravisRoute.extend({ }, renderTemplate() { - if (this.modelFor('repo').get('lastBuildId')) { - return this.render('build'); - } else { - return this.render('builds/not_found'); - } + return this.render('build'); }, deactivate() { var repo; diff --git a/app/templates/builds/not-found.hbs b/app/templates/builds/not-found.hbs deleted file mode 100644 index bd2b8add..00000000 --- a/app/templates/builds/not-found.hbs +++ /dev/null @@ -1 +0,0 @@ -{{no-builds}} \ No newline at end of file diff --git a/app/templates/repo.hbs b/app/templates/repo.hbs index f92280cc..4190b84a 100644 --- a/app/templates/repo.hbs +++ b/app/templates/repo.hbs @@ -23,13 +23,13 @@ {{repo-show-tabs repo=repo tab=tab build=build job=job}}
- {{#if repo.active}} + {{#if showCurrentBuild}} {{outlet}} {{else}} {{#if repo.lastBuildId}} - {{outlet}} - {{else}} {{not-active user=currentUser repo=repo}} + {{else}} + {{no-builds}} {{/if}} {{/if}}