Fixes #3445: Admin sidebar scrolls up on click on translations menu
This commit is contained in:
parent
fc61d799d5
commit
7ea27276b7
1 changed files with 10 additions and 5 deletions
|
@ -5,6 +5,7 @@ class Translation extends App.ControllerSubContent
|
|||
'click .js-pushChanges': 'pushChanges'
|
||||
'click .js-resetChanges': 'resetChanges'
|
||||
'click .js-syncChanges': 'syncChanges'
|
||||
initialRenderingDone: false
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
@ -38,6 +39,7 @@ class Translation extends App.ControllerSubContent
|
|||
url: "#{@apiPath}/translations/admin/lang/#{@locale}"
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
@initialRenderingDone = true
|
||||
@times = []
|
||||
@stringsNotTranslated = []
|
||||
@stringsTranslated = []
|
||||
|
@ -50,6 +52,8 @@ class Translation extends App.ControllerSubContent
|
|||
else
|
||||
@stringsTranslated.push item
|
||||
|
||||
@untranslatedAtLastRender = $.extend({}, App.i18n.getNotTranslated(@locale))
|
||||
|
||||
if !@translationToDo || event is 'render'
|
||||
@translationToDo = new TranslationToDo(
|
||||
el: @$('.js-ToDo')
|
||||
|
@ -80,12 +84,13 @@ class Translation extends App.ControllerSubContent
|
|||
)
|
||||
|
||||
show: =>
|
||||
# see https://github.com/zammad/zammad/issues/2056
|
||||
@untranslatedAtLastRender ||= $.extend({}, App.i18n.getNotTranslated(@locale))
|
||||
return if _.isEqual(@untranslatedAtLastRender, App.i18n.getNotTranslated(@locale))
|
||||
return if @initialRenderingDone is false
|
||||
|
||||
@untranslatedAtLastRender = $.extend({}, App.i18n.getNotTranslated(@locale))
|
||||
App.Event.trigger('ui:rerender')
|
||||
# see https://github.com/zammad/zammad/issues/2056
|
||||
return if _.isEmpty(App.i18n.getNotTranslated(@locale))
|
||||
return if @untranslatedAtLastRender && _.isEqual(@untranslatedAtLastRender, App.i18n.getNotTranslated(@locale))
|
||||
|
||||
@render()
|
||||
|
||||
hide: =>
|
||||
@rerender()
|
||||
|
|
Loading…
Reference in a new issue