Currently, all views (jquery.wikibase widgets) are immediately constructed wherever needed. This has several implications:
* They are harder to test because they construct subviews
* Dependencies have to be passed through all parent views
* Knowledge about our views being jQuery-based is scattered throughout our code-base
I propose to introduce a ViewFactory along the following rough spec:
ViewFactory = function( valueViewBuilder, entityStore, dataTypeStore, entityChangersFactory, … )
ViewFactory.prototype = {
getEntityview: function( node, wb.datamodel.Entity value ){
return $( node ).entityview( {
value: value,
viewFactory: this,
…
} );
},
getStatementview: function( node, wb.datamodel.Statement value ),
…
}
That could be constructed in wb.ui.entityViewInit.
Introduce factory to the following widgets:
[] children of entityviews
[] statementgroupviews in statementgrouplistview
[] statement list view