Fixed issue with target.toggleClass('is-hovered') if in the meantime the navigation bar is re-rendered and .is-hovered git lost.

This commit is contained in:
Martin Edenhofer 2016-10-15 01:02:20 +02:00
parent f64c13e13f
commit 1167a4575e

View file

@ -12,6 +12,7 @@ class App.FirstStepsClues extends App.Controller
container: '.search-holder' container: '.search-holder'
headline: 'Search' headline: 'Search'
text: 'Here you can search for ticket, customers and organizations. Use the wildcard §*§ to find everything. E. g. §smi*§ or §rosent*l§. You also can use ||double quotes|| for searching phrases §"some phrase"§.' text: 'Here you can search for ticket, customers and organizations. Use the wildcard §*§ to find everything. E. g. §smi*§ or §rosent*l§. You also can use ||double quotes|| for searching phrases §"some phrase"§.'
actions: []
} }
{ {
container: '.user-menu' container: '.user-menu'
@ -53,9 +54,6 @@ class App.FirstStepsClues extends App.Controller
constructor: (params) -> constructor: (params) ->
# disable active navbar elements
$('.main-navigation .active').removeClass('active')
$('#app').append('<div class="js-modal--clue"></div>') $('#app').append('<div class="js-modal--clue"></div>')
params.el = $('#app .js-modal--clue') params.el = $('#app .js-modal--clue')
@ -108,12 +106,12 @@ class App.FirstStepsClues extends App.Controller
cleanUp: (callback) -> cleanUp: (callback) ->
@hideWindow => @hideWindow =>
clue = @clues[@position] clue = @clues[@position]
container = $(clue.container) container = $("#app #{clue.container}")
container.removeClass('selected-clue') container.removeClass('selected-clue')
# undo click perform by doing it again # undo click perform by doing it again
if clue.actions if clue.actions
@perform clue.actions, container @perform clue.actions, container, 'cleanup'
if callback if callback
callback() callback()
@ -130,11 +128,11 @@ class App.FirstStepsClues extends App.Controller
showClue: => showClue: =>
clue = @clues[@position] clue = @clues[@position]
container = $(clue.container) container = $("#app #{clue.container}")
container.addClass('selected-clue') container.addClass('selected-clue')
if clue.actions if clue.actions
@perform clue.actions, container @perform clue.actions, container, 'show'
# calculate bounding box after actions # calculate bounding box after actions
# to take toggled child nodes into account # to take toggled child nodes into account
@ -309,7 +307,7 @@ class App.FirstStepsClues extends App.Controller
dimensions dimensions
perform: (actions, container) -> perform: (actions, container, type) ->
for action in actions for action in actions
if action.indexOf(' ') < 0 if action.indexOf(' ') < 0
# 'click' # 'click'
@ -321,5 +319,14 @@ class App.FirstStepsClues extends App.Controller
target = container.find( action.substr action.indexOf(' ') + 1 ) target = container.find( action.substr action.indexOf(' ') + 1 )
switch eventName switch eventName
when 'click' then target.trigger('click') when 'click'
when 'hover' then target.toggleClass('is-hovered') target.trigger('click')
when 'hover'
# disable active navbar elements
$('#app .navigation .is-active').removeClass('is-active')
if type is 'show'
target.addClass('is-hovered')
else
target.removeClass('is-hovered')