Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/260547
Change subject: Add support for warning messages ...................................................................... Add support for warning messages We used to have only error and success. But the message about page already existing are warnings. Change-Id: Ib882cfda33851ae8728db05f2cde87f546f5b0d3 --- M modules/header/ext.cx.header.js M modules/header/styles/ext.cx.header.less 2 files changed, 18 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/47/260547/1 diff --git a/modules/header/ext.cx.header.js b/modules/header/ext.cx.header.js index 489338d..c0f3e38 100644 --- a/modules/header/ext.cx.header.js +++ b/modules/header/ext.cx.header.js @@ -76,6 +76,15 @@ }; /** + * Show a warning message in the info bar. + * + * @param {mediawiki.Message|string} message Message objects are parsed, strings are plain text. + */ + ContentTranslationHeader.prototype.showWarning = function ( message ) { + this.showMessage( 'cx-warning', message ); + }; + + /** * Show an error message in the info bar. * TODO: This error handling and display deserve its own module. Header module is inappropriate. * @@ -107,7 +116,7 @@ this.$infoBar.find( '.details' ).empty().hide(); } this.$infoBar - .removeClass( 'cx-success cx-error' ) + .removeClass( 'cx-success cx-error cx-warning' ) .addClass( type ) .show(); }; @@ -132,7 +141,7 @@ return; } - mw.hook( 'mw.cx.error' ).fire( mw.message( + mw.hook( 'mw.cx.warning' ).fire( mw.message( 'cx-translation-target-page-exists', viewTargetUrl, mw.cx.targetTitle @@ -152,6 +161,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.warning' ).add( $.proxy( this.showWarning, this ) ); mw.hook( 'mw.cx.success' ).add( $.proxy( this.showSuccess, this ) ); mw.hook( 'mw.cx.error.anonuser' ).add( $.proxy( this.showLoginMessage, this ) ); mw.hook( 'mw.cx.translation.ready' ).add( $.proxy( this.checkTargetTitle, this ) ); diff --git a/modules/header/styles/ext.cx.header.less b/modules/header/styles/ext.cx.header.less index 23f46b4..7d19f2f 100644 --- a/modules/header/styles/ext.cx.header.less +++ b/modules/header/styles/ext.cx.header.less @@ -86,6 +86,12 @@ background-color: #e1fddf; } + &.cx-warning { + color: #705000; + border-color: #fde29b; + background-color: #fdf1d1; + } + border-bottom: 1px solid #ddd; font-size: large; -- To view, visit https://gerrit.wikimedia.org/r/260547 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib882cfda33851ae8728db05f2cde87f546f5b0d3 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