-
Notifications
You must be signed in to change notification settings - Fork 967
/
collection-li-edit.js
156 lines (129 loc) · 5.63 KB
/
collection-li-edit.js
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
define([
"mvc/collection/collection-li",
"mvc/dataset/dataset-li-edit",
"mvc/base-mvc",
"utils/localization"
], function( DC_LI, DATASET_LI_EDIT, BASE_MVC, _l ){
/* global Backbone, LoggableMixin */
//==============================================================================
var DCListItemView = DC_LI.DCListItemView;
/** @class Edit view for DatasetCollection.
*/
var DCListItemEdit = DCListItemView.extend(
/** @lends DCListItemEdit.prototype */{
//TODO: may not be needed
/** logger used to record this.log messages, commonly set to console */
//logger : console,
/** override to add linkTarget */
initialize : function( attributes ){
DCListItemView.prototype.initialize.call( this, attributes );
},
// ......................................................................... misc
/** String representation */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
return 'DCListItemEdit(' + modelString + ')';
}
});
// ............................................................................ TEMPLATES
/** underscore templates */
// DCListItemEdit.prototype.templates = (function(){
// // use element identifier
// var titleBarTemplate = BASE_MVC.wrapTemplate([
// '<div class="title-bar clear" tabindex="0">',
// '<div class="title">',
// '<span class="name"><%- collection.element_identifier || collection.name %></span>',
// '</div>',
// '<div class="subtitle"></div>',
// '</div>'
// ], 'collection' );
// return _.extend( {}, DCListItemView.prototype.templates, {
// titleBar : titleBarTemplate
// });
// }());
//==============================================================================
var DCEListItemView = DC_LI.DCEListItemView;
/** @class Read only view for DatasetCollectionElement.
*/
var DCEListItemEdit = DCEListItemView.extend(
/** @lends DCEListItemEdit.prototype */{
//TODO: this might be expendable - compacted with HDAListItemView
/** logger used to record this.log messages, commonly set to console */
//logger : console,
/** set up */
initialize : function( attributes ){
DCEListItemView.prototype.initialize.call( this, attributes );
},
// ......................................................................... misc
/** String representation */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
return 'DCEListItemEdit(' + modelString + ')';
}
});
// ............................................................................ TEMPLATES
/** underscore templates */
// DCEListItemEdit.prototype.templates = (function(){
// // use the element identifier here - since that will persist and the user will need it
// var titleBarTemplate = BASE_MVC.wrapTemplate([
// '<div class="title-bar clear" tabindex="0">',
// '<div class="title">',
// '<span class="name"><%- element.element_identifier %></span>',
// '</div>',
// '<div class="subtitle"></div>',
// '</div>'
// ], 'element' );
// return _.extend( {}, DCEListItemView.prototype.templates, {
// titleBar : titleBarTemplate
// });
// }());
//==============================================================================
/** @class Editable view for a DatasetCollectionElement that is also an DatasetAssociation
* (a dataset contained in a dataset collection).
*/
var DatasetDCEListItemEdit = DATASET_LI_EDIT.DatasetListItemEdit.extend(
/** @lends DatasetDCEListItemEdit.prototype */{
/** logger used to record this.log messages, commonly set to console */
//logger : console,
/** set up */
initialize : function( attributes ){
DATASET_LI_EDIT.DatasetListItemEdit.prototype.initialize.call( this, attributes );
},
// ......................................................................... misc
/** String representation */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
return 'DatasetDCEListItemEdit(' + modelString + ')';
}
});
// ............................................................................ TEMPLATES
/** underscore templates */
DatasetDCEListItemEdit.prototype.templates = (function(){
return _.extend( {}, DATASET_LI_EDIT.DatasetListItemEdit.prototype.templates, {
titleBar : DC_LI.DatasetDCEListItemView.prototype.templates.titleBar
});
}());
//==============================================================================
/** @class Read only view for a DatasetCollectionElement that is also a DatasetCollection
* (a nested DC).
*/
var NestedDCDCEListItemEdit = DC_LI.NestedDCDCEListItemView.extend(
/** @lends NestedDCDCEListItemEdit.prototype */{
/** logger used to record this.log messages, commonly set to console */
// comment this out to suppress log output
//logger : console,
// ......................................................................... misc
/** String representation */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
return 'NestedDCDCEListItemEdit(' + modelString + ')';
}
});
//==============================================================================
return {
DCListItemEdit : DCListItemEdit,
DCEListItemEdit : DCEListItemEdit,
DatasetDCEListItemEdit : DatasetDCEListItemEdit,
NestedDCDCEListItemEdit : NestedDCDCEListItemEdit
};
});