summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-04-03 23:53:30 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-04-03 23:53:42 +0200
commit4ab9494fc90d9131afd50048369b92c2e47a9b6a (patch)
tree1066a874b9fed2ab6f646349a0aafbf686321ee3
parent2abf47a533e56d42262e5061b8ffa9234129b9c9 (diff)
only instantiate one itemcontroller, prevent tons of requests when autopaging, fix #498
-rw-r--r--CHANGELOG1
-rw-r--r--js/app/controllers/feedcontroller.coffee8
-rw-r--r--js/app/controllers/itemcontroller.coffee10
-rw-r--r--js/public/app.js20
-rw-r--r--templates/part.listfeed.php7
5 files changed, 20 insertions, 26 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 145d0285a..3b15e7437 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
owncloud-news (1.808)
* Also focus article area when clicking on all unread link
* Autofocus article area by default on load
+* Instantiate only one itemcontroller, prevents tons of requests when autopaging
owncloud-news (1.807)
* Don't crash if an HttpException occurs in the python updater
diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee
index ee8b9375f..43186e689 100644
--- a/js/app/controllers/feedcontroller.coffee
+++ b/js/app/controllers/feedcontroller.coffee
@@ -47,6 +47,14 @@ ActiveFeed, FeedType, $window) ->
@_$scope.starredBusinessLayer = @_starredBusinessLayer
@_$scope.unreadCountFormatter = @_unreadCountFormatter
+ @_$scope.edit = (feed) ->
+ feed.editing = true
+ feed.originalValue = feed.title
+
+ @_$scope.cancel = (feed) ->
+ feed.editing = false
+ feed.title = feed.originalValue
+
@_$scope.getTotalUnreadCount = =>
# also update title based on unreadcount
count = @_subscriptionsBusinessLayer.getUnreadCount(0)
diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee
index ee2fa7e82..f381baede 100644
--- a/js/app/controllers/itemcontroller.coffee
+++ b/js/app/controllers/itemcontroller.coffee
@@ -37,16 +37,6 @@ Language, AutoPageLoading, Compact) ->
@_$scope.itemBusinessLayer = @_itemBusinessLayer
@_$scope.feedBusinessLayer = @_feedBusinessLayer
- @_$scope.edit = (feedId) =>
- feed = @_feedModel.getById(feedId)
- feed.editing = true
- feed.originalValue = feed.title
-
- @_$scope.cancel = (feedId) =>
- feed = @_feedModel.getById(feedId)
- feed.editing = false
- feed.title = feed.originalValue
-
@_$scope.isLoading = =>
return @_feedLoading.isLoading()
diff --git a/js/public/app.js b/js/public/app.js
index e4dd8880c..57306e34a 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -744,6 +744,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
this._$scope.subscriptionsBusinessLayer = this._subscriptionsBusinessLayer;
this._$scope.starredBusinessLayer = this._starredBusinessLayer;
this._$scope.unreadCountFormatter = this._unreadCountFormatter;
+ this._$scope.edit = function(feed) {
+ feed.editing = true;
+ return feed.originalValue = feed.title;
+ };
+ this._$scope.cancel = function(feed) {
+ feed.editing = false;
+ return feed.title = feed.originalValue;
+ };
this._$scope.getTotalUnreadCount = function() {
var appName, count, title, titleCount;
count = _this._subscriptionsBusinessLayer.getUnreadCount(0);
@@ -873,18 +881,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
this._autoPaging = true;
this._$scope.itemBusinessLayer = this._itemBusinessLayer;
this._$scope.feedBusinessLayer = this._feedBusinessLayer;
- this._$scope.edit = function(feedId) {
- var feed;
- feed = _this._feedModel.getById(feedId);
- feed.editing = true;
- return feed.originalValue = feed.title;
- };
- this._$scope.cancel = function(feedId) {
- var feed;
- feed = _this._feedModel.getById(feedId);
- feed.editing = false;
- return feed.title = feed.originalValue;
- };
this._$scope.isLoading = function() {
return _this._feedLoading.isLoading();
};
diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php
index d6a434e59..afecddc37 100644
--- a/templates/part.listfeed.php
+++ b/templates/part.listfeed.php
@@ -17,10 +17,10 @@
revert: true
}">
- <div ui-if="feed.editing" class="rename-feed" ng-controller="ItemController">
+ <div ui-if="feed.editing" class="rename-feed">
<input type="text" ng-model="feed.title" autofocus>
<button title="<?php p($l->t('Cancel')); ?>"
- ng-click="cancel(feed.id)"
+ ng-click="cancel(feed)"
class="action-button back-button action"></button>
<button title="<?php p($l->t('Save')); ?>"
ng-click="feedBusinessLayer.renameFeed(feed.id, feed.title)"
@@ -65,8 +65,7 @@
<button class="svg action rename-feed-icon"
ng-hide="feed.editing || feed.error"
- ng-controller="ItemController"
- ng-click="edit(feed.id)"
+ ng-click="edit(feed)"
title="<?php p($l->t('Rename feed')); ?>"
oc-tooltip></button>