summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-02-12 03:07:28 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-02-12 03:07:28 +0100
commit17902de40c7db3228219e673e7c05419bb12d4a4 (patch)
treec821b0f04458b43a969c73ea70d255ca20a82fa6
parent399007f6b70470e29a0f29ea0920b54c0db222f0 (diff)
forward import click to hidden file input
-rw-r--r--coffee/directives/forwardclick.coffee29
-rw-r--r--js/app.js35
-rw-r--r--templates/part.settings.php2
3 files changed, 65 insertions, 1 deletions
diff --git a/coffee/directives/forwardclick.coffee b/coffee/directives/forwardclick.coffee
new file mode 100644
index 000000000..bd4108901
--- /dev/null
+++ b/coffee/directives/forwardclick.coffee
@@ -0,0 +1,29 @@
+###
+# ownCloud news app
+#
+# @author Alessandro Cosentino
+# @author Bernhard Posselt
+# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
+# 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('News').directive 'forwardClick', ->
+
+ return (scope, elm, attr) ->
+ options = scope.$eval(attr.forwardClick)
+
+ if angular.isDefined(options.selector)
+ elm.click ->
+ $(options.selector).trigger('click')
diff --git a/js/app.js b/js/app.js
index 796ffcf97..ce8f161c7 100644
--- a/js/app.js
+++ b/js/app.js
@@ -2391,6 +2391,41 @@
/*
+ Used to forward clicks to another element via jquery selector
+
+ The expression which can be passed looks like this {selector:'#opml-upload'}
+ */
+
+
+ angular.module('News').directive('forwardClick', function() {
+ return function(scope, elm, attr) {
+ var options;
+ options = scope.$eval(attr.forwardClick);
+ if (angular.isDefined(options.selector)) {
+ return elm.click(function() {
+ return $(options.selector).trigger('click');
+ });
+ }
+ };
+ });
+
+ /*
+ # ownCloud news app
+ #
+ # @author Alessandro Cosentino
+ # @author Bernhard Posselt
+ # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com>
+ # 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
+ #
+ */
+
+
+ /*
# This is used to signal the settings bar that the app has been focused and that
# it should hide
*/
diff --git a/templates/part.settings.php b/templates/part.settings.php
index 99d870cce..5dac1f05a 100644
--- a/templates/part.settings.php
+++ b/templates/part.settings.php
@@ -1,7 +1,7 @@
<fieldset class="personalblock">
<legend><strong><?php p($l->t('Import / Export OPML')); ?></strong></legend>
<input type="file" id="opml-upload" name="files[]" read-file/>
- <button title="<?php p($l->t('Import')); ?>" trigger-click>
+ <button title="<?php p($l->t('Import')); ?>" forward-click="{selector:'#opml-upload'}">
<?php p($l->t('Import')); ?>
</button>
<a class="button"