Merge "RCFilters: Correct label for "View newest changes" button"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 3 Aug 2017 18:38:16 +0000 (18:38 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 3 Aug 2017 18:38:17 +0000 (18:38 +0000)
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ChangesListViewModel.js
resources/src/mediawiki.rcfilters/mw.rcfilters.Controller.js
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.less
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.mixins.less
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js
resources/src/mediawiki.special/mediawiki.special.preferences.styles.css

index 34ed2eb..f221b2b 100644 (file)
         * @param {jQuery|string} changesListContent
         * @param {jQuery} $fieldset
         * @param {boolean} [isInitialDOM] Using the initial (already attached) DOM elements
-        * @param {boolean} [fromLiveUpdate] These are new changes fetched via Live Update
+        * @param {boolean} [separateOldAndNew] Whether a logical separation between old and new changes is needed
         * @fires update
         */
-       mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset, isInitialDOM, fromLiveUpdate ) {
+       mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset, isInitialDOM, separateOldAndNew ) {
                var from = this.nextFrom;
                this.valid = true;
                this.extractNextFrom( $fieldset );
-               this.emit( 'update', changesListContent, $fieldset, isInitialDOM, fromLiveUpdate ? from : null );
+               this.emit( 'update', changesListContent, $fieldset, isInitialDOM, separateOldAndNew ? from : null );
        };
 
        /**
index 30bec87..e9981bd 100644 (file)
                this.initializing = false;
 
                this.prevLoggedItems = [];
+
+               this.FILTER_CHANGE = 'filterChange';
+               this.SHOW_NEW_CHANGES = 'showNewChanges';
+               this.LIVE_UPDATE = 'liveUpdate';
        };
 
        /* Initialization */
        mw.rcfilters.Controller.prototype.toggleLiveUpdate = function ( enable ) {
                this.changesListModel.toggleLiveUpdate( enable );
                if ( this.changesListModel.getLiveUpdate() && this.changesListModel.getNewChangesExist() ) {
-                       this.showNewChanges();
+                       this.updateChangesList( null, this.LIVE_UPDATE );
                }
        };
 
 
                                if ( data.changes !== 'NO_RESULTS' ) {
                                        if ( this.changesListModel.getLiveUpdate() ) {
-                                               return this.updateChangesList( false, null, true, false );
+                                               return this.updateChangesList( null, this.LIVE_UPDATE );
                                        } else {
                                                this.changesListModel.setNewChangesExist( true );
                                        }
         * fetching and showing the new changes
         */
        mw.rcfilters.Controller.prototype.showNewChanges = function () {
-               return this.updateChangesList( false, null, true, true );
+               return this.updateChangesList( null, this.SHOW_NEW_CHANGES );
        };
 
        /**
        /**
         * Update the list of changes and notify the model
         *
-        * @param {boolean} [updateUrl=true] Whether the URL should be updated with the current state of the filters
         * @param {Object} [params] Extra parameters to add to the API call
-        * @param {boolean} [isLiveUpdate=false] The purpose of this update is to show new results for the same filters
-        * @param {boolean} [invalidateCurrentChanges=true] Invalidate current changes by default (show spinner)
+        * @param {string} [updateMode='filterChange'] One of 'filterChange', 'liveUpdate', 'showNewChanges'
         * @return {jQuery.Promise} Promise that is resolved when the update is complete
         */
-       mw.rcfilters.Controller.prototype.updateChangesList = function ( updateUrl, params, isLiveUpdate, invalidateCurrentChanges ) {
-               updateUrl = updateUrl === undefined ? true : updateUrl;
-               invalidateCurrentChanges = invalidateCurrentChanges === undefined ? true : invalidateCurrentChanges;
-               if ( updateUrl ) {
+       mw.rcfilters.Controller.prototype.updateChangesList = function ( params, updateMode ) {
+               updateMode = updateMode === undefined ? this.FILTER_CHANGE : updateMode;
+
+               if ( updateMode === this.FILTER_CHANGE ) {
                        this._updateURL( params );
                }
-               if ( invalidateCurrentChanges ) {
+               if ( updateMode === this.FILTER_CHANGE || updateMode === this.SHOW_NEW_CHANGES ) {
                        this.changesListModel.invalidate();
                }
                this.changesListModel.setNewChangesExist( false );
                                function ( pieces ) {
                                        var $changesListContent = pieces.changes,
                                                $fieldset = pieces.fieldset;
-                                       this.changesListModel.update( $changesListContent, $fieldset, false, isLiveUpdate );
+                                       this.changesListModel.update(
+                                               $changesListContent,
+                                               $fieldset,
+                                               false,
+                                               updateMode === this.SHOW_NEW_CHANGES
+                                       );
                                }.bind( this )
                                // Do nothing for failure
                        )
index d48d52d..ef29655 100644 (file)
@@ -1,3 +1,6 @@
+@import 'mediawiki.mixins.animation';
+@import 'mw.rcfilters.mixins';
+
 // Corrections for the standard special page
 .client-js {
        .rcoptions {
                        height: 12px;
                        background-color: #c8ccd1;
                        border-radius: 100%;
-                       animation: rcfiltersBouncedelay 1.5s infinite ease-in-out;
-                       animation-fill-mode: both;
-                       animation-delay: -0.16s;
+                       .animation( rcfiltersBouncedelay 1.5s ease-in-out -0.16s infinite both );
                }
 
                &:before {
-                       animation-delay: -0.33s;
+                       .animation-delay( -0.33s );
                }
 
                &:after {
-                       animation-delay: 0s;
+                       .animation-delay( 0s );
                }
-
        }
 }
 
        font-weight: bold;
 }
 
-@keyframes rcfiltersBouncedelay {
+@-webkit-keyframes rcfiltersBouncedelay {
+       0%,
+       80%,
+       100% {
+               -webkit-transform: scale( 0.7 );
+               transform: scale( 0.7 );
+       }
+       40% {
+               background-color: #a2a9b1;
+               -webkit-transform: scale( 1 );
+               transform: scale( 1 );
+       }
+}
+
+@-moz-keyframes rcfiltersBouncedelay {
        0%,
-       100%,
-       80% {
+       80%,
+       100% {
+               -moz-transform: scale( 0.7 );
                transform: scale( 0.7 );
        }
        40% {
+               background-color: #a2a9b1;
+               -moz-transform: scale( 0.7 );
                transform: scale( 1 );
+       }
+}
+
+@keyframes rcfiltersBouncedelay {
+       0%,
+       80%,
+       100% {
+               transform: scale( 0.7 );
+       }
+       40% {
                background-color: #a2a9b1;
+               transform: scale( 1 );
        }
 }
index 2ce2c7f..3b90f06 100644 (file)
@@ -1,6 +1,12 @@
 @import 'mediawiki.mixins';
 @import 'mw.rcfilters.variables';
 
+.animation-delay( ... ) {
+       -webkit-animation-delay: @arguments; // Chrome 4-42, Safari 4-8, Opera 15-29, Android 2.1-4.4.4
+       -moz-animation-delay: @arguments; // Firefox 5-15
+       animation-delay: @arguments; // Chrome 43+, Firefox 16+, IE 10+, Edge 12+, Safari 9+, Opera 12.10 & 30+, iOS 9+, Android 47+
+}
+
 // This is a general mixin for a color circle
 .mw-rcfilters-mixin-circle( @color: white, @diameter: 2em, @padding: 0.5em, @border: false ) {
        border-radius: 50%;
index 44f6da7..7f7bbd2 100644 (file)
@@ -54,7 +54,7 @@
         * @return {boolean} false
         */
        mw.rcfilters.ui.FormWrapperWidget.prototype.onLinkClick = function ( e ) {
-               this.controller.updateChangesList( true, $( e.target ).data( 'params' ) );
+               this.controller.updateChangesList( $( e.target ).data( 'params' ) );
                return false;
        };
 
@@ -78,7 +78,7 @@
                        data[ $( this ).prop( 'name' ) ] = value;
                } );
 
-               this.controller.updateChangesList( true, data );
+               this.controller.updateChangesList( data );
                return false;
        };
 
index c7a5f77..33b630a 100644 (file)
@@ -1,6 +1,6 @@
 /* Reuses colors from mediawiki.legacy/shared.css */
 .mw-email-not-authenticated .mw-input,
-.mw-email-none .mw-input{
+.mw-email-none .mw-input {
        border: 1px solid #fde29b;
        background-color: #fdf1d1;
        color: #000;