Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203884

Change subject: WIP: Truncate collection titles in toast
......................................................................

WIP: Truncate collection titles in toast

TODO: deal with alignment, inline styles
Bug: T93797
Change-Id: Ica09608a17ec871539f6d454677ddb39422a0451
---
M resources/ext.gather.collection.base/CollectionsContentOverlayBase.js
M resources/ext.gather.watchstar/CollectionsContentOverlay.js
2 files changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/84/203884/1

diff --git 
a/resources/ext.gather.collection.base/CollectionsContentOverlayBase.js 
b/resources/ext.gather.collection.base/CollectionsContentOverlayBase.js
index 33e95e8..d9c98da 100644
--- a/resources/ext.gather.collection.base/CollectionsContentOverlayBase.js
+++ b/resources/ext.gather.collection.base/CollectionsContentOverlayBase.js
@@ -1,6 +1,7 @@
 ( function ( M ) {
 
        var CollectionsContentOverlayBase,
+               toast = M.require( 'toast' ),
                ContentOverlay = M.require( 'modules/tutorials/ContentOverlay' 
);
 
        /**
@@ -21,6 +22,17 @@
                        this.hideSpinner();
                },
                /**
+                * Notify with truncated parameters.
+                * @param {String} key of message
+                * @param {String} title of collection
+                */
+               notify: function ( key, title ) {
+                       var html = $( '<span class="truncated-text">' ).text( 
title )
+                               .css( {  width: '150px', display: 
'inline-block' } )
+                               .appendTo( '<div>' ).parent().html();
+                       toast.show( mw.message( key, html ).parse(), 'toast' );
+               },
+               /**
                 * Reveal all interface elements and cancel the spinner.
                 */
                hideSpinner: function () {
diff --git a/resources/ext.gather.watchstar/CollectionsContentOverlay.js 
b/resources/ext.gather.watchstar/CollectionsContentOverlay.js
index b7c22fd..b888c90 100644
--- a/resources/ext.gather.watchstar/CollectionsContentOverlay.js
+++ b/resources/ext.gather.watchstar/CollectionsContentOverlay.js
@@ -265,10 +265,10 @@
                        if ( currentPageIsMember ) {
                                this.emit( 'collection-watch', collection );
                                // show toast
-                               toast.show( mw.msg( 'gather-add-toast', 
collection.title ), 'toast' );
+                               this.notify( 'gather-add-toast', 
collection.title );
                        } else {
                                this.emit( 'collection-unwatch', collection );
-                               toast.show( mw.msg( 'gather-remove-toast', 
collection.title ), 'toast' );
+                               this.notify( 'gather-remove-toast', 
collection.title );
                        }
                },
                /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica09608a17ec871539f6d454677ddb39422a0451
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to