From efde5d7b6fd2147ff516ce031ecd61754f15466a Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 13 Mar 2015 13:39:14 +0100 Subject: [PATCH] Don't show toTop or tailing buttons if there's no log --- app/templates/jobs/pre.hbs | 25 ++++++++++++++----------- app/views/pre.coffee | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/templates/jobs/pre.hbs b/app/templates/jobs/pre.hbs index e969488b..e60f99c4 100644 --- a/app/templates/jobs/pre.hbs +++ b/app/templates/jobs/pre.hbs @@ -12,19 +12,22 @@ Download Log
- - - - {{#if view.job.isFinished}} - Scroll to End of Log - {{else}} - Follow Log - {{/if}} - - + {{#if view.showTailing}} + + + + {{#if view.job.isFinished}} + Scroll to End of Log + {{else}} + Follow Log + {{/if}} + + + {{/if}} +

 
-      {{#if view.log.hasContent}}
+      {{#if view.showToTop}}
         Top
       {{/if}}
 
diff --git a/app/views/pre.coffee b/app/views/pre.coffee
index 89f475d5..67ffeea2 100644
--- a/app/views/pre.coffee
+++ b/app/views/pre.coffee
@@ -111,6 +111,11 @@ View = BasicView.extend
       job.get('canRemoveLog') && @get('hasPermission')
   ).property('job.canRemoveLog', 'hasPermission')
 
+  showToTop: (->
+    @get('log.hasContent') && @get('job.canRemoveLog')
+  ).property('log.hasContent', 'job.canRemoveLog')
+  showTailing: Ember.computed.alias('showToTop')
+
   actions:
     toTop: () ->
       Travis.tailing.stop()