jenkins-bot has submitted this change and it was merged.

Change subject: Support for PlaceholderWidget with no link
......................................................................


Support for PlaceholderWidget with no link

Bug: T137490
Change-Id: Ia861b5aa3f100124418956a0e09603a9ba29215a
---
M includes/api/ApiEchoNotifications.php
M modules/styles/mw.echo.ui.PlaceholderItemWidget.less
M modules/ui/mw.echo.ui.PlaceholderItemWidget.js
3 files changed, 18 insertions(+), 24 deletions(-)

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



diff --git a/includes/api/ApiEchoNotifications.php 
b/includes/api/ApiEchoNotifications.php
index 3fc66d1..6a00bf6 100644
--- a/includes/api/ApiEchoNotifications.php
+++ b/includes/api/ApiEchoNotifications.php
@@ -11,6 +11,7 @@
        }
 
        public function execute() {
+
                // To avoid API warning, register the parameter used to bust 
browser cache
                $this->getMain()->getVal( '_' );
 
diff --git a/modules/styles/mw.echo.ui.PlaceholderItemWidget.less 
b/modules/styles/mw.echo.ui.PlaceholderItemWidget.less
index 9139d15..7ea644e 100644
--- a/modules/styles/mw.echo.ui.PlaceholderItemWidget.less
+++ b/modules/styles/mw.echo.ui.PlaceholderItemWidget.less
@@ -1,10 +1,5 @@
 @import '../echo.variables';
 .mw-echo-ui-placeholderItemWidget {
-               padding: 2em;
-               background-color: @notification-background-read;
-
-               &-notLinked,
-               &-notLinked a {
-                       cursor: default;
-               }
-       }
+       padding: 2em;
+       background-color: @notification-background-read;
+}
diff --git a/modules/ui/mw.echo.ui.PlaceholderItemWidget.js 
b/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
index 71eff32..1d64abe 100644
--- a/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
+++ b/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
@@ -19,31 +19,29 @@
                // Mixin constructor
                OO.ui.mixin.LabelElement.call( this, config );
 
-               this.$link = $( '<a>' )
-                       .addClass( 'mw-echo-ui-placeholderItemWidget-link' );
-               this.setLink( config.link || '' );
+               this.$element.addClass( 'mw-echo-ui-placeholderItemWidget' );
 
-               this.$element
-                       .addClass( 'mw-echo-ui-placeholderItemWidget' )
-                       .append(
-                               this.$link.append( this.$label )
-                       );
+               this.setLink( config.link );
        };
 
        OO.inheritClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.Widget );
        OO.mixinClass( mw.echo.ui.PlaceholderItemWidget, 
OO.ui.mixin.LabelElement );
 
        /**
-        * Set (or unset) the main link for this widget
+        * Set (or unset) the main link url for this widget
         *
-        * @param {string} link The widget link
+        * @param {string} url The widget url
         */
-       mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( link ) {
-               this.link = link;
-
-               this.$element.toggleClass( 
'mw-echo-ui-placeholderItemWidget-loadingOption-notLinked', !this.link );
-
-               this.$link.attr( 'href', this.link );
+       mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( url ) {
+               var $link;
+               if ( url ) {
+                       $link = $( '<a>' )
+                               .addClass( 
'mw-echo-ui-placeholderItemWidget-link' )
+                               .attr( 'href', url );
+                       this.$element.html( $link.append( this.$label ) );
+               } else {
+                       this.$element.html( this.$label );
+               }
        };
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia861b5aa3f100124418956a0e09603a9ba29215a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Sbisson <sbis...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to