|
272 | 272 | this.$el.toggleClass('hide-hidden-files', !this._filesConfig.get('showhidden')); |
273 | 273 | } |
274 | 274 |
|
| 275 | + this._initFileActions(options.fileActions); |
275 | 276 |
|
276 | 277 | if (_.isUndefined(options.detailsViewEnabled) || options.detailsViewEnabled) { |
277 | | - this._detailsView = new OCA.Files.DetailsView(); |
| 278 | + if (OCA.Files.App.detailsView === null) { |
| 279 | + OCA.Files.App.detailsView = new OCA.Files.DetailsView(); |
| 280 | + OCA.Files.App.detailsView.initialize(); |
| 281 | + |
| 282 | + this._detailsView = OCA.Files.App.detailsView; |
| 283 | + this._detailsView.addDetailView(new OCA.Files.MainFileInfoDetailView({fileList: this, fileActions: this.fileActions})); |
| 284 | + } |
| 285 | + this._detailsView = OCA.Files.App.detailsView; |
278 | 286 | this._detailsView.$el.addClass('disappear'); |
279 | 287 | } |
280 | | - |
281 | 288 | this._initFileActions(options.fileActions); |
282 | 289 |
|
283 | | - if (this._detailsView) { |
284 | | - this._detailsView.addDetailView(new OCA.Files.MainFileInfoDetailView({fileList: this, fileActions: this.fileActions})); |
285 | | - } |
286 | | - |
287 | 290 | this.files = []; |
288 | 291 | this._selectedFiles = {}; |
289 | 292 | this._selectionSummary = new OCA.Files.FileSummary(undefined, {config: this._filesConfig}); |
|
374 | 377 | } |
375 | 378 | } |
376 | 379 |
|
377 | | - |
378 | 380 | OC.Plugins.attach('OCA.Files.FileList', this); |
379 | 381 | }, |
380 | 382 |
|
|
388 | 390 | if (this._newButton) { |
389 | 391 | this._newButton.remove(); |
390 | 392 | } |
391 | | - if (this._detailsView) { |
392 | | - this._detailsView.remove(); |
393 | | - } |
| 393 | + |
394 | 394 | // TODO: also unregister other event handlers |
395 | 395 | this.fileActions.off('registerAction', this._onFileActionsUpdated); |
396 | 396 | this.fileActions.off('setDefault', this._onFileActionsUpdated); |
|
3327 | 3327 | * Register a tab view to be added to all views |
3328 | 3328 | */ |
3329 | 3329 | registerTabView: function(tabView) { |
3330 | | - if (this._detailsView) { |
| 3330 | + if (this._detailsView && (OCA.Files.App.fileList === null || OCA.Files.App.fileList === this)) { |
3331 | 3331 | this._detailsView.addTabView(tabView); |
3332 | 3332 | } |
3333 | 3333 | }, |
|
3336 | 3336 | * Register a detail view to be added to all views |
3337 | 3337 | */ |
3338 | 3338 | registerDetailView: function(detailView) { |
3339 | | - if (this._detailsView) { |
| 3339 | + if (this._detailsView && (OCA.Files.App.fileList === null || OCA.Files.App.fileList === this)) { |
3340 | 3340 | this._detailsView.addDetailView(detailView); |
3341 | 3341 | } |
3342 | 3342 | }, |
|
0 commit comments