Last modified: 2014-11-20 13:06:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T75380, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 73380 - Introduce factory for JS views
Introduce factory for JS views
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Wikidata bugs
u=dev c=frontend p=13
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-13 19:28 UTC by Adrian Lang
Modified: 2014-11-20 13:06 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Adrian Lang 2014-11-13 19:28:12 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links