Skip to content

Commit

Permalink
[Patch] Fix for cernbox details view
Browse files Browse the repository at this point in the history
- Added trashbin details view
- EOS paths are now shown in a textbox and text is selected
automatically
  • Loading branch information
nadir committed Apr 13, 2016
1 parent 3a89919 commit 99fa1a5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
7 changes: 4 additions & 3 deletions apps/files_trashbin/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
/**
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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 */
Expand Down
18 changes: 8 additions & 10 deletions apps/files_trashbin/js/restorepathview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
}

var TEMPLATE =
'<span class="eosinfo">' +
' {{eospathText}}' +
'</span><br/>'
;
'<p><b>EOS Restoration path</b>:</p><textarea readonly>{{eospathText}}</textarea>';

var RestorePathView = OC.Backbone.View.extend({
/** @type {string} **/
Expand Down Expand Up @@ -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;
},
Expand All @@ -81,6 +80,5 @@

});

OC.Share.RestorePathView = RestorePathView;

OCA.Trashbin.RestorePathView = RestorePathView;
})();
6 changes: 4 additions & 2 deletions core/js/ShareDialogEospath.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

var TEMPLATE =
'<p><b>EOS Path</b>: {{eospathText}}</p>';
'<p><b>EOS Path</b>:</p><textarea readonly>{{eospathText}}</textarea>';

var ShareDialogEospath = OC.Backbone.View.extend({
/** @type {string} **/
Expand Down Expand Up @@ -49,7 +49,7 @@

var eospathT = this.model.get('eospath');

if(eospathT == 'undefined')
if(typeof eospathT == 'undefined')
{
this.$el.empty();
return;
Expand All @@ -70,6 +70,8 @@
this.$el.html(reshareTemplate({
eospathText: eospathT
}));

this.$el.find('textarea').select();

return this;
},
Expand Down
2 changes: 1 addition & 1 deletion core/js/ShareDialogProjectname.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

var projectnameT = this.model.get('projectname');
if (!projectnameT || projectnameT == 'undefined')
if (!projectnameT || typeof projectnameT == 'undefined')
{
this.$el.empty();
return this;
Expand Down
9 changes: 8 additions & 1 deletion core/js/cernboxplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
};
})();
Expand Down
19 changes: 18 additions & 1 deletion core/js/cernboxtabview.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
var TEMPLATE_BASE =
'<div class="cernboxInfoView subView"></div>' +
'<div class="eospathView subView hidden"></div>' +
'<div class="projectnameView subView hidden"></div>';
'<div class="projectnameView subView hidden"></div>' +
'<div class="restorepathView subView hidden"></div>';

var CernboxDialogView = OCA.Files.DetailTabView.extend (
{
Expand All @@ -31,6 +32,9 @@
/** @type {object} **/
projectnameView: undefined,

/** @type {object} **/
restorepathView: undefined,

subViews:
{
eospathView: 'ShareDialogEospath', // CERNBOX SHOW SHARE INFO PR PATCH
Expand Down Expand Up @@ -66,6 +70,12 @@
}
},

registerSubView: function(name, view)
{
view.setFileInfo(this.model);
this[name] = view;
},

getLabel: function() {
return t('core', 'CERNBox Info');
},
Expand All @@ -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;
},
Expand Down

0 comments on commit 99fa1a5

Please sign in to comment.