[MediaWiki-commits] [Gerrit] Use ViewFactory for constructing statementlistviews in state... - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Use ViewFactory for constructing statementlistviews in statementgroupview .. Use ViewFactory for constructing statementlistviews in statementgroupview This change introduces a `ViewFactory` method for creating `statementlistview` widgets. This method is passed to the `statementgroupview` so that it can create widgets without having to pass it all their dependencies. It improves separation between the `statementgroupview` and `statementlistview`, since the `statementgroupview` doesn't have to know how to construct a `statementlistview` anymore. It also allows to inject a different implementation, for example in tests. This is a third step for T75380. Bug: T75380 Change-Id: Ifeaa600d7746c0056668b754e4df67ca71cb9b2c --- M view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js M view/resources/jquery/wikibase/resources.php M view/resources/wikibase/view/ViewFactory.js M view/resources/wikibase/view/resources.php M view/tests/qunit/jquery/wikibase/jquery.wikibase.statementgroupview.tests.js M view/tests/qunit/wikibase/view/ViewFactory.tests.js 6 files changed, 102 insertions(+), 104 deletions(-) Approvals: Jonas Kress (WMDE): Looks good to me, approved jenkins-bot: Verified diff --git a/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js b/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js index d933662..b2493ef 100644 --- a/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js +++ b/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js @@ -8,9 +8,6 @@ * `Property` id by managing a list of `jQuery.wikibase.statementview` widgets encapsulated by a * `jquery.wikibase.statementlistview` widget. * @see wikibase.datamodel.StatementGroup - * @uses jQuery.wikibase.statementlistview - * @uses jQuery.wikibase.listview - * @uses jQuery.wikibase.listview.ListItemAdapter * @since 0.5 * @extends jQuery.ui.TemplatedWidget * @licence GNU GPL v2+ @@ -22,23 +19,9 @@ * @param {wikibase.datamodel.StatementGroup} [options.value=null] *The `Statements` to be displayed by this view. If `null`, the view will only display an *"add" button to add new `Statements`. - * @param {wikibase.utilities.ClaimGuidGenerator} options.claimGuidGenerator - *Required for dynamically generating GUIDs for new `Statement`s. * @param {wikibase.entityIdFormatter.EntityIdHtmlFormatter} options.entityIdHtmlFormatter *Required for dynamically rendering links to `Entity`s. - * @param {wikibase.entityIdFormatter.EntityIdPlainFormatter} options.entityIdPlainFormatter - *Required for dynamically rendering plain text references to `Entity`s. - * @param {wikibase.store.EntityStore} options.entityStore - *Required for dynamically gathering `Entity`/`Property` information. - * @param {wikibase.ValueViewBuilder} options.valueViewBuilder - *Required by the `snakview` interfacing a `snakview` "value" `Variation` to - *`jQuery.valueview`. - * @param {wikibase.entityChangers.EntityChangersFactory} options.entityChangersFactory - *Required to store the `Reference`s gathered from the `referenceview`s aggregated by the - *`statementview`. - * @param {dataTypes.DataTypeStore} options.dataTypeStore - *Required by the `snakview` for retrieving and evaluating a proper `dataTypes.DataType` - *object when interacting on a "value" `Variation`. + * @param {Function} options.buildStatementListView */ /** * @event afterremove @@ -63,13 +46,8 @@ $propertyLabel: '.wikibase-statementgroupview-property-label' }, value: null, - claimGuidGenerator: null, - entityIdHtmlFormatter: null, - entityIdPlainFormatter: null, - entityStore: null, - valueViewBuilder: null, - entityChangersFactory: null, - dataTypeStore: null + buildStatementListView: null, + entityIdHtmlFormatter: null }, /** @@ -84,13 +62,7 @@ * @throws {Error} if a required option is not specified properly. */ _create: function() { - if ( !this.options.claimGuidGenerator - || !this.options.entityIdHtmlFormatter - || !this.options.entityStore - || !this.options.valueViewBuilder - || !this.options.entityChangersFactory - || !this.options.dataTypeStore - ) { + if ( !this.options.entityIdHtmlFormatter || !this.options.buildStatementListView ) { throw new Error( 'Required option not specified properly' ); } @@ -142,20 +114,10 @@
[MediaWiki-commits] [Gerrit] Use ViewFactory for constructing statementlistviews in state... - change (mediawiki...Wikibase)
Adrian Lang has uploaded a new change for review. https://gerrit.wikimedia.org/r/243494 Change subject: Use ViewFactory for constructing statementlistviews in statementgroupview .. Use ViewFactory for constructing statementlistviews in statementgroupview This change introduces a `ViewFactory` method for creating `statementlistview` widgets. This method is passed to the `statementgroupview` so that it can create widgets without having to pass it all their dependencies. It improves separation between the `statementgroupview` and `statementlistview`, since the `statementgroupview` doesn't have to know how to construct a `statementlistview` anymore. It also allows to inject a different implementation, for example in tests. This is a third step for T75380. Change-Id: Ifeaa600d7746c0056668b754e4df67ca71cb9b2c --- M view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js M view/resources/jquery/wikibase/resources.php M view/resources/wikibase/view/ViewFactory.js M view/resources/wikibase/view/resources.php M view/tests/qunit/jquery/wikibase/jquery.wikibase.statementgroupview.tests.js M view/tests/qunit/wikibase/view/ViewFactory.tests.js 6 files changed, 102 insertions(+), 104 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/94/243494/1 diff --git a/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js b/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js index d933662..b2493ef 100644 --- a/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js +++ b/view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js @@ -8,9 +8,6 @@ * `Property` id by managing a list of `jQuery.wikibase.statementview` widgets encapsulated by a * `jquery.wikibase.statementlistview` widget. * @see wikibase.datamodel.StatementGroup - * @uses jQuery.wikibase.statementlistview - * @uses jQuery.wikibase.listview - * @uses jQuery.wikibase.listview.ListItemAdapter * @since 0.5 * @extends jQuery.ui.TemplatedWidget * @licence GNU GPL v2+ @@ -22,23 +19,9 @@ * @param {wikibase.datamodel.StatementGroup} [options.value=null] *The `Statements` to be displayed by this view. If `null`, the view will only display an *"add" button to add new `Statements`. - * @param {wikibase.utilities.ClaimGuidGenerator} options.claimGuidGenerator - *Required for dynamically generating GUIDs for new `Statement`s. * @param {wikibase.entityIdFormatter.EntityIdHtmlFormatter} options.entityIdHtmlFormatter *Required for dynamically rendering links to `Entity`s. - * @param {wikibase.entityIdFormatter.EntityIdPlainFormatter} options.entityIdPlainFormatter - *Required for dynamically rendering plain text references to `Entity`s. - * @param {wikibase.store.EntityStore} options.entityStore - *Required for dynamically gathering `Entity`/`Property` information. - * @param {wikibase.ValueViewBuilder} options.valueViewBuilder - *Required by the `snakview` interfacing a `snakview` "value" `Variation` to - *`jQuery.valueview`. - * @param {wikibase.entityChangers.EntityChangersFactory} options.entityChangersFactory - *Required to store the `Reference`s gathered from the `referenceview`s aggregated by the - *`statementview`. - * @param {dataTypes.DataTypeStore} options.dataTypeStore - *Required by the `snakview` for retrieving and evaluating a proper `dataTypes.DataType` - *object when interacting on a "value" `Variation`. + * @param {Function} options.buildStatementListView */ /** * @event afterremove @@ -63,13 +46,8 @@ $propertyLabel: '.wikibase-statementgroupview-property-label' }, value: null, - claimGuidGenerator: null, - entityIdHtmlFormatter: null, - entityIdPlainFormatter: null, - entityStore: null, - valueViewBuilder: null, - entityChangersFactory: null, - dataTypeStore: null + buildStatementListView: null, + entityIdHtmlFormatter: null }, /** @@ -84,13 +62,7 @@ * @throws {Error} if a required option is not specified properly. */ _create: function() { - if ( !this.options.claimGuidGenerator - || !this.options.entityIdHtmlFormatter - || !this.options.entityStore - || !this.options.valueViewBuilder - || !this.options.entityChangersFactory - || !this.options.dataTypeStore - ) { + if ( !this.options.entityIdHtmlFormatter || !this.options.buildStatementListView ) { throw new Error( 'Required option not specified properly' ); } @@ -142,20