summaryrefslogtreecommitdiffstats
path: root/coffee
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-02-12 15:24:15 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-02-12 15:25:11 +0100
commita658eac21f9b2131750f9253ca2a608454d355f4 (patch)
tree5738b542e03da4831a3ac50468fc9c2be2d62531 /coffee
parente904f00e2002d12d7e5b7b9632e964ce2825e498 (diff)
also slide down other elements that have the click slide handler and listeners on focus lost when an element wit this directive is clicked
Diffstat (limited to 'coffee')
-rw-r--r--coffee/directives/clickslidetoggle.coffee15
-rw-r--r--coffee/lib/services/notification.coffee0
2 files changed, 12 insertions, 3 deletions
diff --git a/coffee/directives/clickslidetoggle.coffee b/coffee/directives/clickslidetoggle.coffee
index f9399e352..51bf76bd2 100644
--- a/coffee/directives/clickslidetoggle.coffee
+++ b/coffee/directives/clickslidetoggle.coffee
@@ -18,7 +18,8 @@ Used to slide up an area and can be customized by passing an expression.
If selector is defined, a different area is slid up on click
If hideOnFocusLost is defined, the slid up area will hide when the focus is lost
###
-angular.module('News').directive 'clickSlideToggle', ->
+angular.module('News').directive 'clickSlideToggle',
+['$rootScope', ($rootScope) ->
return (scope, elm, attr) ->
options = scope.$eval(attr.clickSlideToggle)
@@ -36,11 +37,19 @@ angular.module('News').directive 'clickSlideToggle', ->
if angular.isDefined(options.hideOnFocusLost) and options.hideOnFocusLost
$(document.body).click ->
- if slideArea.is(':visible') and not slideArea.is(':animated')
- slideArea.slideUp()
+ $rootScope.$broadcast 'lostFocus'
+
+ $rootScope.$on 'lostFocus', (scope, params) ->
+ if params != slideArea
+ if slideArea.is(':visible') and not slideArea.is(':animated')
+ slideArea.slideUp()
slideArea.click (e) ->
+ $rootScope.$broadcast 'lostFocus', slideArea
e.stopPropagation()
elm.click (e) ->
+ $rootScope.$broadcast 'lostFocus', slideArea
e.stopPropagation()
+
+] \ No newline at end of file
diff --git a/coffee/lib/services/notification.coffee b/coffee/lib/services/notification.coffee
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/coffee/lib/services/notification.coffee