From 598f6a02fbfafa0b002ade8c81ee5e7c2984ac45 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 10 Dec 2015 12:12:42 +0100 Subject: [PATCH] Don't show default branch in inactive branches --- app/controllers/branches.coffee | 7 ++++--- app/templates/branches.hbs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/branches.coffee b/app/controllers/branches.coffee index 5d977e86..e2b73697 100644 --- a/app/controllers/branches.coffee +++ b/app/controllers/branches.coffee @@ -7,15 +7,16 @@ BranchesController = Ember.Controller.extend defaultBranch: (-> repos = @get('model') output = repos.filter (item, index) -> - item if item.default_branch == true + item.default_branch if output.length output[0] ).property('model') activeBranches: (-> repos = @get('model') + console.log repos repos = repos.filter (item, index) -> - item if item.exists_on_github == true && item.default_branch == false + item.exists_on_github && !item.default_branch .sortBy('last_build.finished_at') .reverse() ).property('model') @@ -23,7 +24,7 @@ BranchesController = Ember.Controller.extend inactiveBranches: (-> repos = @get('model') repos = repos.filter (item, index) -> - item if item.exists_on_github == false + !item.exists_on_github && !item.default_branch .sortBy('last_build.finished_at') .reverse() ).property('model') diff --git a/app/templates/branches.hbs b/app/templates/branches.hbs index ebbe5f7e..f94b7b78 100644 --- a/app/templates/branches.hbs +++ b/app/templates/branches.hbs @@ -6,7 +6,7 @@ - {{#if activeBranches}} + {{#if activeBranches.length}}

Active Branches

{{/if}} - {{#if inactiveBranches}} + {{#if inactiveBranches.length}}

Inactive Branches