travis-web/assets/scripts/app/views/application.coffee
Piotr Sarnacki e6800c80c6 Refactor our layout handling
Layout handling in travis-web was implemented in a dynamic way, so we
could change a main layout from any of the routes. This needed a
`rerender` call which was making things harder and needed some hacks. It
also broke a few transitions when upgrading to 1.8.1.

After examining our usage of layouts I've noticed that we don't need to
change the entire layout dynamically and instead we can set layout on
root routes (like "index", "profile" and other root routes).
2014-12-29 18:16:14 +01:00

17 lines
779 B
CoffeeScript

Travis.reopen
ApplicationView: Travis.View.extend
click: (event) ->
# TODO: this solves the case of closing menus and popups,
# but I would like to rewrite it later, not sure how
# yet, but this does not seem optimal
targetAndParents = $(event.target).parents().andSelf()
if ! ( targetAndParents.hasClass('open-popup') || targetAndParents.hasClass('popup') )
@popupCloseAll()
# TODO: I needed to add second check to this conditional, because for some reason
# event.stopPropagation() in menu() function in RepoShowToolsView does
# not prevent calling following code
if ! targetAndParents.hasClass('menu') && !targetAndParents.is('#tools > a')
$('.menu').removeClass('display')