Skip to content

Commit

Permalink
added callbacks to sideNav open and close
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Jul 24, 2015
1 parent 0946e03 commit 80f6cbc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
13 changes: 7 additions & 6 deletions client/lib/sideNav.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
return invalid
return false;

toggleFlex = (status) ->
toggleFlex = (status, callback = null) ->
return if animating == true
animating = true
if flexNav.opened or status? is -1
flexNav.opened = false
flexNav.addClass "hidden"
setTimeout ->
animating = false
callback?()
, 350
return
if not flexNav.opened or status? is 1
Expand All @@ -60,19 +61,19 @@
, 50
setTimeout ->
animating = false
callback?()
, 500


openFlex = ->
openFlex = (callback = null) ->
return if animating == true
toggleArrow 1
toggleFlex 1
toggleFlex 1, callback
focusInput()

closeFlex = ->
closeFlex = (callback = null) ->
return if animating == true
toggleArrow -1
toggleFlex -1
toggleFlex -1, callback

flexStatus = ->
return flexNav.opened
Expand Down
11 changes: 6 additions & 5 deletions client/views/app/sideNav/createChannelFlex.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ Template.createChannelFlex.events
$('#channel-members').focus()

'click header': (e, instance) ->
SideNav.closeFlex()
SideNav.closeFlex ->
instance.clearForm()

'click .cancel-channel': (e, instance) ->
SideNav.closeFlex()
SideNav.closeFlex ->
instance.clearForm()

'mouseenter header': ->
SideNav.overArrow()
Expand Down Expand Up @@ -90,9 +92,8 @@ Template.createChannelFlex.events
else
return toastr.error err.reason

SideNav.closeFlex()

instance.clearForm()
SideNav.closeFlex ->
instance.clearForm()

FlowRouter.go 'room', { _id: result.rid }
else
Expand Down
8 changes: 4 additions & 4 deletions client/views/app/sideNav/privateGroupsFlex.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ Template.privateGroupsFlex.events
$('#pvt-group-members').focus()

'click .cancel-pvt-group': (e, instance) ->
SideNav.closeFlex()
instance.clearForm()
SideNav.closeFlex ->
instance.clearForm()

'click header': (e, instance) ->
SideNav.closeFlex()
instance.clearForm()
SideNav.closeFlex ->
instance.clearForm()

'mouseenter header': ->
SideNav.overArrow()
Expand Down

0 comments on commit 80f6cbc

Please sign in to comment.