Fixed estimation for user stoy detail

stable
Xavier Julián 2014-09-26 14:17:42 +02:00
parent 093508bb8a
commit ddfbf22066
4 changed files with 24 additions and 13 deletions

View File

@ -200,15 +200,23 @@ $.fn.popover = () ->
docViewTop = $(window).scrollTop() docViewTop = $(window).scrollTop()
docViewBottom = docViewTop + $(window).height() docViewBottom = docViewTop + $(window).height()
docViewWidth = $(window).width()
docViewRight = docViewWidth
docViewLeft = 0
elemTop = $el.offset().top elemTop = $el.offset().top
elemBottom = elemTop + $el.height() elemBottom = elemTop + $el.height()
elemWidth = $el.width()
elemLeft = $el.offset().left
elemRight = $el.offset().left + elemWidth
$el.css({ $el.css({
"display": "none", "display": "none",
"visibility": "visible" "visibility": "visible"
}) })
return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)) return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop) && (elemLeft >= docViewLeft) && (elemRight <= docViewRight))
closePopover = (onClose) => closePopover = (onClose) =>
if onClose then onClose.call($el) if onClose then onClose.call($el)
@ -234,8 +242,7 @@ $.fn.popover = () ->
if !isVisible() if !isVisible()
$el.addClass("fix") $el.addClass("fix")
$el $el.fadeIn () =>
.fadeIn () =>
$el.addClass("active") $el.addClass("active")
$(document.body).off("popover") $(document.body).off("popover")

View File

@ -271,13 +271,14 @@ UsStatusDetailDirective = () ->
updatingSelectedRoleId = null updatingSelectedRoleId = null
$ctrl = $el.controller() $ctrl = $el.controller()
showSelectPoints = (onClose) -> showSelectPoints = (target) ->
us = $model.$modelValue us = $model.$modelValue
$el.find(".pop-points-open").remove() $el.find(".pop-points-open").remove()
$el.find(".points-per-role").append(selectionPointsTemplate({ "points": $scope.project.points })) $el.find(target).append(selectionPointsTemplate({ "points": $scope.project.points }))
target.removeClass('active')
$el.find(".pop-points-open a[data-point-id='#{us.points[updatingSelectedRoleId]}']").addClass("active") $el.find(".pop-points-open a[data-point-id='#{us.points[updatingSelectedRoleId]}']").addClass("active")
# If not showing role selection let's move to the left # If not showing role selection let's move to the left
$el.find(".pop-points-open").popover().open(onClose) $el.find(".pop-points-open").popover().open()
calculateTotalPoints = (us)-> calculateTotalPoints = (us)->
values = _.map(us.points, (v, k) -> $scope.pointsById[v].value) values = _.map(us.points, (v, k) -> $scope.pointsById[v].value)
@ -293,9 +294,9 @@ UsStatusDetailDirective = () ->
status = $scope.statusById[us.status] status = $scope.statusById[us.status]
rolePoints = _.clone(_.filter($scope.project.roles, "computable"), true) rolePoints = _.clone(_.filter($scope.project.roles, "computable"), true)
_.map rolePoints, (v, k) -> _.map rolePoints, (v, k) ->
name = $scope.pointsById[us.points[v.id]].name name = $scope.pointsById[us.points[v.id]].name
name = "?" if not name? name = "?" if not name?
v.points = name v.points = name
totalTasks = $scope.tasks.length totalTasks = $scope.tasks.length
totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length
@ -349,7 +350,8 @@ UsStatusDetailDirective = () ->
updatingSelectedRoleId = target.data("role-id") updatingSelectedRoleId = target.data("role-id")
target.siblings().removeClass('active') target.siblings().removeClass('active')
target.addClass('active') target.addClass('active')
showSelectPoints(() -> target.removeClass('active')) showSelectPoints(target)
$el.on "click", ".point", (event) -> $el.on "click", ".point", (event) ->
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()

View File

@ -195,8 +195,8 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.pop-points-open { .popover {
@include popover(200px, 60px, 40px, '', ''); @include popover(200px, $top: 105%, $left: 35%, $arrow-width: 10px, $arrow-top: -5px, $arrow-left: 10px);
li { li {
display: inline-block; display: inline-block;
width: 23%; width: 23%;
@ -210,6 +210,9 @@
color: $white; color: $white;
} }
} }
&.fix {
@include popover(200px, $top: 105%, $left: -160px, $arrow-width: 10px, $arrow-top: -5px, $arrow-left: 90%);
}
} }
} }

View File

@ -168,7 +168,6 @@
.points-per-role { .points-per-role {
.popover { .popover {
@include popover(200px, $top: 105%, $left: 35%, $arrow-width: 10px, $arrow-top: -5px, $arrow-left: 10px); @include popover(200px, $top: 105%, $left: 35%, $arrow-width: 10px, $arrow-top: -5px, $arrow-left: 10px);
color: orange;
} }
} }
} }