mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-15 02:54:23 +00:00
Create mobile thanks using the mobile library
The thanks icon had styling issues as it didn't use the mobile icon and button fundamental components. The icon should also be inside the button, the element should not be both a button and an icon. Bug: T229440 Change-Id: I0136466fe1452f904961b89ae7677fc1a511adab
This commit is contained in:
parent
eae0f237df
commit
7a7f751b42
|
@ -65,7 +65,7 @@
|
||||||
"ResourceModules": {
|
"ResourceModules": {
|
||||||
"ext.thanks.images": {
|
"ext.thanks.images": {
|
||||||
"class": "ResourceLoaderImageModule",
|
"class": "ResourceLoaderImageModule",
|
||||||
"selector": ".mw-ui-icon-{name}:before",
|
"selector": ".mw-ui-icon-thanks-{name}:before",
|
||||||
"defaultColor": "#fff",
|
"defaultColor": "#fff",
|
||||||
"images": {
|
"images": {
|
||||||
"userTalk": {
|
"userTalk": {
|
||||||
|
@ -127,6 +127,7 @@
|
||||||
"thanks-thanked-notice"
|
"thanks-thanked-notice"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"mobile.startup",
|
||||||
"ext.thanks.images",
|
"ext.thanks.images",
|
||||||
"mediawiki.api",
|
"mediawiki.api",
|
||||||
"mediawiki.jqueryMsg",
|
"mediawiki.jqueryMsg",
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
( function () {
|
( function () {
|
||||||
// To allow users to cancel a thanks in the event of an accident, the action is delayed.
|
// To allow users to cancel a thanks in the event of an accident, the action is delayed.
|
||||||
var THANKS_DELAY = 2000,
|
var THANKS_DELAY = 2000,
|
||||||
|
mobile = mw.mobileFrontend.require( 'mobile.startup' ),
|
||||||
|
Button = mobile.Button,
|
||||||
|
Icon = mobile.Icon,
|
||||||
msgOptions = {
|
msgOptions = {
|
||||||
// tag ensures that only one message in workflow is shown at any time
|
// tag ensures that only one message in workflow is shown at any time
|
||||||
tag: 'thanks'
|
tag: 'thanks'
|
||||||
|
@ -59,9 +62,19 @@
|
||||||
*/
|
*/
|
||||||
function createThankLink( name, rev, gender ) {
|
function createThankLink( name, rev, gender ) {
|
||||||
var timeout,
|
var timeout,
|
||||||
$button = $( '<button>' ).addClass(
|
button = new Button( {
|
||||||
'mw-mf-action-button mw-ui-button mw-ui-progressive mw-ui-icon mw-ui-icon-before mw-ui-icon-userTalk'
|
progressive: true,
|
||||||
).text( mw.message( 'thanks-button-thank', mw.user, gender ).text() );
|
additionalClassNames: 'mw-mf-action-button'
|
||||||
|
} ),
|
||||||
|
$button = button.$el;
|
||||||
|
|
||||||
|
// append icon
|
||||||
|
new Icon( {
|
||||||
|
name: 'userTalk',
|
||||||
|
glyphPrefix: 'thanks',
|
||||||
|
hasText: true,
|
||||||
|
label: mw.message( 'thanks-button-thank', mw.user, gender ).text()
|
||||||
|
} ).$el.appendTo( $button );
|
||||||
|
|
||||||
// Don't make thank button for self
|
// Don't make thank button for self
|
||||||
if ( name === mw.config.get( 'wgUserName' ) ) {
|
if ( name === mw.config.get( 'wgUserName' ) ) {
|
||||||
|
|
Loading…
Reference in a new issue