jenkins-bot has submitted this change and it was merged. Change subject: Add icon and link to qualtric survey if $wgPopupsSurveyLink is defined ......................................................................
Add icon and link to qualtric survey if $wgPopupsSurveyLink is defined The link to the survey is added in Ic445732197e6abeba459b40b1416d8a71bc23bd6 Bug: T1005 Change-Id: I24bfd5fd622d1afc4372dbd4bfca3879927b0c17 --- M Popups.hooks.php M Popups.php M i18n/en.json M i18n/qqq.json A resources/cog.png A resources/cog.svg M resources/ext.popups.core.less M resources/ext.popups.renderer.article.js D resources/gear_gray.png D resources/gear_gray.svg A resources/horn-ltr.png A resources/horn-ltr.svg A resources/horn-rtl.png A resources/horn-rtl.svg 14 files changed, 95 insertions(+), 23 deletions(-) Approvals: Werdna: Looks good to me, approved jenkins-bot: Verified diff --git a/Popups.hooks.php b/Popups.hooks.php index 5880f34..2f0e4d2 100644 --- a/Popups.hooks.php +++ b/Popups.hooks.php @@ -94,6 +94,7 @@ "popups-settings-enable", "popups-settings-help", "popups-settings-help-ok", + "popups-send-feedback", ), 'remoteExtPath' => 'Popups', 'localBasePath' => __DIR__, @@ -128,4 +129,12 @@ ); return true; } + + /** + * @param array $vars + */ + public static function onResourceLoaderGetConfigVars( array &$vars ) { + $conf = ConfigFactory::getDefaultInstance()->makeConfig( 'popups' ); + $vars['wgPopupsSurveyLink'] = $conf->get( 'PopupsSurveyLink' ); + } } diff --git a/Popups.php b/Popups.php index 730c91f..f6d9cf3 100644 --- a/Popups.php +++ b/Popups.php @@ -33,6 +33,9 @@ 'license-name' => 'GPL-2.0+', ); +$wgPopupsSurveyLink = false; +$wgConfigRegistry['popups'] = 'GlobalVarConfig::newInstance'; + $wgAutoloadClasses['PopupsHooks'] = __DIR__ . '/Popups.hooks.php'; $wgMessagesDirs['Popups'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Popups'] = __DIR__ . '/Popups.i18n.php'; @@ -41,4 +44,5 @@ $wgHooks['BeforePageDisplay'][] = 'PopupsHooks::onBeforePageDisplay'; $wgHooks['ResourceLoaderTestModules'][] = 'PopupsHooks::onResourceLoaderTestModules'; $wgHooks['EventLoggingRegisterSchemas'][] = 'PopupsHooks::onEventLoggingRegisterSchemas'; -$wgHooks[ 'ResourceLoaderRegisterModules' ][] = 'PopupsHooks::onResourceLoaderRegisterModules'; \ No newline at end of file +$wgHooks['ResourceLoaderRegisterModules'][] = 'PopupsHooks::onResourceLoaderRegisterModules'; +$wgHooks['ResourceLoaderGetConfigVars'][] = 'PopupsHooks::onResourceLoaderGetConfigVars'; diff --git a/i18n/en.json b/i18n/en.json index 0b14cb1..01e398e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -18,5 +18,6 @@ "popups-settings-help-ok": "OK", "popups-settings-cancel": "Cancel", "popups-settings-help": "You can turn previews back on using a link in the footer of the page.", - "popups-settings-enable": "Enable previews" + "popups-settings-enable": "Enable previews", + "popups-send-feedback": "Send Feedback" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 84ba68b..e9d2b39 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -20,5 +20,6 @@ "popups-settings-save": "Save buttton for the setting's dialoag\n{{Identical|Save}}", "popups-settings-cancel": "Cancel button for the setting's dialog\n{{Identical|Cancel}}", "popups-settings-help": "Help text explaining how to re-enable previews", - "popups-settings-enable": "Link on the footer to enable hovercards if its disabled.\n\nSee also:\n* {{msg-mw|Popups-settings-option-off}}" + "popups-settings-enable": "Link on the footer to enable hovercards if its disabled.\n\nSee also:\n* {{msg-mw|Popups-settings-option-off}}", + "popups-send-feedback": "Tooltip for the send feedback icon on the hovercard" } diff --git a/resources/cog.png b/resources/cog.png new file mode 100644 index 0000000..c1242ac --- /dev/null +++ b/resources/cog.png Binary files differ diff --git a/resources/cog.svg b/resources/cog.svg new file mode 100644 index 0000000..8f1fb47 --- /dev/null +++ b/resources/cog.svg @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> +<path fill="#555555" d="M20,14.5v-2.9l-1.8-0.3c-0.1-0.4-0.3-0.8-0.6-1.4l1.1-1.5l-2.1-2.1l-1.5,1.1c-0.5-0.3-1-0.5-1.4-0.6L13.5,5h-2.9l-0.3,1.8 + C9.8,6.9,9.4,7.1,8.9,7.4L7.4,6.3L5.3,8.4l1,1.5c-0.3,0.5-0.4,0.9-0.6,1.4L4,11.5v2.9l1.8,0.3c0.1,0.5,0.3,0.9,0.6,1.4l-1,1.5 + l2.1,2.1l1.5-1c0.4,0.2,0.9,0.4,1.4,0.6l0.3,1.8h3l0.3-1.8c0.5-0.1,0.9-0.3,1.4-0.6l1.5,1.1l2.1-2.1l-1.1-1.5c0.3-0.5,0.5-1,0.6-1.4 + L20,14.5z M12,16c-1.7,0-3-1.3-3-3s1.3-3,3-3s3,1.3,3,3S13.7,16,12,16z"/> +</svg> diff --git a/resources/ext.popups.core.less b/resources/ext.popups.core.less index bb625f4..0e52ea7 100644 --- a/resources/ext.popups.core.less +++ b/resources/ext.popups.core.less @@ -98,14 +98,34 @@ color: #00af89; } - .mwe-popups-settings-icon { + .mwe-popups-icon { display: inline-block; - vertical-align: text-top; + vertical-align: middle; cursor: pointer; - margin-left: 5px; - height: 16px; - width: 16px; - .background-image-svg( "gear_gray.svg", "gear_gray.png" ); + margin: 0; + margin-top: -5px; + height: 24px; + width: 30px; + border-radius: 2px; + background-position: center center; + background-repeat: no-repeat; + background-size: 24px 24px; + + &:hover { + background-color: #eee; + } + + &:active { + background-color: #ccc; + } + } + + .mwe-popups-settings-icon { + .background-image-svg( "cog.svg", "cog.png" ); + } + + .mwe-popups-survey-icon { + .background-image-svg( "horn-ltr.svg", "horn-ltr.png" ); } } @@ -283,4 +303,4 @@ .mwe-popups-border-triangle-bottom( 8px, 10px, #bbb, 0px ); } } -} +} \ No newline at end of file diff --git a/resources/ext.popups.renderer.article.js b/resources/ext.popups.renderer.article.js index 728606b..0f6323f 100644 --- a/resources/ext.popups.renderer.article.js +++ b/resources/ext.popups.renderer.article.js @@ -25,6 +25,13 @@ pokeySize: 8 // Height of the triangle used to point at the link }; + + /** + * Survey link, if any, for this renderer + * @property surveyLink + */ + article.surveyLink = mw.config.get( 'wgPopupsSurveyLink' ); + /** * Send an API request and cache the jQuery element * @@ -112,14 +119,25 @@ timestampclass = ( timediff < oneDay ) ? 'mwe-popups-timestamp-recent' : 'mwe-popups-timestamp-older', - $settingsImage = $( '<a>' ).addClass( 'mwe-popups-settings-icon' ), + $settingsImage = $( '<a>' ).addClass( 'mwe-popups-icon mwe-popups-settings-icon' ), + $surveyImage, $timestamp = $( '<div>' ) .addClass( timestampclass ) .append( $( '<span>' ).text( mw.message( 'popups-last-edited', moment( timestamp ).fromNow() ).text() ), $settingsImage - ); + ); + + if ( article.surveyLink ) { + $surveyImage = $( '<a>' ) + .attr( 'href', article.surveyLink ) + .attr( 'target', '_blank' ) + .attr( 'title', mw.message( 'popups-send-feedback' ) ) + .addClass( 'mwe-popups-icon mwe-popups-survey-icon' ); + $timestamp.append( $surveyImage ); + } + if ( $thumbnail.prop( 'tagName' ) !== 'SPAN' ) { $thumbnail = $( '<a>' ) diff --git a/resources/gear_gray.png b/resources/gear_gray.png deleted file mode 100644 index a6ae346..0000000 --- a/resources/gear_gray.png +++ /dev/null Binary files differ diff --git a/resources/gear_gray.svg b/resources/gear_gray.svg deleted file mode 100644 index 2f44fd6..0000000 --- a/resources/gear_gray.svg +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" - viewBox="0 0 96 96" enable-background="new 0 0 96 96" xml:space="preserve"> -<path fill="#AAAAAA" d="M96,56.8V39.2l-10.8-1.8c-0.8-2.9-2-5.7-3.4-8.2l6.3-8.9L75.7,7.8l-8.9,6.3c-2.6-1.4-5.3-2.6-8.2-3.4L56.8,0 - H39.2l-1.8,10.8c-2.9,0.8-5.7,2-8.2,3.4l-8.9-6.3L7.8,20.3l6.3,8.9c-1.4,2.6-2.6,5.3-3.4,8.3L0,39.2v17.6l10.7,1.8 - c0.8,2.9,2,5.7,3.4,8.3l-6.3,8.9l12.4,12.4l8.9-6.3c2.6,1.4,5.3,2.6,8.3,3.4L39.2,96h17.6l1.8-10.8c2.9-0.8,5.7-2,8.2-3.4l8.9,6.3 - l12.4-12.4l-6.3-8.9c1.4-2.6,2.6-5.3,3.4-8.3L96,56.8z M48,66.4c-10.2,0-18.4-8.3-18.4-18.4c0-10.2,8.3-18.4,18.4-18.4 - S66.4,37.8,66.4,48C66.4,58.2,58.2,66.4,48,66.4z"/> -</svg> diff --git a/resources/horn-ltr.png b/resources/horn-ltr.png new file mode 100644 index 0000000..0f2e453 --- /dev/null +++ b/resources/horn-ltr.png Binary files differ diff --git a/resources/horn-ltr.svg b/resources/horn-ltr.svg new file mode 100644 index 0000000..92e0342 --- /dev/null +++ b/resources/horn-ltr.svg @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> +<g> + <path fill="#555555" d="M3,15l3,0.6V18c0,0.6,0.4,1,1,1h5c0.6,0,1-0.4,1-1v-1l5,1V7L3,11C2.6,11.5,2.6,14.4,3,15z M7,15.8l5,1v0.7 + c0,0.3-0.2,0.5-0.5,0.5h-4C7.2,18,7,17.8,7,17.5V15.8z"/> + <path fill="#555555" d="M20,10h-1v5h1c0.6,0,1-0.4,1-1v-3C21,10.4,20.6,10,20,10z"/> +</g> +</svg> diff --git a/resources/horn-rtl.png b/resources/horn-rtl.png new file mode 100644 index 0000000..9b76640 --- /dev/null +++ b/resources/horn-rtl.png Binary files differ diff --git a/resources/horn-rtl.svg b/resources/horn-rtl.svg new file mode 100644 index 0000000..7ab4a61 --- /dev/null +++ b/resources/horn-rtl.svg @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> +<g> + <path fill="#555555" d="M21,11L6,7v11l5-1v1c0,0.6,0.4,1,1,1h5c0.6,0,1-0.4,1-1v-2.4l3-0.6C21.4,14.4,21.4,11.5,21,11z M17,17.5 + c0,0.3-0.2,0.5-0.5,0.5h-4c-0.3,0-0.5-0.2-0.5-0.5v-0.7l5-1V17.5z"/> + <path fill="#555555" d="M3,11v3c0,0.6,0.4,1,1,1h1v-5H4C3.4,10,3,10.4,3,11z"/> +</g> +</svg> -- To view, visit https://gerrit.wikimedia.org/r/172486 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I24bfd5fd622d1afc4372dbd4bfca3879927b0c17 Gerrit-PatchSet: 9 Gerrit-Project: mediawiki/extensions/Popups Gerrit-Branch: master Gerrit-Owner: Prtksxna <psax...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Prtksxna <psax...@wikimedia.org> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: Werdna <agarr...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits