2015-07-15 13:06:13 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3
|
|
|
|
* or later.
|
|
|
|
*
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class OCA.Files.DetailTabView
|
|
|
|
* @classdesc
|
|
|
|
*
|
|
|
|
* Base class for tab views to display file information.
|
|
|
|
*
|
|
|
|
*/
|
2015-08-12 18:30:20 +03:00
|
|
|
var DetailTabView = OC.Backbone.View.extend({
|
|
|
|
tag: 'div',
|
2015-07-15 13:06:13 +03:00
|
|
|
|
2015-08-12 18:30:20 +03:00
|
|
|
className: 'tab',
|
2015-07-15 13:06:13 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tab label
|
|
|
|
*/
|
|
|
|
_label: null,
|
|
|
|
|
|
|
|
_template: null,
|
|
|
|
|
2015-08-12 18:30:20 +03:00
|
|
|
initialize: function() {
|
|
|
|
if (!this.id) {
|
|
|
|
this.id = 'detailTabView' + DetailTabView._TAB_COUNT;
|
|
|
|
DetailTabView._TAB_COUNT++;
|
2015-07-15 13:06:13 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the tab label
|
|
|
|
*
|
|
|
|
* @return {String} label
|
|
|
|
*/
|
|
|
|
getLabel: function() {
|
2015-08-12 18:30:20 +03:00
|
|
|
return 'Tab ' + this.id;
|
2015-07-15 13:06:13 +03:00
|
|
|
},
|
|
|
|
|
2015-07-20 15:42:10 +03:00
|
|
|
/**
|
|
|
|
* returns the jQuery object for HTML output
|
|
|
|
*
|
|
|
|
* @returns {jQuery}
|
|
|
|
*/
|
|
|
|
get$: function() {
|
|
|
|
return this.$el;
|
|
|
|
},
|
|
|
|
|
2015-07-15 13:06:13 +03:00
|
|
|
/**
|
|
|
|
* Renders this details view
|
|
|
|
*
|
|
|
|
* @abstract
|
|
|
|
*/
|
|
|
|
render: function() {
|
|
|
|
// to be implemented in subclass
|
2015-07-15 17:09:00 +03:00
|
|
|
// FIXME: code is only for testing
|
2015-08-12 18:30:20 +03:00
|
|
|
this.$el.html('<div>Hello ' + this.id + '</div>');
|
2015-07-15 13:06:13 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the file info to be displayed in the view
|
|
|
|
*
|
2015-08-12 18:30:20 +03:00
|
|
|
* @param {OCA.Files.FileInfoModel} fileInfo file info to set
|
2015-07-15 13:06:13 +03:00
|
|
|
*/
|
|
|
|
setFileInfo: function(fileInfo) {
|
2015-08-14 16:54:27 +03:00
|
|
|
if (this.model !== fileInfo) {
|
|
|
|
this.model = fileInfo;
|
|
|
|
this.render();
|
|
|
|
}
|
2015-07-15 13:06:13 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the file info.
|
|
|
|
*
|
2015-08-12 18:30:20 +03:00
|
|
|
* @return {OCA.Files.FileInfoModel} file info
|
2015-07-15 13:06:13 +03:00
|
|
|
*/
|
|
|
|
getFileInfo: function() {
|
2015-08-12 18:30:20 +03:00
|
|
|
return this.model;
|
2015-07-15 13:06:13 +03:00
|
|
|
}
|
2015-08-12 18:30:20 +03:00
|
|
|
});
|
|
|
|
DetailTabView._TAB_COUNT = 0;
|
2015-07-15 13:06:13 +03:00
|
|
|
|
2015-08-20 18:54:52 +03:00
|
|
|
OCA.Files = OCA.Files || {};
|
|
|
|
|
2015-07-15 13:06:13 +03:00
|
|
|
OCA.Files.DetailTabView = DetailTabView;
|
|
|
|
})();
|
|
|
|
|