From 086122ca51b7ffba76d5f73c7823c02d5c552d7b Mon Sep 17 00:00:00 2001 From: perryharlock Date: Thu, 3 Oct 2013 15:30:58 +0100 Subject: [PATCH] Issue 43 - Stop graph appearing if only one result --- public/less/site.less | 9 +++++++++ route/task/index.js | 4 +++- view/partial/result-selector.html | 2 +- view/task/index.html | 4 +++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/public/less/site.less b/public/less/site.less index 8debd26..292409f 100644 --- a/public/less/site.less +++ b/public/less/site.less @@ -191,6 +191,7 @@ text-overflow:ellipsis; overflow:hidden; width:100%; + white-space: nowrap; } .task-stats li { padding:7px 0 6px 0; @@ -298,6 +299,14 @@ ul.date-links { .btn-group > .btn { float:none; } + + &.single-result { + margin-top:-55px; + + .show-stats { + display:none; + } + } } /* Graph */ diff --git a/route/task/index.js b/route/task/index.js index 92ce0d6..1539864 100644 --- a/route/task/index.js +++ b/route/task/index.js @@ -18,12 +18,14 @@ function route (app) { if (err) { return next(err); } + var presentedResults = presentResultList(results.map(presentResult)); res.render('task', { task: presentTask(task), - results: presentResultList(results.map(presentResult)), + results: presentedResults, mainResult: task.lastResult || null, added: (typeof req.query.added !== 'undefined'), running: (typeof req.query.running !== 'undefined'), + hasOneResult: (presentedResults.length < 2), isTaskPage: true }); }); diff --git a/view/partial/result-selector.html b/view/partial/result-selector.html index 9b87f19..35ca0eb 100644 --- a/view/partial/result-selector.html +++ b/view/partial/result-selector.html @@ -1,7 +1,7 @@
-
+

Select a date to show stats for

  • diff --git a/view/task/index.html b/view/task/index.html index d2a3c59..b1ebee1 100644 --- a/view/task/index.html +++ b/view/task/index.html @@ -30,7 +30,9 @@ {{#if results}} - {{> graph}} + {{#unless hasOneResult}} + {{> graph}} + {{/unless}} {{> result-selector}}