From 017a81ae51dcec11bf8b78ba5154666360147747 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Thu, 19 Feb 2015 09:04:14 +0100 Subject: [PATCH] fix #2172 - horizontal popover with long point names --- app/coffee/modules/common/estimation.coffee | 5 ++++- .../common/estimation/us-estimation-points.jade | 2 +- app/styles/components/popover-points.scss | 10 ++++++++++ app/styles/layout/us-detail.scss | 1 + main-sass.js | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 app/styles/components/popover-points.scss diff --git a/app/coffee/modules/common/estimation.coffee b/app/coffee/modules/common/estimation.coffee index 3b03a587..f8666078 100644 --- a/app/coffee/modules/common/estimation.coffee +++ b/app/coffee/modules/common/estimation.coffee @@ -203,7 +203,10 @@ EstimationsService = ($template, $qqueue, $repo, $confirm, $q) -> point.selected = if @us.points[roleId] == point.id then false else true return point - html = pointsTemplate({"points": points, roleId: roleId}) + maxPointLength = 5 + horizontalList = _.some points, (point) => point.name.length > maxPointLength + + html = pointsTemplate({"points": points, roleId: roleId, horizontal: horizontalList}) # Remove any previous state @$el.find(".popover").popover().close() @$el.find(".pop-points-open").remove() diff --git a/app/partials/common/estimation/us-estimation-points.jade b/app/partials/common/estimation/us-estimation-points.jade index 1fb05d0b..8440a616 100644 --- a/app/partials/common/estimation/us-estimation-points.jade +++ b/app/partials/common/estimation/us-estimation-points.jade @@ -1,4 +1,4 @@ -ul.popover.pop-points-open +ul.popover.pop-points-open(class!="<% if (horizontal) { %>horizontal<% }; %>") <% _.each(points, function(point) { %> li <% if (point.selected) { %> diff --git a/app/styles/components/popover-points.scss b/app/styles/components/popover-points.scss new file mode 100644 index 00000000..63903eee --- /dev/null +++ b/app/styles/components/popover-points.scss @@ -0,0 +1,10 @@ +// This file should contain in future all the common styles for the points popover + +.popover.pop-points-open { + &.horizontal { + li { + white-space: nowrap; + width: 100%; + } + } +} diff --git a/app/styles/layout/us-detail.scss b/app/styles/layout/us-detail.scss index 1ff3c9f1..ae06ec79 100644 --- a/app/styles/layout/us-detail.scss +++ b/app/styles/layout/us-detail.scss @@ -323,6 +323,7 @@ @include popover(200px, $top: 105%, $left: -160px, $arrow-width: 10px, $arrow-top: -5px, $arrow-left: 90%, $arrow-height: 10px); } } + } .duty-data-container { diff --git a/main-sass.js b/main-sass.js index 1f266882..780eb2e7 100644 --- a/main-sass.js +++ b/main-sass.js @@ -56,6 +56,7 @@ exports.files = function () { 'components/beta', 'components/markitup', 'components/markdown-help', + 'components/popover-points', //#################################################