summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-03-08 21:53:54 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2014-03-08 21:54:06 +0100
commit69ba0a6f92795483c8e7f75c4c71d146a4d7d2a0 (patch)
tree93a49950bfd9ebdd3b6f4c9ddedf66d2525759e7
parent9d323d22e1e4fb7305766fcd308c56b279146833 (diff)
dont collapse old item when opening a new one, fix #453
-rw-r--r--js/app/controllers/itemcontroller.coffee9
-rw-r--r--js/public/app.js10
-rw-r--r--js/tests/controllers/itemcontrollerSpec.coffee10
-rw-r--r--templates/part.items.php4
4 files changed, 2 insertions, 31 deletions
diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee
index 1b5d4a350..ee2fa7e82 100644
--- a/js/app/controllers/itemcontroller.coffee
+++ b/js/app/controllers/itemcontroller.coffee
@@ -87,15 +87,6 @@ Language, AutoPageLoading, Compact) ->
@_$scope.isCompactView = =>
return @_compact.isCompact()
- @_$scope.is =
- active: 0
-
- @_$scope.toggleOpen = (id) =>
- if id == @_$scope.is.active
- @_$scope.is.active = 0
- else
- @_$scope.is.active = id
-
return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading,
AutoPageLoading, FeedBusinessLayer, Language,
diff --git a/js/public/app.js b/js/public/app.js
index 789ab42e8..d77220b72 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -877,16 +877,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
this._$scope.isCompactView = function() {
return _this._compact.isCompact();
};
- this._$scope.is = {
- active: 0
- };
- this._$scope.toggleOpen = function(id) {
- if (id === _this._$scope.is.active) {
- return _this._$scope.is.active = 0;
- } else {
- return _this._$scope.is.active = id;
- }
- };
}
return ItemController;
diff --git a/js/tests/controllers/itemcontrollerSpec.coffee b/js/tests/controllers/itemcontrollerSpec.coffee
index 03b6bbc2e..7b2c50cb9 100644
--- a/js/tests/controllers/itemcontrollerSpec.coffee
+++ b/js/tests/controllers/itemcontrollerSpec.coffee
@@ -191,13 +191,3 @@ describe 'ItemController', ->
@Compact.handle(true)
expect(@scope.isCompactView()).toBe(true)
-
- it 'should toggle active ones and close old ones', =>
- expect(@scope.is.active).toBe(0)
-
- @scope.toggleOpen(3)
- expect(@scope.is.active).toBe(3)
-
- @scope.toggleOpen(3)
- expect(@scope.is.active).toBe(0)
-
diff --git a/templates/part.items.php b/templates/part.items.php
index 4334baf4d..671d53cbc 100644
--- a/templates/part.items.php
+++ b/templates/part.items.php
@@ -4,7 +4,7 @@
<li class="feed_item"
ng-repeat="item in itemBusinessLayer.getAll() | orderBy:['-id'] "
- ng-class="{ read: item.isRead(), compact: isCompactView(), open: is.active==item.id}"
+ ng-class="{ read: item.isRead(), compact: isCompactView(), open: item.active}"
data-id="{{ item.id }}"
ng-click="itemBusinessLayer.setRead(item.id)">
@@ -23,7 +23,7 @@
{{ getRelativeDate(item.pubDate) }}
</span>
<h1>
- <a ng-click="toggleOpen(item.id)" href="#">{{ item.title }}</a>
+ <a ng-click="item.active = !item.active" href="#">{{ item.title }}</a>
</h1>
</div>