Merge "Add icon and link to qualtric survey if $wgPopupsSurveyLink is defined"

This commit is contained in:
jenkins-bot 2015-04-06 09:03:26 +00:00 committed by Gerrit Code Review
commit 7fe8f5d45f
14 changed files with 95 additions and 23 deletions

View file

@ -94,6 +94,7 @@ class PopupsHooks {
"popups-settings-enable",
"popups-settings-help",
"popups-settings-help-ok",
"popups-send-feedback",
),
'remoteExtPath' => 'Popups',
'localBasePath' => __DIR__,
@ -128,4 +129,12 @@ class PopupsHooks {
);
return true;
}
/**
* @param array $vars
*/
public static function onResourceLoaderGetConfigVars( array &$vars ) {
$conf = ConfigFactory::getDefaultInstance()->makeConfig( 'popups' );
$vars['wgPopupsSurveyLink'] = $conf->get( 'PopupsSurveyLink' );
}
}

View file

@ -33,6 +33,9 @@ $wgExtensionCredits['betafeatures'][] = array(
'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['GetBetaFeaturePreferences'][] = 'PopupsHooks::getPreferences';
$wgHooks['BeforePageDisplay'][] = 'PopupsHooks::onBeforePageDisplay';
$wgHooks['ResourceLoaderTestModules'][] = 'PopupsHooks::onResourceLoaderTestModules';
$wgHooks['EventLoggingRegisterSchemas'][] = 'PopupsHooks::onEventLoggingRegisterSchemas';
$wgHooks[ 'ResourceLoaderRegisterModules' ][] = 'PopupsHooks::onResourceLoaderRegisterModules';
$wgHooks['ResourceLoaderRegisterModules'][] = 'PopupsHooks::onResourceLoaderRegisterModules';
$wgHooks['ResourceLoaderGetConfigVars'][] = 'PopupsHooks::onResourceLoaderGetConfigVars';

View file

@ -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"
}

View file

@ -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"
}

BIN
resources/cog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

10
resources/cog.svg Normal file
View file

@ -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>

After

Width:  |  Height:  |  Size: 921 B

View file

@ -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" );
}
}

View file

@ -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>' )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

View file

@ -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>

Before

Width:  |  Height:  |  Size: 991 B

BIN
resources/horn-ltr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

10
resources/horn-ltr.svg Normal file
View file

@ -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>

After

Width:  |  Height:  |  Size: 634 B

BIN
resources/horn-rtl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

10
resources/horn-rtl.svg Normal file
View file

@ -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>

After

Width:  |  Height:  |  Size: 638 B