https://bugzilla.wikimedia.org/show_bug.cgi?id=73380

            Bug ID: 73380
           Summary: Introduce factory for JS views
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: WikidataRepo
          Assignee: wikidata-b...@lists.wikimedia.org
          Reporter: adrian.l...@wikimedia.de
                CC: wikidata-b...@lists.wikimedia.org
       Web browser: ---
   Mobile Platform: ---

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to