fix regression when going below the log zone

Since a431b68c28, when going below the max
of the log files, the position button would remain in fixed position.
This fixes it.
This commit is contained in:
Damien Mathieu 2013-12-13 17:01:02 +01:00
parent 10d49c6983
commit 1920785f50
3 changed files with 22 additions and 2 deletions

View File

@ -51,8 +51,13 @@ class @Travis.Tailing
return if @tail().length is 0
offset = @window.scrollTop() - @log().offset().top
max = @log().height() - @tail().height() + 5
offset = max if offset > max
if offset > 0
if offset > 0 && offset <= max
@tail().removeClass('bottom')
@tail().addClass('scrolling')
else
if offset > max
@tail().addClass('bottom')
else
@tail().removeClass('bottom')
@tail().removeClass('scrolling')

View File

@ -71,8 +71,19 @@ test 'positionButton adds the scrolling class', ->
tail.positionButton()
equal(element.hasClass('scrolling'), true)
equal(element.hasClass('bottom'), false)
test 'positionButton removes the scrolling class', ->
log.offset = -> {top: 1}
tail.positionButton()
equal(element.hasClass('scrolling'), false)
equal(element.hasClass('bottom'), false)
test 'positionButton sets the button as bottom', ->
log.offset = -> {top: -100}
log.height = -> 50
tail.height = -> 1
tail.positionButton()
equal(element.hasClass('scrolling'), false)
equal(element.hasClass('bottom'), true)

View File

@ -121,6 +121,10 @@ pre#log
position: fixed
right: 32px
&.bottom
bottom: 45px
top: inherit
.status
display: inline-block
margin-right: 1px