summaryrefslogtreecommitdiffstats
path: root/js/directive
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-06-02 00:49:36 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-06-02 00:49:36 +0200
commit1280da30fcca91fa1a07db70271393d3c4876369 (patch)
tree0e77e4db8123460b9e29b520eddcf09e9da975e1 /js/directive
parentb5e4dd0ee565058c63d3df25fcebf352149e8158 (diff)
reload route if you click the path and the route is the same string
Diffstat (limited to 'js/directive')
-rw-r--r--js/directive/NewsRouteReload.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/directive/NewsRouteReload.js b/js/directive/NewsRouteReload.js
new file mode 100644
index 000000000..01cfa525c
--- /dev/null
+++ b/js/directive/NewsRouteReload.js
@@ -0,0 +1,26 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+app.directive('newsRouteReload', ($location, $route) => {
+ 'use strict';
+
+ return {
+ restrict: 'A',
+ scope: {
+ 'ngHref': '@'
+ },
+ link: (scope, elem, attrs) => {
+ elem.click(() => {
+ if ($location.path() === attrs.ngHref.substring(1)) {
+ $route.reload();
+ }
+ });
+ }
+ };
+}); \ No newline at end of file