summaryrefslogtreecommitdiffstats
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
parentb5e4dd0ee565058c63d3df25fcebf352149e8158 (diff)
reload route if you click the path and the route is the same string
-rw-r--r--js/build/app.js18
-rw-r--r--js/directive/NewsRouteReload.js26
-rw-r--r--templates/part.feed.starred.php2
-rw-r--r--templates/part.feed.unread.php4
-rw-r--r--templates/part.listfeed.php3
-rw-r--r--templates/part.listfolder.php9
6 files changed, 54 insertions, 8 deletions
diff --git a/js/build/app.js b/js/build/app.js
index 81b92d4d0..31214d632 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -1635,6 +1635,24 @@ var $__build_47_app__ = function () {
});
};
});
+ app.directive('newsRouteReload', [
+ '$location',
+ '$route',
+ function ($location, $route) {
+ 'use strict';
+ return {
+ restrict: 'A',
+ scope: { 'ngHref': '@' },
+ link: function (scope, elem, attrs) {
+ elem.click(function () {
+ if ($location.path() === attrs.ngHref.substring(1)) {
+ $route.reload();
+ }
+ });
+ }
+ };
+ }
+ ]);
app.directive('newsScroll', [
'$timeout',
function ($timeout) {
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
diff --git a/templates/part.feed.starred.php b/templates/part.feed.starred.php
index 48e3eda8a..69eae6e78 100644
--- a/templates/part.feed.starred.php
+++ b/templates/part.feed.starred.php
@@ -3,7 +3,7 @@
unread: Navigation.getStarredCount() > 0
}"
class="starred">
- <a class="starred-icon" href="#/items/starred">
+ <a class="starred-icon" ng-href="#/items/starred" news-route-reload>
<?php p($l->t('Starred')) ?>
</a>
<span class="utils">
diff --git a/templates/part.feed.unread.php b/templates/part.feed.unread.php
index f3375cef0..d55eb258e 100644
--- a/templates/part.feed.unread.php
+++ b/templates/part.feed.unread.php
@@ -3,11 +3,11 @@
unread: Navigation.getUnreadCount() > 0
}">
- <a class="rss-icon" href="#/items" ng-if="!Navigation.isShowAll()">
+ <a class="rss-icon" ng-href="#/items" news-route-reload ng-if="!Navigation.isShowAll()">
<?php p($l->t('Unread articles'))?>
</a>
- <a class="rss-icon" href="#/items" ng-if="Navigation.isShowAll()">
+ <a class="rss-icon" ng-href="#/items" news-route-reload ng-if="Navigation.isShowAll()">
<?php p($l->t('All articles'))?>
</a>
diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php
index 16084da7c..6aecd720e 100644
--- a/templates/part.listfeed.php
+++ b/templates/part.listfeed.php
@@ -37,7 +37,8 @@
'problem-icon': feed.error
}"
ng-hide="feed.editing"
- href="#/items/feeds/{{ feed.id }}"
+ ng-href="#/items/feeds/{{ feed.id }}"
+ news-route-reload
class="title"
title="{{ feed.title }}">
diff --git a/templates/part.listfolder.php b/templates/part.listfolder.php
index f7a81ff03..874ef0a27 100644
--- a/templates/part.listfolder.php
+++ b/templates/part.listfolder.php
@@ -29,10 +29,11 @@
</button>
</div>
- <a href="#/items/folders/{{ folder.id }}"
- class="title folder-icon"
- ng-hide="folder.editing"
- ng-class="{
+ <a ng-href="#/items/folders/{{ folder.id }}"
+ news-route-reload
+ class="title folder-icon"
+ ng-hide="folder.editing"
+ ng-class="{
'progress-icon': !folder.id,
'problem-icon': folder.error
}">