Dominic.sauer has submitted this change and it was merged. Change subject: Added icons and CSS classes for UI ......................................................................
Added icons and CSS classes for UI Change-Id: Ifd93c63b50dfe01432b5679fc9535ab926af930f --- M modules/ext.WikibaseQuality.UiScript.css M modules/ext.WikibaseQuality.UiScript.js A resources/images/ok_angle_arrow.png A resources/images/ok_arrow.png A resources/images/ok_arrows.png A resources/images/ok_brackets.png A resources/images/ok_bubbles.png A resources/images/ok_commons.png A resources/images/ok_double_arrow.png A resources/images/ok_greater_one.png A resources/images/ok_not_equal.png A resources/images/ok_one.png A resources/images/ok_regex.png A resources/images/ok_x.png A resources/images/severe_angle_arrow.png A resources/images/severe_arrow.png A resources/images/severe_brackets.png A resources/images/severe_bubbles.png A resources/images/severe_commons.png A resources/images/severe_double_arrow.png A resources/images/severe_greater_one.png A resources/images/severe_not_equal.png A resources/images/severe_one.png A resources/images/severe_regex.png A resources/images/severe_x.png 25 files changed, 178 insertions(+), 71 deletions(-) Approvals: Dominic.sauer: Verified; Looks good to me, approved diff --git a/modules/ext.WikibaseQuality.UiScript.css b/modules/ext.WikibaseQuality.UiScript.css index 4ad2751..b9f90d8 100755 --- a/modules/ext.WikibaseQuality.UiScript.css +++ b/modules/ext.WikibaseQuality.UiScript.css @@ -1,25 +1,132 @@ .wb-indicator { - margin-left: 5px; + margin-left: 5px; } .wbq-expandable-content { - color: #333; - display: none; - margin-top: 16px; - padding-left: 16px; + color: #333; + display: none; + margin-top: 16px; + padding-left: 16px; } .wbq-long-message-headline { - font-weight: bold; + font-weight: bold; } .wbq-container-mark-as-exception { - float: right; - margin-top: 8px; + float: right; + margin-top: 8px; } /** Icons **/ -.wbq-icon-external-validation { - background: url(../resources/images/severe_arrows.png); - background-size: 18px; + +.wbq-icon { + padding: 0px 1px 18px 18px; + background-size: 18px !important; + background-repeat: no-repeat !important; + margin-left: 0.5em !important; +} + +.wbq-icon-angle-arrow { + background: url(../resources/images/ok_angle_arrow.png); +} + +.wbq-icon-angle-arrow-severe { + background: url(../resources/images/severe_angle_arrow.png); +} + +.wbq-icon-arrow { + background: url(../resources/images/ok_arrow.png); +} + +.wbq-icon-arrow-severe { + background: url(../resources/images/severe_arrow.png); +} + +.wbq-icon-arrows { + background: url(../resources/images/ok_arrows.png); +} + +.wbq-icon-arrows-severe { + background: url(../resources/images/severe_arrows.png); +} + +.wbq-icon-brackets { + background: url(../resources/images/ok_brackets.png); +} + +.wbq-icon-brackets-severe { + background: url(../resources/images/severe_brackets.png); +} + +.wbq-icon-bubbles { + background: url(../resources/images/ok_bubbles.png); +} + +.wbq-icon-bubbles-severe { + background: url(../resources/images/severe_bubbles.png); +} + +.wbq-icon-commons { + background: url(../resources/images/ok_commons.png); +} + +.wbq-icon-commons-severe { + background: url(../resources/images/severe_commons.png); +} + +.wbq-icon-commons { + background: url(../resources/images/ok_commons.png); +} + +.wbq-icon-commons-severe { + background: url(../resources/images/severe_commons.png); +} + +.wbq-icon-double-arrow { + background: url(../resources/images/ok_double_arrow.png); +} + +.wbq-icon-double-arrow-severe { + background: url(../resources/images/severe_double_arrow.png); +} + +.wbq-icon-greater-one { + background: url(../resources/images/ok_greater_one.png); +} + +.wbq-icon-greater-one-severe { + background: url(../resources/images/severe_greater_one.png); +} + +.wbq-icon-not-equal { + background: url(../resources/images/ok_not_equal.png); +} + +.wbq-icon-not-equal-severe { + background: url(../resources/images/severe_not_equal.png); +} + +.wbq-icon-one { + background: url(../resources/images/ok_one.png); +} + +.wbq-icon-one-severe { + background: url(../resources/images/severe_one.png); +} + +.wbq-icon-regex { + background: url(../resources/images/ok_regex.png); +} + +.wbq-icon-regex-severe { + background: url(../resources/images/severe_regex.png); +} + +.wbq-icon-x { + background: url(../resources/images/ok_x.png); +} + +.wbq-icon-x-severe { + background: url(../resources/images/severe_x.png); } \ No newline at end of file diff --git a/modules/ext.WikibaseQuality.UiScript.js b/modules/ext.WikibaseQuality.UiScript.js index 77fffdb..89f19da 100755 --- a/modules/ext.WikibaseQuality.UiScript.js +++ b/modules/ext.WikibaseQuality.UiScript.js @@ -8,86 +8,86 @@ ( function( $, mw ) { - 'use strict'; + 'use strict'; - if ( !mw.config.exists( 'wbEntityId' ) ) { - return; - } + if ( !mw.config.exists( 'wbEntityId' ) ) { + return; + } - $( '.wikibase-snakview-value' ).append( '<span class="wb-indicator"></span>' ); + $( '.wikibase-snakview-value' ).append( '<span class="wb-indicator"></span>' ); - var request_violations_data = { - action: 'wbqgetviolationmessages', - entityId: mw.config.get( 'wbEntityId' ), - format: 'json' - }; + var request_violations_data = { + action: 'wbqgetviolationmessages', + entityid: mw.config.get( 'wbEntityId' ), + format: 'json' + }; - mw.loader.using( 'mediawiki.api', function () { - var api = ( new mw.Api() ); - api.get( request_violations_data ).done( function ( response ) { + mw.loader.using( 'mediawiki.api', function () { + var api = ( new mw.Api() ); + api.get( request_violations_data ).done( function ( response ) { - $( ':wikibase-statementview' ).each( function() { + $( ':wikibase-statementview' ).each( function() { - var claim_guid = $( this ).data( 'statementview' ).value().getClaim().getGuid(); - var response_claim_base = response["results"][claim_guid] - if ( response_claim_base == undefined ) { - return; - } + var claim_guid = $( this ).data( 'statementview' ).value().getClaim().getGuid(); + var response_claim_base = response["results"][claim_guid] + if ( response_claim_base == undefined ) { + return; + } - var indicator_anchor = $( ".wikibase-statement-" + claim_guid.replace( '$', '\\$' ) ).find( '.wb-indicator:first' ); + var indicator_anchor = $( ".wikibase-statement-" + claim_guid.replace( '$', '\\$' ) ).find( '.wb-indicator:first' ); - for ( var index in response_claim_base ) { - appendViolationInformation( api, claim_guid, response_claim_base, index, indicator_anchor ); - } - } ); - } ); - } ); - + for ( var index in response_claim_base ) { + appendViolationInformation( api, claim_guid, response_claim_base, index, indicator_anchor ); + } + } ); + } ); + } ); + }( jQuery, mediaWiki ) ); function appendViolationInformation( api, claim_guid, response, index, anchor ) { - var claim_guid_index = claim_guid + '_' + index; - var response_claim_index_base = response[index]; - var short_message = response_claim_index_base['shortMessageHtml']; - var icon_class = response_claim_index_base['iconClass']; - var long_message = response_claim_index_base['longMessageHtml']; - var modify_exception_data = { - action: 'wbqmodifyviolation', - claimGuid: claim_guid, - constraintId: response_claim_index_base['constraintId'], - status: 'exception', - format: 'json' - }; + var claim_guid_index = claim_guid + '_' + index; + var response_claim_index_base = response[index]; + var short_message = response_claim_index_base['shortMessageHtml']; + var icon_class = response_claim_index_base['iconClass']; + var long_message = response_claim_index_base['longMessageHtml']; + var modify_exception_data = { + action: 'wbqmodifyviolation', + claimGuid: claim_guid, + constraintId: response_claim_index_base['constraintId'], + status: 'exception', + format: 'json' + }; - appendIconToClaim( claim_guid_index, anchor, short_message, icon_class ); - appendMessageToClaim( api, claim_guid_index, anchor, long_message, modify_exception_data ); + appendIconToClaim( claim_guid_index, anchor, short_message, icon_class ); + appendMessageToClaim( api, claim_guid_index, anchor, long_message, modify_exception_data ); } function appendIconToClaim( claim_guid_index, anchor, hover_content, icon_class ) { - // TODO add alt - var img_violation = '<img src="" id="wbq-violation-img-' + claim_guid_index + '" class="' + icon_class + '" style="padding: 18px 18px 0px 0px; width:0px; height: 0px;" />'; - $( img_violation ).appendTo( anchor ).wbtooltip( { - content: hover_content - } ); + // TODO add alt + var img_violation = '<span id="wbq-violation-img-' + claim_guid_index + '" class="wbq-icon ' + icon_class + '"/>'; + $( img_violation ).appendTo( anchor ).wbtooltip( { + content: hover_content + } ); - $( '#wbq-violation-img-' + claim_guid_index.replace( '$', '\\$' ) ).on('click', function(){ - $( this ).closest( 'div' ).find( '#wbq-violation-msg-' + claim_guid_index.replace( '$', '\\$' ) ).slideToggle( 'fast') - }); + $( '#wbq-violation-img-' + claim_guid_index.replace( '$', '\\$' ) ).on('click', function(){ + $( this ).closest( 'div' ).find( '#wbq-violation-msg-' + claim_guid_index.replace( '$', '\\$' ) ).slideToggle( 'fast') + }); } function appendMessageToClaim( api, claim_guid_index, anchor, content, modify_exception_data ) { - var div_msg = '<div class="wbq-expandable-content" id="wbq-violation-msg-' + claim_guid_index + '">' + content + '</div>'; - $( div_msg ).appendTo( anchor.parent().closest( 'div' ) ); - anchor.parent().find( '.wbq-mark-as-exception' ).confirmable( { - handler: function ( e ) { - e.preventDefault(); - api.postWithEditToken( modify_exception_data ).done( function () { - anchor.parent().find( '#wbq-violation-msg-' + claim_guid_index.replace('$', '\\$') ).remove(); - anchor.find( '#wbq-violation-img-' + claim_guid_index.replace('$', '\\$') ).remove(); - } ); - } - } ); + var div_msg = '<div class="wbq-expandable-content" id="wbq-violation-msg-' + claim_guid_index + '">' + content + '</div>'; + $( div_msg ).appendTo( anchor.parent().closest( 'div' ) ); + anchor.parent().find( '.wbq-mark-as-exception' ).confirmable( { + handler: function ( e ) { + e.preventDefault(); + api.postWithEditToken( modify_exception_data ).done( function () { + anchor.parent().find( '#wbq-violation-msg-' + claim_guid_index.replace('$', '\\$') ).remove(); + anchor.find( '#wbq-violation-img-' + claim_guid_index.replace('$', '\\$') ).remove(); + } ); + } + } ); } diff --git a/resources/images/ok_angle_arrow.png b/resources/images/ok_angle_arrow.png new file mode 100644 index 0000000..2e256f9 --- /dev/null +++ b/resources/images/ok_angle_arrow.png Binary files differ diff --git a/resources/images/ok_arrow.png b/resources/images/ok_arrow.png new file mode 100644 index 0000000..f36cab8 --- /dev/null +++ b/resources/images/ok_arrow.png Binary files differ diff --git a/resources/images/ok_arrows.png b/resources/images/ok_arrows.png new file mode 100644 index 0000000..ebfd3d7 --- /dev/null +++ b/resources/images/ok_arrows.png Binary files differ diff --git a/resources/images/ok_brackets.png b/resources/images/ok_brackets.png new file mode 100644 index 0000000..2305d03 --- /dev/null +++ b/resources/images/ok_brackets.png Binary files differ diff --git a/resources/images/ok_bubbles.png b/resources/images/ok_bubbles.png new file mode 100644 index 0000000..40d3b2e --- /dev/null +++ b/resources/images/ok_bubbles.png Binary files differ diff --git a/resources/images/ok_commons.png b/resources/images/ok_commons.png new file mode 100644 index 0000000..c1fdb5c --- /dev/null +++ b/resources/images/ok_commons.png Binary files differ diff --git a/resources/images/ok_double_arrow.png b/resources/images/ok_double_arrow.png new file mode 100644 index 0000000..c0f3338 --- /dev/null +++ b/resources/images/ok_double_arrow.png Binary files differ diff --git a/resources/images/ok_greater_one.png b/resources/images/ok_greater_one.png new file mode 100644 index 0000000..10d7085 --- /dev/null +++ b/resources/images/ok_greater_one.png Binary files differ diff --git a/resources/images/ok_not_equal.png b/resources/images/ok_not_equal.png new file mode 100644 index 0000000..b633f19 --- /dev/null +++ b/resources/images/ok_not_equal.png Binary files differ diff --git a/resources/images/ok_one.png b/resources/images/ok_one.png new file mode 100644 index 0000000..1c1bfdc --- /dev/null +++ b/resources/images/ok_one.png Binary files differ diff --git a/resources/images/ok_regex.png b/resources/images/ok_regex.png new file mode 100644 index 0000000..4145445 --- /dev/null +++ b/resources/images/ok_regex.png Binary files differ diff --git a/resources/images/ok_x.png b/resources/images/ok_x.png new file mode 100644 index 0000000..d47baba --- /dev/null +++ b/resources/images/ok_x.png Binary files differ diff --git a/resources/images/severe_angle_arrow.png b/resources/images/severe_angle_arrow.png new file mode 100644 index 0000000..04df3af --- /dev/null +++ b/resources/images/severe_angle_arrow.png Binary files differ diff --git a/resources/images/severe_arrow.png b/resources/images/severe_arrow.png new file mode 100644 index 0000000..338eebf --- /dev/null +++ b/resources/images/severe_arrow.png Binary files differ diff --git a/resources/images/severe_brackets.png b/resources/images/severe_brackets.png new file mode 100644 index 0000000..8153332 --- /dev/null +++ b/resources/images/severe_brackets.png Binary files differ diff --git a/resources/images/severe_bubbles.png b/resources/images/severe_bubbles.png new file mode 100644 index 0000000..f718103 --- /dev/null +++ b/resources/images/severe_bubbles.png Binary files differ diff --git a/resources/images/severe_commons.png b/resources/images/severe_commons.png new file mode 100644 index 0000000..bd9f939 --- /dev/null +++ b/resources/images/severe_commons.png Binary files differ diff --git a/resources/images/severe_double_arrow.png b/resources/images/severe_double_arrow.png new file mode 100644 index 0000000..bf0050f --- /dev/null +++ b/resources/images/severe_double_arrow.png Binary files differ diff --git a/resources/images/severe_greater_one.png b/resources/images/severe_greater_one.png new file mode 100644 index 0000000..1e07e23 --- /dev/null +++ b/resources/images/severe_greater_one.png Binary files differ diff --git a/resources/images/severe_not_equal.png b/resources/images/severe_not_equal.png new file mode 100644 index 0000000..32b27d6 --- /dev/null +++ b/resources/images/severe_not_equal.png Binary files differ diff --git a/resources/images/severe_one.png b/resources/images/severe_one.png new file mode 100644 index 0000000..2fdba75 --- /dev/null +++ b/resources/images/severe_one.png Binary files differ diff --git a/resources/images/severe_regex.png b/resources/images/severe_regex.png new file mode 100644 index 0000000..f023ac0 --- /dev/null +++ b/resources/images/severe_regex.png Binary files differ diff --git a/resources/images/severe_x.png b/resources/images/severe_x.png new file mode 100644 index 0000000..4492b85 --- /dev/null +++ b/resources/images/severe_x.png Binary files differ -- To view, visit https://gerrit.wikimedia.org/r/217470 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd93c63b50dfe01432b5679fc9535ab926af930f Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/WikidataQuality Gerrit-Branch: master Gerrit-Owner: Tamslo <tamaraslosa...@gmail.com> Gerrit-Reviewer: Dominic.sauer <dominic.sa...@yahoo.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits