blob: 449047cf2526ecd657bdfc7d8470456907454657 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
* 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.
*
*/
var DetailTabView = OC.Backbone.View.extend({
tag: 'div',
className: 'tab',
/**
* Tab label
*/
_label: null,
_template: null,
initialize: function() {
if (!this.id) {
this.id = 'detailTabView' + DetailTabView._TAB_COUNT;
DetailTabView._TAB_COUNT++;
}
},
/**
* Returns the tab label
*
* @return {String} label
*/
getLabel: function() {
return 'Tab ' + this.id;
},
/**
* returns the jQuery object for HTML output
*
* @returns {jQuery}
*/
get$: function() {
return this.$el;
},
/**
* Renders this details view
*
* @abstract
*/
render: function() {
// to be implemented in subclass
// FIXME: code is only for testing
this.$el.html('<div>Hello ' + this.id + '</div>');
},
/**
* Sets the file info to be displayed in the view
*
* @param {OCA.Files.FileInfoModel} fileInfo file info to set
*/
setFileInfo: function(fileInfo) {
if (this.model !== fileInfo) {
this.model = fileInfo;
this.render();
}
},
/**
* Returns the file info.
*
* @return {OCA.Files.FileInfoModel} file info
*/
getFileInfo: function() {
return this.model;
},
/**
* Load the next page of results
*/
nextPage: function() {
// load the next page, if applicable
}
});
DetailTabView._TAB_COUNT = 0;
OCA.Files = OCA.Files || {};
OCA.Files.DetailTabView = DetailTabView;
})();
|