Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/146048
Change subject: Success and error indicators for publishing ...................................................................... Success and error indicators for publishing Updated as per UX design. Shows a banner below the header Change-Id: Iefb9656b1c219e3e145f4e87bdbc168318f90212 --- M modules/header/ext.cx.header.js M modules/header/styles/ext.cx.header.less M modules/translation/ext.cx.publish.js 3 files changed, 26 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/48/146048/1 diff --git a/modules/header/ext.cx.header.js b/modules/header/ext.cx.header.js index 96fa7da..5fd79ae 100644 --- a/modules/header/ext.cx.header.js +++ b/modules/header/ext.cx.header.js @@ -40,9 +40,24 @@ * Show error message * @param {string} message */ + ContentTranslationHeader.prototype.showSuccess = function ( message ) { + this.$infoBar + .show() + .removeClass( 'cx-error' ) + .addClass( 'cx-success' ) + .find( '.text' ) + .html( message ); + }; + + /** + * Show error message + * @param {string} message + */ ContentTranslationHeader.prototype.showError = function ( message ) { this.$infoBar .show() + .removeClass( 'cx-success' ) + .addClass( 'cx-error' ) .find( '.text' ) .text( message ); }; @@ -57,6 +72,7 @@ } ); mw.hook( 'mw.cx.progress' ).add( $.proxy( this.setPublishButtonState, this ) ); mw.hook( 'mw.cx.error' ).add( $.proxy( this.showError, this ) ); + mw.hook( 'mw.cx.success' ).add( $.proxy( this.showSuccess, this ) ); }; $.fn.cxHeader = function ( options ) { diff --git a/modules/header/styles/ext.cx.header.less b/modules/header/styles/ext.cx.header.less index 6caba3c..bd282b9 100644 --- a/modules/header/styles/ext.cx.header.less +++ b/modules/header/styles/ext.cx.header.less @@ -44,7 +44,13 @@ .mw-ui-item; .mw-ui-one-whole; padding: 10px; - background-color: #F7D358; + &.cx-error { + background-color: #F7D358; + } + &.cx-success { + border: 1px solid #00af89; + background-color: #fff; + } border-bottom: 1px solid #ddd; font-size: large; .remove { diff --git a/modules/translation/ext.cx.publish.js b/modules/translation/ext.cx.publish.js index 985c15b..11c5818 100644 --- a/modules/translation/ext.cx.publish.js +++ b/modules/translation/ext.cx.publish.js @@ -49,15 +49,14 @@ translatedTitle = 'User:' + mw.user.getName() + '/' + translatedTitle; publishTranslation( translatedTitle, translatedContent, mw.cx.sourceTitle ) .done( function () { - mw.notify( $( '<p>' ).html( mw.message( 'cx-publish-page', - mw.util.getUrl( translatedTitle ), translatedTitle ).parse() ) ); - + mw.hook( 'mw.cx.success' ).fire( mw.message( 'cx-publish-page', + mw.util.getUrl( translatedTitle ), translatedTitle ).parse() ); mw.hook( 'mw.cx.translate.create' ).fire( mw.cx.sourceLanguage, mw.cx.targetLanguage ); } ).fail( function () { - mw.notify( mw.msg( 'cx-publish-page-error' ) ); + mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' ) ); } ).always( function () { $publishButton.prop( 'disabled', false ) .text( mw.msg( 'cx-publish-button' ) ); -- To view, visit https://gerrit.wikimedia.org/r/146048 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iefb9656b1c219e3e145f4e87bdbc168318f90212 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