From 99fa1a5b603ac2bd9795228894f853cffedf9f5e Mon Sep 17 00:00:00 2001 From: nadir Date: Wed, 13 Apr 2016 13:54:09 +0200 Subject: [PATCH] [Patch] Fix for cernbox details view - Added trashbin details view - EOS paths are now shown in a textbox and text is selected automatically --- apps/files_trashbin/js/filelist.js | 7 ++++--- apps/files_trashbin/js/restorepathview.js | 18 ++++++++---------- core/js/ShareDialogEospath.js | 6 ++++-- core/js/ShareDialogProjectname.js | 2 +- core/js/cernboxplugin.js | 9 ++++++++- core/js/cernboxtabview.js | 19 ++++++++++++++++++- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js index 49af402d55ba..aa24c8f0da10 100644 --- a/apps/files_trashbin/js/filelist.js +++ b/apps/files_trashbin/js/filelist.js @@ -50,9 +50,9 @@ var result = OCA.Files.FileList.prototype.initialize.apply(this, arguments); this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this)); - if (this._detailsView) { + /*if (this._detailsView) { this._detailsView.addDetailView(new OC.Share.RestorePathView()); - } + }*/ this.setSort('mtime', 'desc'); /** @@ -93,6 +93,7 @@ var tr = OCA.Files.FileList.prototype._createRow.apply(this, arguments); tr.find('td.filesize').remove(); tr.attr('data-file', fileData.id); + tr.attr('data-name', fileData.displayName); tr.attr('eospath', fileData['restore-path']); return tr; }, @@ -131,7 +132,7 @@ elementToFile: function($el) { var fileInfo = OCA.Files.FileList.prototype.elementToFile($el); if (this.getCurrentDirectory() === '/') { - fileInfo.displayName = getDeletedFileName(fileInfo.name); + fileInfo.displayName = $el.attr('data-name');//getDeletedFileName(fileInfo.name); } /** CERNBOX SHOW TRASHBIN INFO PATCH */ diff --git a/apps/files_trashbin/js/restorepathview.js b/apps/files_trashbin/js/restorepathview.js index 1ef14bdc4a9f..7dcafded34d0 100644 --- a/apps/files_trashbin/js/restorepathview.js +++ b/apps/files_trashbin/js/restorepathview.js @@ -4,10 +4,7 @@ } var TEMPLATE = - '' + - ' {{eospathText}}' + - '
' - ; + '

EOS Restoration path:

'; var RestorePathView = OC.Backbone.View.extend({ /** @type {string} **/ @@ -49,21 +46,23 @@ render: function() { if(!this.model) return null; - /*var eospathT = this.model.getEosPath().trim(); + var eospathT = this.model.get('restore-path'); - if (!eospathT || eospathT == 'undefined') + if (!eospathT || typeof eospathT == 'undefined') { this.$el.empty(); return this; - }*/ + } this.$el.removeClass('hidden'); var reshareTemplate = this.template(); this.$el.html(reshareTemplate({ - eospathText: 'EOS restore path: ' + this.model.get('restore-path') + eospathText: eospathT })); + + this.$el.find('textarea').select(); return this; }, @@ -81,6 +80,5 @@ }); - OC.Share.RestorePathView = RestorePathView; - + OCA.Trashbin.RestorePathView = RestorePathView; })(); \ No newline at end of file diff --git a/core/js/ShareDialogEospath.js b/core/js/ShareDialogEospath.js index 95c576ca4912..06a470579f09 100644 --- a/core/js/ShareDialogEospath.js +++ b/core/js/ShareDialogEospath.js @@ -8,7 +8,7 @@ } var TEMPLATE = - '

EOS Path: {{eospathText}}

'; + '

EOS Path:

'; var ShareDialogEospath = OC.Backbone.View.extend({ /** @type {string} **/ @@ -49,7 +49,7 @@ var eospathT = this.model.get('eospath'); - if(eospathT == 'undefined') + if(typeof eospathT == 'undefined') { this.$el.empty(); return; @@ -70,6 +70,8 @@ this.$el.html(reshareTemplate({ eospathText: eospathT })); + + this.$el.find('textarea').select(); return this; }, diff --git a/core/js/ShareDialogProjectname.js b/core/js/ShareDialogProjectname.js index 4ad0b7cbdb1a..91171c7204d7 100644 --- a/core/js/ShareDialogProjectname.js +++ b/core/js/ShareDialogProjectname.js @@ -48,7 +48,7 @@ } var projectnameT = this.model.get('projectname'); - if (!projectnameT || projectnameT == 'undefined') + if (!projectnameT || typeof projectnameT == 'undefined') { this.$el.empty(); return this; diff --git a/core/js/cernboxplugin.js b/core/js/cernboxplugin.js index 00ba4907ebcd..229cbca997ab 100644 --- a/core/js/cernboxplugin.js +++ b/core/js/cernboxplugin.js @@ -15,7 +15,14 @@ return; } - fileList.registerTabView(new OC.Cernbox.CernboxDialogView('cernboxTabView', {order: -5})); + var view = new OC.Cernbox.CernboxDialogView('cernboxTabView', {order: -5}); + + fileList.registerTabView(view); + + if (fileList.id === 'trashbin') + { + view.registerSubView('restorepathView', new OCA.Trashbin.RestorePathView()); + } } }; })(); diff --git a/core/js/cernboxtabview.js b/core/js/cernboxtabview.js index d040a4de4eef..a40e1fd7c2cc 100644 --- a/core/js/cernboxtabview.js +++ b/core/js/cernboxtabview.js @@ -8,7 +8,8 @@ var TEMPLATE_BASE = '
' + '' + - ''; + '' + + ''; var CernboxDialogView = OCA.Files.DetailTabView.extend ( { @@ -31,6 +32,9 @@ /** @type {object} **/ projectnameView: undefined, + /** @type {object} **/ + restorepathView: undefined, + subViews: { eospathView: 'ShareDialogEospath', // CERNBOX SHOW SHARE INFO PR PATCH @@ -66,6 +70,12 @@ } }, + registerSubView: function(name, view) + { + view.setFileInfo(this.model); + this[name] = view; + }, + getLabel: function() { return t('core', 'CERNBox Info'); }, @@ -83,6 +93,13 @@ this.projectnameView.model = this.model; this.projectnameView.$el = this.$el.find('.projectnameView'); this.projectnameView.render(); + + if(typeof this.restorepathView != 'undefined') + { + this.restorepathView.model = this.model; + this.restorepathView.$el = this.$el.find('.restorepathView'); + this.restorepathView.render(); + } return this; },