RCFilters: Set up conditional views for RCLinked
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / mw.rcfilters.Controller.js
index eec4f4b..7b5e115 100644 (file)
         * @param {Array} filterStructure Filter definition and structure for the model
         * @param {Object} [namespaceStructure] Namespace definition
         * @param {Object} [tagList] Tag definition
+        * @param {Object} [conditionalViews] Conditional view definition
         */
-       mw.rcfilters.Controller.prototype.initialize = function ( filterStructure, namespaceStructure, tagList ) {
+       mw.rcfilters.Controller.prototype.initialize = function ( filterStructure, namespaceStructure, tagList, conditionalViews ) {
                var parsedSavedQueries, pieces,
                        displayConfig = mw.config.get( 'StructuredChangeFiltersDisplayConfig' ),
                        defaultSavedQueryExists = mw.config.get( 'wgStructuredChangeFiltersDefaultSavedQueryExists' ),
                        controller = this,
-                       views = {},
+                       views = $.extend( true, {}, conditionalViews ),
                        items = [],
                        uri = new mw.Uri();
 
                        ]
                };
 
-               views.recentChangesLinked = {
-                       groups: [
-                               {
-                                       name: 'page',
-                                       type: 'any_value',
-                                       title: '',
-                                       hidden: true,
-                                       sticky: true,
-                                       filters: [
-                                               {
-                                                       name: 'target',
-                                                       'default': ''
-                                               }
-                                       ]
-                               },
-                               {
-                                       name: 'toOrFrom',
-                                       type: 'boolean',
-                                       title: '',
-                                       hidden: true,
-                                       sticky: true,
-                                       filters: [
-                                               {
-                                                       name: 'showlinkedto',
-                                                       'default': false
-                                               }
-                                       ]
-                               }
-                       ]
-               };
-
                // Before we do anything, we need to see if we require additional items in the
                // groups that have 'AllowArbitrary'. For the moment, those are only single_option
                // groups; if we ever expand it, this might need further generalization: