Tacsipacsi has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/352434 )
Change subject: TranslateEditButtons: Migrate to OOjs UI
......................................................................
TranslateEditButtons: Migrate to OOjs UI
Added OOjs UI buttons to TranslateEditAddons::buttonHack()
when using OOUI to be consistent with the rest of the buttons.
Change-Id: I63c3a3115f8c77d45c976f062a7248f5a4bc88cb
---
M TranslateEditAddons.php
1 file changed, 38 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/34/352434/1
diff --git a/TranslateEditAddons.php b/TranslateEditAddons.php
index 1a5a445..1befe85 100644
--- a/TranslateEditAddons.php
+++ b/TranslateEditAddons.php
@@ -111,17 +111,28 @@
if ( $handle->isDoc() ) {
$langCode = $context->getLanguage()->getCode();
$name = TranslateUtils::getLanguageName(
$handle->getCode(), $langCode );
- $accessKey = $context->msg( 'accesskey-save' )->plain();
- $temp = [
+ $attribs = [
'id' => 'wpSave',
'name' => 'wpSave',
- 'type' => 'submit',
'tabindex' => ++$tabindex,
- 'value' => $context->msg( 'translate-save',
$name )->text(),
- 'accesskey' => $accessKey,
- 'title' => $context->msg( 'tooltip-save'
)->text() . ' [' . $accessKey . ']',
- ];
- $buttons['save'] = Xml::element( 'input', $temp, '' );
+ ] + Linker::tooltipAndAccesskeyAttribs( 'save' );
+
+ if ( $editpage->isOouiEnabled() ) {
+ $saveConfig =
OOUI\Element::configFromHtmlAttributes( $attribs );
+ $buttons['save'] = new OOUI\ButtonInputWidget( [
+ // Support: IE 6 – Use <input>,
otherwise it can't distinguish which button was clicked
+ 'useInputTag' => true,
+ 'flags' => [ 'constructive', 'primary'
],
+ 'label' => $context->msg(
'translate-save', $name )->text(),
+ 'type' => 'submit',
+ ] + $saveConfig );
+ } else {
+ $buttons['save'] = Html::submitButton(
+ $context->msg( 'translate-save', $name
)->text(),
+ $attribs,
+ [ 'mw-ui-progressive' ]
+ );
+ }
}
try {
@@ -129,18 +140,31 @@
} catch ( TranslationHelperException $e ) {
return true;
}
-
- $temp = [
+
+ $attribs = [
'id' => 'wpSupport',
'name' => 'wpSupport',
'type' => 'button',
'tabindex' => ++$tabindex,
- 'value' => $context->msg( 'translate-js-support'
)->text(),
'title' => $context->msg( 'translate-js-support-title'
)->text(),
- 'data-load-url' => $supportUrl,
- 'onclick' => "window.open(
jQuery(this).attr('data-load-url') );",
];
- $buttons['ask'] = Html::element( 'input', $temp, '' );
+
+ if ( $editpage->isOouiEnabled() ) {
+ $attribs += [
+ 'label' => $context->msg(
'translate-js-support' )->text(),
+ 'href' => $supportUrl,
+ 'target' => '_blank',
+ ];
+ $saveConfig = OOUI\Element::configFromHtmlAttributes(
$attribs );
+ $buttons['ask'] = new OOUI\ButtonWidget( $saveConfig );
+ } else {
+ $attribs += [
+ 'value' => $context->msg(
'translate-js-support' )->text(),
+ 'data-load-url' => $supportUrl,
+ 'onclick' => "window.open( $( this ).data(
'load-url' ) );",
+ ];
+ $buttons['ask'] = Html::element( 'input', $attribs );
+ }
return true;
}
--
To view, visit https://gerrit.wikimedia.org/r/352434
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63c3a3115f8c77d45c976f062a7248f5a4bc88cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Tacsipacsi <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits