Ladsgroup has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400230 )
Change subject: Add discuss link to constraint reports ...................................................................... Add discuss link to constraint reports Bug: T164351 Change-Id: I5814ef1866ac13023d307036c92f957dc961a9c7 --- M i18n/en.json M i18n/qqq.json M modules/ui/ConstraintReportList.js M modules/ui/ConstraintReportPanel.js M modules/ui/ConstraintReportPanel.less M src/ConstraintCheck/Api/CheckingResultsBuilder.php 6 files changed, 29 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/30/400230/1 diff --git a/i18n/en.json b/i18n/en.json index fbd6779..b1191eb 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -42,6 +42,8 @@ "wbqc-parameterissues-long": "These issues are problems with the constraint definition on the property, not with this statement.", "wbqc-constrainttypehelp-short": "Help", "wbqc-constrainttypehelp-long": "Help page for this constraint type", + "wbqc-constrainttypediscuss-short": "Discuss", + "wbqc-constrainttypediscuss-long": "Discussion page about this constraint", "wbqc-cached-generic": "This result is cached and might be out of date.", "wbqc-cached-minutes": "This result is cached and might be out of date by up to {{PLURAL:$1|1=one minute|$1 minutes}}.", "wbqc-cached-hours": "This result is cached and might be out of date by up to {{PLURAL:$1|1=one hour|$1 hours}}.", diff --git a/i18n/qqq.json b/i18n/qqq.json index e4b35ce..cd4ee15 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -44,6 +44,8 @@ "wbqc-parameterissues-long": "Longer explanation of the section of the constraint parameter report popup that contains problems about the constraint parameters.\n{{Related|wbqc-parameterissues-short}}", "wbqc-constrainttypehelp-short": "Text for the help link shown next to the constraint type in a constraint violation report. The link leads to a help page on Wikidata about the constraint type.\n{{Identical|Help}}", "wbqc-constrainttypehelp-long": "Title for the help link shown next to the constraint type in a constraint violation report. The link leads to a help page on Wikidata about the constraint type.\n{{Related|wbqc-constrainttypehelp-short}}", + "wbqc-constrainttypediscuss-short": "Text for the discussion link shown next to the constraint type in a constraint violation report. The link leads to a property talk page on Wikidata about the constraint.\n{{Identical|Discuss}}", + "wbqc-constrainttypediscuss-long": "Titlefor the discussion link shown next to the constraint type in a constraint violation report. The link leads to a property talk page on Wikidata about the constraint.\n{{Related|wbqc-constrainttypediscuss-short}}", "wbqc-cached-generic": "Generic message informing the user that a constraint check result might be outdated. There is no information on how old the cached result is; if more information is available, a more specific message is used.", "wbqc-cached-minutes": "Message informing the user that a constraint check result might be outdated by up to ''n'' minutes.\n{{Related|wbqc-cached-generic}}", "wbqc-cached-hours": "Message informing the user that a constraint check result might be outdated by up to ''n'' hours.\n{{Related|Wbqc-cached}}", diff --git a/modules/ui/ConstraintReportList.js b/modules/ui/ConstraintReportList.js index a7fe8d8..df09711 100644 --- a/modules/ui/ConstraintReportList.js +++ b/modules/ui/ConstraintReportList.js @@ -15,7 +15,8 @@ * constraint: { * type: 'Q1', * typeLabel: 'my constraint', - * link: 'http://example.com/my-constraint' + * link: 'http://example.com/my-constraint', + * discussLink: 'https://wikidata.org/Property_talk:P2' * }, * message: 'everything okay' * } ), @@ -24,7 +25,8 @@ * constraint: { * type: 'Q2', * typeLabel: 'my other constraint', - * link: 'http://example.com/my-other-constraint' + * link: 'http://example.com/my-other-constraint', + * discussLink: 'https://wikidata.org/Property_talk:P2' * }, * message: 'doing it wrong' * } ) @@ -59,7 +61,8 @@ * constraint: { * type: 'Q1', * typeLabel: 'my constraint', - * link: 'http://example.com/my-constraint' + * link: 'http://example.com/my-constraint', + * discussLink: 'https://wikidata.org/Property_talk:P2' * }, * message: 'everything okay' * } ) @@ -73,7 +76,8 @@ * constraint: { * type: 'Q2', * typeLabel: 'my other constraint', - * link: 'http://example.com/my-other-constraint' + * link: 'http://example.com/my-other-constraint', + * discussLink: 'https://wikidata.org/Property_talk:P2' * }, * message: 'doing it wrong' * } ) diff --git a/modules/ui/ConstraintReportPanel.js b/modules/ui/ConstraintReportPanel.js index 0289eb7..f7f762b 100644 --- a/modules/ui/ConstraintReportPanel.js +++ b/modules/ui/ConstraintReportPanel.js @@ -10,7 +10,8 @@ * constraint: { * type: 'Q1', * typeLabel: 'my constraint', - * link: 'http://example.com/my-constraint' + * link: 'http://example.com/my-constraint', + * discussLink: 'https://wikidata.org/Property_talk:P2', * }, * message: 'everything okay', * expanded: false, @@ -62,6 +63,13 @@ .attr( 'href', 'https://www.wikidata.org/wiki/Help:Property_constraints_portal/' + this.constraint.type ) .attr( 'target', '_blank' ) ); + this.$discussLink = config.$discussLink || $( '<small class="wbqc-constraint-type-discuss">' ).append( + $( '<a>' ) + .text( mw.message( 'wbqc-constrainttypediscuss-short' ).text() ) + .attr( 'title', mw.message( 'wbqc-constrainttypediscuss-long' ).text() ) + .attr( 'href', this.constraint.discussLink ) + .attr( 'target', '_blank' ) + ); this.message = config.message; this.$message = config.$message || $( '<p>' ).html( this.message ); this.ancillaryMessages = config.ancillaryMessages; @@ -78,6 +86,7 @@ this.$element .addClass( 'wbqc-report' ) .addClass( 'wbqc-report-status-' + this.status ); + this.$heading.append( this.$discussLink ); this.$heading.append( this.$helpLink ); this.$element.append( this.$heading ); this.$element.append( this.$message ); diff --git a/modules/ui/ConstraintReportPanel.less b/modules/ui/ConstraintReportPanel.less index 78da6d9..94043aa 100644 --- a/modules/ui/ConstraintReportPanel.less +++ b/modules/ui/ConstraintReportPanel.less @@ -9,6 +9,12 @@ font-weight: normal; float: right; margin-left: 1.5em; + margin-right: 0.2em; + } + + .wbqc-constraint-type-discuss { + font-weight: normal; + float: right; margin-right: 0.5em; } diff --git a/src/ConstraintCheck/Api/CheckingResultsBuilder.php b/src/ConstraintCheck/Api/CheckingResultsBuilder.php index 87592de..95bde7e 100644 --- a/src/ConstraintCheck/Api/CheckingResultsBuilder.php +++ b/src/ConstraintCheck/Api/CheckingResultsBuilder.php @@ -128,6 +128,7 @@ 'type' => $typeItemId, 'typeLabel' => $typeLabel, 'link' => $link, + 'discussLink' => $title->getTalkPage()->getFullURL(), ]; if ( $this->config->get( 'WBQualityConstraintsIncludeDetailInApi' ) ) { $parameters = $checkResult->getParameters(); -- To view, visit https://gerrit.wikimedia.org/r/400230 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5814ef1866ac13023d307036c92f957dc961a9c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits