jenkins-bot has submitted this change and it was merged. Change subject: Publish button and place holder handler ......................................................................
Publish button and place holder handler Change-Id: I677d4bba498d0724785f2dd2b8a615219d8ff69d --- M Resources.php M modules/base/ext.cx.base.js M modules/header/ext.cx.header.js M modules/header/styles/ext.cx.header.less A modules/translation/ext.cx.publish.js 5 files changed, 51 insertions(+), 6 deletions(-) Approvals: Amire80: Looks good to me, approved jenkins-bot: Verified diff --git a/Resources.php b/Resources.php index 16173ef..8d175bc 100644 --- a/Resources.php +++ b/Resources.php @@ -35,6 +35,7 @@ ), 'dependencies' => array( 'ext.cx.progressbar', + 'ext.cx.publish', ), ) + $resourcePaths; @@ -62,3 +63,7 @@ 'header/styles/ext.cx.progressbar.less', ), ) + $resourcePaths; + +$wgResourceModules['ext.cx.publish'] = array( + 'scripts' => 'translation/ext.cx.publish.js', +) + $resourcePaths; diff --git a/modules/base/ext.cx.base.js b/modules/base/ext.cx.base.js index 3bb81eb..b826108 100644 --- a/modules/base/ext.cx.base.js +++ b/modules/base/ext.cx.base.js @@ -8,9 +8,10 @@ * @copyright See AUTHORS.txt * @license GPL-2.0+ */ -( function ( $ ) { +( function ( $, mw ) { 'use strict'; + mw.cx = mw.cx || {}; /** * ContentTranslation * @@ -78,4 +79,4 @@ $( document ).ready( function () { $( 'body' ).cx(); } ); -}( jQuery ) ); +}( jQuery, mediaWiki ) ); diff --git a/modules/header/ext.cx.header.js b/modules/header/ext.cx.header.js index 63be384..ad86a83 100644 --- a/modules/header/ext.cx.header.js +++ b/modules/header/ext.cx.header.js @@ -8,7 +8,7 @@ * @copyright See AUTHORS.txt * @license GPL-2.0+ */ -( function ( $ ) { +( function ( $, mw ) { 'use strict'; /** @@ -24,6 +24,7 @@ ContentTranslationHeader.prototype.init = function () { this.render(); + this.listen(); }; ContentTranslationHeader.prototype.render = function () { @@ -44,11 +45,19 @@ ), $( '<div>' ) .addClass( 'translation-progress' ) - .cxProgressBar() + .cxProgressBar(), + $( '<button>' ) + .addClass( 'publish' ) + .text( 'Publish translation' ) ) ); }; + ContentTranslationHeader.prototype.listen = function () { + this.$container.find( '.publish' ).on( 'click', function () { + mw.hook( 'mw.cx.publish' ).fire(); + } ); + }; $.fn.cxHeader = function ( options ) { return this.each( function () { var $this = $( this ), @@ -68,4 +77,4 @@ }; $.fn.cxHeader.defaults = {}; -}( jQuery ) ); +}( jQuery, mediaWiki ) ); diff --git a/modules/header/styles/ext.cx.header.less b/modules/header/styles/ext.cx.header.less index 4705b12..f934238 100644 --- a/modules/header/styles/ext.cx.header.less +++ b/modules/header/styles/ext.cx.header.less @@ -31,7 +31,14 @@ .translation-progress { .mw-ui-item; - .mw-ui-one-third; + .mw-ui-one-sixth; + padding-bottom: 10px; + } + + .publish { + .mw-ui-item; + .mw-ui-one-eighth; + float: right; } } } diff --git a/modules/translation/ext.cx.publish.js b/modules/translation/ext.cx.publish.js new file mode 100644 index 0000000..cb2145c --- /dev/null +++ b/modules/translation/ext.cx.publish.js @@ -0,0 +1,23 @@ +/** + * ContentTranslation - Publish article + * A tool that allows editors to translate pages from one language + * to another with the help of machine translation and other translation aids + * + * @file + * @ingroup Extensions + * @copyright See AUTHORS.txt + * @license GPL-2.0+ + */ +( function ( $, mw ) { + 'use strict'; + mw.cx = mw.cx || {}; + + mw.cx.publish = function () { + // TODO: publish the article + mw.notify( 'Article published!' ); + }; + + $( function () { + mw.hook( 'mw.cx.publish' ).add( $.proxy( mw.cx.publish, this ) ); + } ); +}( jQuery, mediaWiki ) ); -- To view, visit https://gerrit.wikimedia.org/r/107117 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I677d4bba498d0724785f2dd2b8a615219d8ff69d Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits