Lucas Werkmeister (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389775 )

Change subject: Add ancillary messages to ConstraintReportPanel
......................................................................

Add ancillary messages to ConstraintReportPanel

These messages can be used to attach additional information to a report,
such as an indication that the result is potentially outdated.

Bug: T179844
Change-Id: Ic194c64470487391b2f81c58bc332c8268f1e0c8
---
M modules/ui/ConstraintReportPanel.js
M modules/ui/ConstraintReportPanel.less
2 files changed, 19 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/75/389775/1

diff --git a/modules/ui/ConstraintReportPanel.js 
b/modules/ui/ConstraintReportPanel.js
index 36fc9ba..5dd8b5f 100644
--- a/modules/ui/ConstraintReportPanel.js
+++ b/modules/ui/ConstraintReportPanel.js
@@ -26,14 +26,17 @@
         * @cfg {string} status The status of the report, e.g. 'violation' or 
'compliance'.
         * @cfg {Object} constraint The constraint of the report, as returned 
by the wbcheckconstraints API.
         * @cfg {string} [message=''] The message (HTML) of the report, if 
present.
+        * @cfg {string[]} [ancillaryMessages=[]] Additional messages (HTML) 
attached to the report, if any.
         * @cfg {jQuery} [$heading] The heading element of the panel. Should 
not contain the help link.
         * @cfg {jQuery} [$helpLink] The help link for the heading.
         * @cfg {jQuery} [$message] The message paragraph of the panel.
+        * @cfg {jQuery} [$ancillaryMessages] The container of the additional 
messages.
         */
        wb.quality.constraints.ui.ConstraintReportPanel = function 
WBQCConstraintReportPanel( config ) {
                // Configuration initialization
                config = $.extend( {
-                       message: ''
+                       message: '',
+                       ancillaryMessages: []
                }, config );
                config.expanded = false;
 
@@ -61,6 +64,12 @@
                );
                this.message = config.message;
                this.$message = config.$message || $( '<p>' ).html( 
this.message );
+               this.ancillaryMessages = config.ancillaryMessages;
+               this.$ancillaryMessages = config.$ancillaryMessages || $( '<div 
class="wbqc-ancillary-messages">' ).append(
+                       this.ancillaryMessages.map( function( ancillaryMessage 
) {
+                               return $( '<p>' ).html( ancillaryMessage )
+                       } )
+               );
 
                // Events
                // (none)
@@ -72,6 +81,7 @@
                this.$heading.append( this.$helpLink );
                this.$element.append( this.$heading );
                this.$element.append( this.$message );
+               this.$element.append( this.$ancillaryMessages );
        };
 
        /* Setup */
diff --git a/modules/ui/ConstraintReportPanel.less 
b/modules/ui/ConstraintReportPanel.less
index ea1755f..78da6d9 100644
--- a/modules/ui/ConstraintReportPanel.less
+++ b/modules/ui/ConstraintReportPanel.less
@@ -1,3 +1,5 @@
+@import 'mediawiki.ui/variables';
+
 .wbqc-report {
        h4:first-child + p {
                margin-top: 0;
@@ -9,4 +11,10 @@
                margin-left: 1.5em;
                margin-right: 0.5em;
        }
+
+       .wbqc-ancillary-messages {
+               font-style: italic;
+               font-size: 90%;
+               color: @colorTextLight;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/389775
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic194c64470487391b2f81c58bc332c8268f1e0c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to