summaryrefslogtreecommitdiffstats
path: root/apps/files/js/navigation.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-12 19:54:20 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-15 17:51:04 +0200
commit6fd084243b65a556d4775209ba3916145ef5912a (patch)
tree6162c2af1861d8e3b8bbf1340ac55c4affc5ad61 /apps/files/js/navigation.js
parent9d38e3602b2faf37d861729c52690ce51b8fee97 (diff)
downloadnextcloud-server-6fd084243b65a556d4775209ba3916145ef5912a.tar.gz
nextcloud-server-6fd084243b65a556d4775209ba3916145ef5912a.zip
Fixed many issues, clean up
- fixed upload and storage statistics - fixed infinite scroll to use the correct contain for scroll detection - fixed unit test that sometimes fail for rename case - controls are now sticky again - fixed selection overlay to be aligned with the table - fixed "select all" checkbox that had id conflicts - fixed public page - fixed global actions permissions detection - fix when URL contains an invalid view id - viewer mode now hides the sidebar (ex: text editor) - added unit tests for trashbin - clean up storage info in template (most is retrieved via ajax call now)
Diffstat (limited to 'apps/files/js/navigation.js')
-rw-r--r--apps/files/js/navigation.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js
index c4a02ee7549..c58a284e83f 100644
--- a/apps/files/js/navigation.js
+++ b/apps/files/js/navigation.js
@@ -73,25 +73,40 @@
* @param array options "silent" to not trigger event
*/
setActiveItem: function(itemId, options) {
+ var oldItemId = this._activeItem;
if (itemId === this._activeItem) {
+ if (!options || !options.silent) {
+ this.$el.trigger(
+ new $.Event('itemChanged', {itemId: itemId, previousItemId: oldItemId})
+ );
+ }
return;
}
- this._activeItem = itemId;
this.$el.find('li').removeClass('selected');
if (this.$currentContent) {
this.$currentContent.addClass('hidden');
this.$currentContent.trigger(jQuery.Event('hide'));
}
+ this._activeItem = itemId;
+ this.$el.find('li[data-id=' + itemId + ']').addClass('selected');
this.$currentContent = $('#app-content-' + itemId);
this.$currentContent.removeClass('hidden');
- this.$el.find('li[data-id=' + itemId + ']').addClass('selected');
if (!options || !options.silent) {
this.$currentContent.trigger(jQuery.Event('show'));
- this.$el.trigger(new $.Event('itemChanged', {itemId: itemId}));
+ this.$el.trigger(
+ new $.Event('itemChanged', {itemId: itemId, previousItemId: oldItemId})
+ );
}
},
/**
+ * Returns whether a given item exists
+ */
+ itemExists: function(itemId) {
+ return this.$el.find('li[data-id=' + itemId + ']').length;
+ },
+
+ /**
* Event handler for when clicking on an item.
*/
_onClickItem: function(ev) {