Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/107117
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, 49 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/17/107117/1 diff --git a/Resources.php b/Resources.php index 16173ef..8de7a4a 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; \ No newline at end of file diff --git a/modules/base/ext.cx.base.js b/modules/base/ext.cx.base.js index 3bb81eb..898da6b 100644 --- a/modules/base/ext.cx.base.js +++ b/modules/base/ext.cx.base.js @@ -11,6 +11,7 @@ ( function ( $ ) { 'use strict'; + mw.cx = mw.cx || {}; /** * ContentTranslation * diff --git a/modules/header/ext.cx.header.js b/modules/header/ext.cx.header.js index 0cc3380..6823cd5 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( 'button.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: newchange Gerrit-Change-Id: I677d4bba498d0724785f2dd2b8a615219d8ff69d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits