Main view does not commands detail and tab views to render. Fixes JS tests.
For a predictive behaviour we need to determine who is allowed to call render methods on the views. Either, the main view is solely allowed to call render and views do not do anything about output until then. Or, the main view relies on the concrete views to be ready when things are about to be shown. The latter approach has the advantage that concrete views know when they have to update themselves (e.g. new data arrives or information change), but the main view has now idea of the inner workings.
This commit is contained in:
parent
e0bcd56402
commit
7a982872e7
|
@ -44,6 +44,15 @@
|
|||
this.$el = $('<div class="detailFileInfoView"></div>');
|
||||
},
|
||||
|
||||
/**
|
||||
* returns the jQuery object for HTML output
|
||||
*
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
get$: function() {
|
||||
return this.$el;
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy / uninitialize this instance.
|
||||
*/
|
||||
|
|
|
@ -136,16 +136,14 @@
|
|||
|
||||
// render details
|
||||
_.each(this._detailFileInfoViews, function(detailView) {
|
||||
detailView.render();
|
||||
$detailsContainer.append(detailView.$el);
|
||||
$detailsContainer.append(detailView.get$());
|
||||
});
|
||||
|
||||
if (this._tabViews.length > 0) {
|
||||
// render tabs
|
||||
_.each(this._tabViews, function(tabView) {
|
||||
tabView.render();
|
||||
// hidden by default
|
||||
$tabsContainer.append(tabView.$el);
|
||||
$tabsContainer.append(tabView.get$());
|
||||
|
||||
$tabHeadsContainer.append(self._templateTabHeader({
|
||||
tabId: tabView.getId(),
|
||||
|
@ -171,7 +169,6 @@
|
|||
setFileInfo: function(fileInfo) {
|
||||
this._fileInfo = fileInfo;
|
||||
|
||||
// FIXME: this will render panels twice
|
||||
this.render();
|
||||
|
||||
// notify all panels
|
||||
|
|
|
@ -90,6 +90,15 @@
|
|||
return 'Tab ' + this._id;
|
||||
},
|
||||
|
||||
/**
|
||||
* returns the jQuery object for HTML output
|
||||
*
|
||||
* @returns {jQuery}
|
||||
*/
|
||||
get$: function() {
|
||||
return this.$el;
|
||||
},
|
||||
|
||||
/**
|
||||
* Renders this details view
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue