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

Change subject: Rework constraint report widget
......................................................................

Rework constraint report widget

- Remove the status, since it could only ever be “violation” anyways.
- Turn the constraint type into a headline (suggested by Jonas).
- Make the message the main body of the report, without a “Message: ”
  prefix (suggested by Jonas).
- Add the detailHTML in small print (suggested by Jonas). (The user
  script previously referred to an old name of the field, detailMessage,
  from an earlier version of Change 341521.)
- Build the whole report using jQuery instead of concatenating HTML
  snippets.

Collectively, these changes also get rid of all non-localized English
strings in the report (“Status”, “Message”, “Constraint”).

Change-Id: I17d5bebb0f9327d7e6c2e460ab2a9eb75081d9ed
---
M docs/user.js
1 file changed, 12 insertions(+), 6 deletions(-)


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

diff --git a/docs/user.js b/docs/user.js
index 3e87048..213ed20 100644
--- a/docs/user.js
+++ b/docs/user.js
@@ -26,13 +26,19 @@
        function buildReport( result ) {
                var report;
                if ( result.status === 'violation' ) {
-                       report = 'Status: ' + result.status;
+                       var report = $( '<div>' );
+                       report.append(
+                               $( '<h5>' ).text( result.constraint.type )
+                       );
                        if ( result[ 'message-html' ] ) {
-                               report += '<br>Message: ' + result[ 
'message-html' ];
+                               report.append(
+                                       $( '<p>' ).html( result[ 'message-html' 
] )
+                               )
                        }
-                       report += '<br>Constraint: ' + result.constraint.type;
-                       if ( result.constraint.detailMessage ) {
-                               report += '<br>' + 
result.constraint.detailMessage;
+                       if ( result.constraint.detailHTML ) {
+                               report.append( $( '<p>' ).append (
+                                       $( '<small>' ).html( 
result.constraint.detailHTML )
+                               ) );
                        }
                        return new OO.ui.PanelLayout( {
                                expanded: false,
@@ -40,7 +46,7 @@
                                padded: true,
                                $content: $( '<div>' )
                                        .addClass( 'wbqc-report' )
-                                       .html( report )
+                                       .append( report )
                        } ).$element;
                } else {
                        return null;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I17d5bebb0f9327d7e6c2e460ab2a9eb75081d9ed
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