Improved scrolling behaviour if article id is given in url.
This commit is contained in:
parent
bff5dbb370
commit
5ed7359d60
|
@ -203,9 +203,22 @@ class App.TicketZoom extends App.Controller
|
||||||
# set all notifications to seen
|
# set all notifications to seen
|
||||||
App.OnlineNotification.seen('Ticket', @ticket_id)
|
App.OnlineNotification.seen('Ticket', @ticket_id)
|
||||||
|
|
||||||
|
scrollToPosition = (position, delay) =>
|
||||||
|
scrollToDelay = =>
|
||||||
|
if position is 'article'
|
||||||
|
@scrollToArticle(@last_article_id)
|
||||||
|
return
|
||||||
|
@scrollToBottom()
|
||||||
|
@delay(scrollToDelay, delay, 'scrollToPosition')
|
||||||
|
|
||||||
|
# scroll to article if given
|
||||||
|
if params.article_id && params.article_id isnt @last_article_id
|
||||||
|
@last_article_id = params.article_id
|
||||||
|
scrollToPosition('article', 300)
|
||||||
|
|
||||||
# if controller is executed twice, go to latest article (e. g. click on notification)
|
# if controller is executed twice, go to latest article (e. g. click on notification)
|
||||||
if @activeState
|
if @activeState
|
||||||
@scrollToBottom()
|
scrollToPosition('bottom', 300)
|
||||||
return
|
return
|
||||||
@activeState = true
|
@activeState = true
|
||||||
|
|
||||||
|
@ -217,7 +230,7 @@ class App.TicketZoom extends App.Controller
|
||||||
App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id })
|
App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id })
|
||||||
|
|
||||||
# scroll to end of page
|
# scroll to end of page
|
||||||
@scrollToBottom()
|
scrollToPosition('bottom', 100)
|
||||||
|
|
||||||
@positionPageHeaderStart()
|
@positionPageHeaderStart()
|
||||||
@autosaveStart()
|
@autosaveStart()
|
||||||
|
@ -434,7 +447,8 @@ class App.TicketZoom extends App.Controller
|
||||||
if @shown
|
if @shown
|
||||||
|
|
||||||
# scroll to article if given
|
# scroll to article if given
|
||||||
if @article_id
|
if @article_id && @article_id isnt @last_article_id
|
||||||
|
@last_article_id = @article_id
|
||||||
scrollTo = =>
|
scrollTo = =>
|
||||||
@scrollToArticle(@article_id)
|
@scrollToArticle(@article_id)
|
||||||
@delay(scrollTo, 300)
|
@delay(scrollTo, 300)
|
||||||
|
|
Loading…
Reference in a new issue