[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Do not hide the toast for the blocked message

2017-06-14 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354026 )

Change subject: Do not hide the toast for the blocked message
..


Do not hide the toast for the blocked message

This also implements a way for users of the toast module to pass
further options to the mw.notify function, if needed.

Bug: T165513
Change-Id: If31bee9e6d686b311853ba2b37ea4136564ed72c
---
M resources/mobile.startup/toast.js
M resources/skins.minerva.editor/init.js
2 files changed, 20 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jdlrobson: Looks good to me, approved



diff --git a/resources/mobile.startup/toast.js 
b/resources/mobile.startup/toast.js
index be4c083..b402782 100644
--- a/resources/mobile.startup/toast.js
+++ b/resources/mobile.startup/toast.js
@@ -15,13 +15,24 @@
 * Show a message with the given class in a toast.
 * @method
 * @param {string} msg Message to show in the toast
-* @param {string} cssClass CSS class to add to the element
+* @param {Object} options CSS class to add to the element if a string. 
If an object, more options for the
+*  notification, see mw.notification.show. For backwards compatibility 
reasons if a string is given it will be
+*  treated as options.type
 */
-   Toast.prototype.show = function ( msg, cssClass ) {
-   this.notification = mw.notify( msg, {
-   type: cssClass,
+   Toast.prototype.show = function ( msg, options ) {
+   if ( typeof options === 'string' ) {
+   mw.log.warn( 'The use of the cssClass parameter of 
Toast.show is deprecated, please convert it to an ' +
+   'options object.' );
+   options = {
+   type: options
+   };
+   }
+
+   options = $.extend( {
tag: 'toast'
-   } );
+   }, options );
+
+   this.notification = mw.notify( msg, options );
};
 
/**
diff --git a/resources/skins.minerva.editor/init.js 
b/resources/skins.minerva.editor/init.js
index 408b144..ac589dd 100644
--- a/resources/skins.minerva.editor/init.js
+++ b/resources/skins.minerva.editor/init.js
@@ -288,7 +288,10 @@

'mobile-frontend-editor-blocked-info-loggedin',
blockInfo.blockReason,
blockInfo.blockedBy
-   )
+   ),
+   {
+   autoHide: false
+   }
);
ev.preventDefault();
} );

-- 
To view, visit https://gerrit.wikimedia.org/r/354026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If31bee9e6d686b311853ba2b37ea4136564ed72c
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow 
Gerrit-Reviewer: Florianschmidtwelzow 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Do not hide the toast for the blocked message

2017-05-16 Thread Florianschmidtwelzow (Code Review)
Florianschmidtwelzow has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354026 )

Change subject: Do not hide the toast for the blocked message
..

Do not hide the toast for the blocked message

This also implements a way for users of the toast module to pass
further options to the mw.notify function, if needed.

Bug: T165513
Change-Id: If31bee9e6d686b311853ba2b37ea4136564ed72c
---
M resources/mobile.startup/toast.js
M resources/skins.minerva.editor/init.js
2 files changed, 12 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/26/354026/1

diff --git a/resources/mobile.startup/toast.js 
b/resources/mobile.startup/toast.js
index be4c083..adf8ccb 100644
--- a/resources/mobile.startup/toast.js
+++ b/resources/mobile.startup/toast.js
@@ -16,12 +16,16 @@
 * @method
 * @param {string} msg Message to show in the toast
 * @param {string} cssClass CSS class to add to the element
+* @param {object} options More options for the notification, see 
{@link mw.notification.show}
 */
-   Toast.prototype.show = function ( msg, cssClass ) {
-   this.notification = mw.notify( msg, {
+   Toast.prototype.show = function ( msg, cssClass, options ) {
+   options = $.extend( {
type: cssClass,
tag: 'toast'
-   } );
+   }, options );
+
+   console.log(options);
+   this.notification = mw.notify( msg, options );
};
 
/**
diff --git a/resources/skins.minerva.editor/init.js 
b/resources/skins.minerva.editor/init.js
index 408b144..16e3f9f 100644
--- a/resources/skins.minerva.editor/init.js
+++ b/resources/skins.minerva.editor/init.js
@@ -288,7 +288,11 @@

'mobile-frontend-editor-blocked-info-loggedin',
blockInfo.blockReason,
blockInfo.blockedBy
-   )
+   ),
+   '',
+   {
+   autoHide: false
+   }
);
ev.preventDefault();
} );

-- 
To view, visit https://gerrit.wikimedia.org/r/354026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If31bee9e6d686b311853ba2b37ea4136564ed72c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits