Merge "Use HTML::hidden to create input fields"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.FilterWrapperWidget.js
index 9b4ce7f..8f8ca38 100644 (file)
@@ -9,12 +9,15 @@
         * @param {mw.rcfilters.Controller} controller Controller
         * @param {mw.rcfilters.dm.FiltersViewModel} model View model
         * @param {mw.rcfilters.dm.SavedQueriesModel} savedQueriesModel Saved queries model
+        * @param {mw.rcfilters.dm.ChangesListViewModel} changesListModel
         * @param {Object} [config] Configuration object
         * @cfg {Object} [filters] A definition of the filter groups in this list
         * @cfg {jQuery} [$overlay] A jQuery object serving as overlay for popups
         */
-       mw.rcfilters.ui.FilterWrapperWidget = function MwRcfiltersUiFilterWrapperWidget( controller, model, savedQueriesModel, config ) {
-               var $bottom;
+       mw.rcfilters.ui.FilterWrapperWidget = function MwRcfiltersUiFilterWrapperWidget(
+               controller, model, savedQueriesModel, changesListModel, config
+       ) {
+               var $top, $topRow, $bottom;
                config = config || {};
 
                // Parent
@@ -35,7 +38,8 @@
                );
 
                this.liveUpdateButton = new mw.rcfilters.ui.LiveUpdateButtonWidget(
-                       this.controller
+                       this.controller,
+                       changesListModel
                );
 
                this.numChangesWidget = new mw.rcfilters.ui.ChangesLimitButtonWidget(
                );
 
                // Initialize
-               this.$element
-                       .addClass( 'mw-rcfilters-ui-filterWrapperWidget' );
-
-               if ( mw.config.get( 'wgStructuredChangeFiltersEnableSaving' ) ) {
-                       this.savedLinksListWidget = new mw.rcfilters.ui.SavedLinksListWidget(
-                               this.controller,
-                               this.queriesModel,
-                               { $overlay: this.$overlay }
-                       );
-
-                       this.$element.append(
-                               this.savedLinksListWidget.$element
+               $topRow = $( '<div>' )
+                       .addClass( 'mw-rcfilters-ui-row' )
+                       .append(
+                               $( '<div>' )
+                                       .addClass( 'mw-rcfilters-ui-cell' )
+                                       .addClass( 'mw-rcfilters-ui-filterWrapperWidget-top-placeholder' )
                        );
-               }
+               $top = $( '<div>' )
+                       .addClass( 'mw-rcfilters-ui-filterWrapperWidget-top' )
+                       .addClass( 'mw-rcfilters-ui-table' )
+                       .append( $topRow );
 
                $bottom = $( '<div>' )
                        .addClass( 'mw-rcfilters-ui-filterWrapperWidget-bottom' )
                                this.dateWidget.$element
                        );
 
-               if (
-                       mw.config.get( 'wgStructuredChangeFiltersEnableLiveUpdate' ) ||
-                       // Allow users to enable live update with ?liveupdate=1
-                       new mw.Uri().query.liveupdate
-               ) {
+               this.savedLinksListWidget = new mw.rcfilters.ui.SavedLinksListWidget(
+                       this.controller,
+                       this.queriesModel,
+                       { $overlay: this.$overlay }
+               );
+
+               $topRow.append(
+                       $( '<div>' )
+                               .addClass( 'mw-rcfilters-ui-cell' )
+                               .addClass( 'mw-rcfilters-ui-filterWrapperWidget-top-savedLinks' )
+                               .append( this.savedLinksListWidget.$element )
+               );
+
+               if ( mw.rcfilters.featureFlags.liveUpdate ) {
                        $bottom.append( this.liveUpdateButton.$element );
                }
 
-               this.$element.append(
-                       this.filterTagWidget.$element,
-                       $bottom
-               );
+               this.$element
+                       .addClass( 'mw-rcfilters-ui-filterWrapperWidget' )
+                       .append(
+                               $top,
+                               this.filterTagWidget.$element,
+                               $bottom
+                       );
        };
 
        /* Initialization */