summaryrefslogtreecommitdiffstats
path: root/coffee/lib/directives/forwardclick.coffee
blob: b887a1de44e237eca6e6893ac116efa93af1589f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
###
# ownCloud
#
# @author Bernhard Posselt
# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
#
# This file is licensed under the Affero General Public License version 3 or
# later.
#
# See the COPYING-README file
#
###

###
Used to forward clicks to another element via jquery selector

The expression which can be passed looks like this {selector:'#opml-upload'}
###

angular.module('OC').directive 'forwardClick', ->

	return (scope, elm, attr) ->
		options = scope.$eval(attr.forwardClick)

		if angular.isDefined(options.selector)
			elm.click ->
				$(options.selector).trigger('click')