jenkins-bot has submitted this change and it was merged. Change subject: Change the naming of 'notification option' to 'notification item' widgets ......................................................................
Change the naming of 'notification option' to 'notification item' widgets This is in preparation of adding more item models and widget types, and in preparation of switching the notification widget away from being a select widget. Change-Id: I518fb3d80f4f67d677c21ca5593638269acfa544 --- M Resources.php M modules/nojs/mw.echo.notifications.less R modules/ooui/mw.echo.ui.NotificationItemWidget.js M modules/ooui/mw.echo.ui.NotificationsWidget.js A modules/ooui/mw.echo.ui.PlaceholderItemWidget.js D modules/ooui/mw.echo.ui.PlaceholderOptionWidget.js R modules/ooui/styles/mw.echo.ui.NotificationItemWidget.less R modules/ooui/styles/mw.echo.ui.NotificationItemWidget.modern.less M tests/browser/features/support/components/notifications.rb 9 files changed, 53 insertions(+), 53 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/Resources.php b/Resources.php index 072adf9..7f799e5 100644 --- a/Resources.php +++ b/Resources.php @@ -33,15 +33,15 @@ 'ext.echo.ui' => $echoResourceTemplate + array( 'scripts' => array( 'ooui/mw.echo.ui.js', - 'ooui/mw.echo.ui.PlaceholderOptionWidget.js', + 'ooui/mw.echo.ui.PlaceholderItemWidget.js', 'ooui/mw.echo.ui.NotificationsWidget.js', - 'ooui/mw.echo.ui.NotificationOptionWidget.js', + 'ooui/mw.echo.ui.NotificationItemWidget.js', 'ooui/mw.echo.ui.BadgeLinkWidget.js', 'ooui/mw.echo.ui.NotificationBadgeWidget.js' ), 'styles' => array( 'ooui/styles/mw.echo.ui.NotificationsWidget.less', - 'ooui/styles/mw.echo.ui.NotificationOptionWidget.less', + 'ooui/styles/mw.echo.ui.NotificationItemWidget.less', 'ooui/styles/mw.echo.ui.NotificationBadgeWidget.less' ), 'skinStyles' => array( @@ -50,7 +50,7 @@ 'ooui/styles/mw.echo.ui.NotificationBadgeWidget.monobook.less' ), 'modern' => array( - 'ooui/styles/mw.echo.ui.NotificationOptionWidget.modern.less', + 'ooui/styles/mw.echo.ui.NotificationItemWidget.modern.less', 'ooui/styles/mw.echo.ui.NotificationBadgeWidget.modern.less' ), 'vector' => array( diff --git a/modules/nojs/mw.echo.notifications.less b/modules/nojs/mw.echo.notifications.less index 07fa1a6..3986e61 100644 --- a/modules/nojs/mw.echo.notifications.less +++ b/modules/nojs/mw.echo.notifications.less @@ -1,7 +1,7 @@ -// This needs to be outside the upper selector 'NotificationOptionWidget' +// This needs to be outside the upper selector 'NotificationItemWidget' // because the same styles also apply (for the moment, at least) to the notification // objects in the Special:Notifications page, which are, individually -// not wrapped with a notificationOptionWidget. +// not wrapped with a NotificationItemWidget. .mw-echo-state { display: block; padding: 15px 40px 10px 10px; diff --git a/modules/ooui/mw.echo.ui.NotificationOptionWidget.js b/modules/ooui/mw.echo.ui.NotificationItemWidget.js similarity index 68% rename from modules/ooui/mw.echo.ui.NotificationOptionWidget.js rename to modules/ooui/mw.echo.ui.NotificationItemWidget.js index 818d0a2..53ee616 100644 --- a/modules/ooui/mw.echo.ui.NotificationOptionWidget.js +++ b/modules/ooui/mw.echo.ui.NotificationItemWidget.js @@ -9,19 +9,19 @@ * @param {Object} [config] Configuration object * @cfg {boolean} [markReadWhenSeen=false] This option is marked as read when it is viewed */ - mw.echo.ui.NotificationOptionWidget = function MwEchoUiNotificationOptionWidget( model, config ) { + mw.echo.ui.NotificationItemWidget = function MwEchoUiNotificationItemWidget( model, config ) { var widget = this; config = config || {}; this.model = model; // Parent constructor - mw.echo.ui.NotificationOptionWidget.parent.call( this, $.extend( { data: this.model.getId() }, config ) ); + mw.echo.ui.NotificationItemWidget.parent.call( this, $.extend( { data: this.model.getId() }, config ) ); this.markAsReadButton = new OO.ui.ButtonWidget( { icon: 'close', framed: false, - classes: [ 'mw-echo-ui-notificationOptionWidget-markAsReadButton' ] + classes: [ 'mw-echo-ui-notificationItemWidget-markAsReadButton' ] } ); this.setLabel( this.model.getContent() ); @@ -40,7 +40,7 @@ } ); this.$element - .addClass( 'mw-echo-ui-notificationOptionWidget mw-echo-ui-notificationOptionWidget-' + this.model.getType() ) + .addClass( 'mw-echo-ui-notificationItemWidget mw-echo-ui-notificationItemWidget-' + this.model.getType() ) .append( // HACK: Wrap the entire option with a link that takes // the user to the primary url. This is not perfect, @@ -48,7 +48,7 @@ // than us listening to click events and opening new // windows. $( '<a>' ) - .addClass( 'mw-echo-ui-notificationOptionWidget-linkWrapper' ) + .addClass( 'mw-echo-ui-notificationItemWidget-linkWrapper' ) .attr( 'href', this.model.getPrimaryUrl() ) .append( this.markAsReadButton.$element, @@ -65,12 +65,12 @@ } ) ); - this.$element.toggleClass( 'mw-echo-ui-notificationOptionWidget-initiallyUnseen', !this.model.isSeen() ); + this.$element.toggleClass( 'mw-echo-ui-notificationItemWidget-initiallyUnseen', !this.model.isSeen() ); }; /* Initialization */ - OO.inheritClass( mw.echo.ui.NotificationOptionWidget, OO.ui.OptionWidget ); + OO.inheritClass( mw.echo.ui.NotificationItemWidget, OO.ui.OptionWidget ); /* Events */ @@ -85,7 +85,7 @@ /** * Respond to mark as read button click */ - mw.echo.ui.NotificationOptionWidget.prototype.onMarkAsReadButtonClick = function () { + mw.echo.ui.NotificationItemWidget.prototype.onMarkAsReadButtonClick = function () { this.model.toggleRead( true ); }; @@ -95,8 +95,8 @@ * This is called when new notifications are added to the parent widget, having to * reset the 'unseen' status from the old ones. */ - mw.echo.ui.NotificationOptionWidget.prototype.reset = function () { - this.$element.removeClass( 'mw-echo-ui-notificationOptionWidget-initiallyUnseen' ); + mw.echo.ui.NotificationItemWidget.prototype.reset = function () { + this.$element.removeClass( 'mw-echo-ui-notificationItemWidget-initiallyUnseen' ); }; /** @@ -105,10 +105,10 @@ * @param {boolean} [read] The current read state. If not given, the state will * become the opposite of its current state. */ - mw.echo.ui.NotificationOptionWidget.prototype.toggleRead = function ( read ) { + mw.echo.ui.NotificationItemWidget.prototype.toggleRead = function ( read ) { this.read = read !== undefined ? read : !this.read; - this.$element.toggleClass( 'mw-echo-ui-notificationOptionWidget-unread', !this.read ); + this.$element.toggleClass( 'mw-echo-ui-notificationItemWidget-unread', !this.read ); this.markAsReadButton.toggle( !this.read ); }; @@ -118,11 +118,11 @@ * @param {boolean} [seen] The current seen state. If not given, the state will * become the opposite of its current state. */ - mw.echo.ui.NotificationOptionWidget.prototype.toggleSeen = function ( seen ) { + mw.echo.ui.NotificationItemWidget.prototype.toggleSeen = function ( seen ) { this.seen = seen !== undefined ? seen : !this.seen; this.$element - .toggleClass( 'mw-echo-ui-notificationOptionWidget-unseen', !this.seen ); + .toggleClass( 'mw-echo-ui-notificationItemWidget-unseen', !this.seen ); }; /** @@ -130,7 +130,7 @@ * * @return {string} Notification link */ - mw.echo.ui.NotificationOptionWidget.prototype.getModel = function () { + mw.echo.ui.NotificationItemWidget.prototype.getModel = function () { return this.model; }; @@ -139,14 +139,14 @@ * * @return {string} Notification link */ - mw.echo.ui.NotificationOptionWidget.prototype.getPrimaryUrl = function () { + mw.echo.ui.NotificationItemWidget.prototype.getPrimaryUrl = function () { return this.model.getPrimaryUrl(); }; /** * Disconnect events when widget is destroyed. */ - mw.echo.ui.NotificationOptionWidget.prototype.destroy = function () { + mw.echo.ui.NotificationItemWidget.prototype.destroy = function () { this.model.disconnect( this ); }; diff --git a/modules/ooui/mw.echo.ui.NotificationsWidget.js b/modules/ooui/mw.echo.ui.NotificationsWidget.js index 10712af..aac1d70 100644 --- a/modules/ooui/mw.echo.ui.NotificationsWidget.js +++ b/modules/ooui/mw.echo.ui.NotificationsWidget.js @@ -22,7 +22,7 @@ mw.echo.ui.NotificationsWidget.parent.call( this, config ); // Dummy 'loading' option widget - this.loadingOptionWidget = new mw.echo.ui.PlaceholderOptionWidget(); + this.loadingOptionWidget = new mw.echo.ui.PlaceholderItemWidget(); this.addItems( [ this.loadingOptionWidget ] ); // Events @@ -49,7 +49,7 @@ * @param {number} index Index to add the item */ mw.echo.ui.NotificationsWidget.prototype.onModelNotificationAdd = function ( notificationItem, index ) { - var widget = new mw.echo.ui.NotificationOptionWidget( + var widget = new mw.echo.ui.NotificationItemWidget( notificationItem, { markReadWhenSeen: this.markReadWhenSeen diff --git a/modules/ooui/mw.echo.ui.PlaceholderItemWidget.js b/modules/ooui/mw.echo.ui.PlaceholderItemWidget.js new file mode 100644 index 0000000..2673035 --- /dev/null +++ b/modules/ooui/mw.echo.ui.PlaceholderItemWidget.js @@ -0,0 +1,24 @@ +( function ( mw, $ ) { + /** + * Placeholder notification option widget for echo popup. + * + * @class + * @extends OO.ui.OptionWidget + * + * @constructor + * @param {Object} [config] Configuration object + */ + mw.echo.ui.PlaceholderItemWidget = function MwEchoUiPlaceholderItemWidget( config ) { + // Parent constructor + mw.echo.ui.PlaceholderItemWidget.parent.call( this, $.extend( { data: null }, config ) ); + + this.$element.addClass( 'mw-echo-ui-notificationsWidget-loadingOption' ); + }; + + OO.inheritClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.OptionWidget ); + + mw.echo.ui.PlaceholderItemWidget.static.selectable = false; + mw.echo.ui.PlaceholderItemWidget.static.highlightable = false; + mw.echo.ui.PlaceholderItemWidget.static.pressable = false; + +} )( mediaWiki, jQuery ); diff --git a/modules/ooui/mw.echo.ui.PlaceholderOptionWidget.js b/modules/ooui/mw.echo.ui.PlaceholderOptionWidget.js deleted file mode 100644 index a5571b1..0000000 --- a/modules/ooui/mw.echo.ui.PlaceholderOptionWidget.js +++ /dev/null @@ -1,24 +0,0 @@ -( function ( mw, $ ) { - /** - * Placeholder notification option widget for echo popup. - * - * @class - * @extends OO.ui.OptionWidget - * - * @constructor - * @param {Object} [config] Configuration object - */ - mw.echo.ui.PlaceholderOptionWidget = function MwEchoUiPlaceholderOptionWidget( config ) { - // Parent constructor - mw.echo.ui.PlaceholderOptionWidget.parent.call( this, $.extend( { data: null }, config ) ); - - this.$element.addClass( 'mw-echo-ui-notificationsWidget-loadingOption' ); - }; - - OO.inheritClass( mw.echo.ui.PlaceholderOptionWidget, OO.ui.OptionWidget ); - - mw.echo.ui.PlaceholderOptionWidget.static.selectable = false; - mw.echo.ui.PlaceholderOptionWidget.static.highlightable = false; - mw.echo.ui.PlaceholderOptionWidget.static.pressable = false; - -} )( mediaWiki, jQuery ); diff --git a/modules/ooui/styles/mw.echo.ui.NotificationOptionWidget.less b/modules/ooui/styles/mw.echo.ui.NotificationItemWidget.less similarity index 95% rename from modules/ooui/styles/mw.echo.ui.NotificationOptionWidget.less rename to modules/ooui/styles/mw.echo.ui.NotificationItemWidget.less index f1b4a5e..d08990d 100644 --- a/modules/ooui/styles/mw.echo.ui.NotificationOptionWidget.less +++ b/modules/ooui/styles/mw.echo.ui.NotificationItemWidget.less @@ -1,6 +1,6 @@ @import '../../echo.variables'; -.mw-echo-ui-notificationOptionWidget { +.mw-echo-ui-notificationItemWidget { padding: 0.5em; background-color: #F1F1F1; border-bottom: 1px solid #DDDDDD; @@ -50,7 +50,7 @@ -webkit-animation-fill-mode: both; animation-fill-mode: both; - &.mw-echo-ui-notificationOptionWidget-unread { + &.mw-echo-ui-notificationItemWidget-unread { -webkit-animation-name: unseen-fadeout-to-unread; animation-name: unseen-fadeout-to-unread; } diff --git a/modules/ooui/styles/mw.echo.ui.NotificationOptionWidget.modern.less b/modules/ooui/styles/mw.echo.ui.NotificationItemWidget.modern.less similarity index 91% rename from modules/ooui/styles/mw.echo.ui.NotificationOptionWidget.modern.less rename to modules/ooui/styles/mw.echo.ui.NotificationItemWidget.modern.less index 944501f..cdc5686 100644 --- a/modules/ooui/styles/mw.echo.ui.NotificationOptionWidget.modern.less +++ b/modules/ooui/styles/mw.echo.ui.NotificationItemWidget.modern.less @@ -1,4 +1,4 @@ -.mw-echo-ui-notificationOptionWidget { +.mw-echo-ui-notificationItemWidget { #p-personal & a, #p-personal & a.new { // Oh and double everything for :hover since Modern does that too. diff --git a/tests/browser/features/support/components/notifications.rb b/tests/browser/features/support/components/notifications.rb index 92c4965..f62209d 100644 --- a/tests/browser/features/support/components/notifications.rb +++ b/tests/browser/features/support/components/notifications.rb @@ -14,6 +14,6 @@ end def num_unread_notifications - div_elements(css: '.mw-echo-ui-notificationOptionWidget-unread').size + div_elements(css: '.mw-echo-ui-notificationItemWidget-unread').size end end -- To view, visit https://gerrit.wikimedia.org/r/252764 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I518fb3d80f4f67d677c21ca5593638269acfa544 Gerrit-PatchSet: 11 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> 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