Localisation updates from https://translatewiki.net.
[mediawiki.git] / resources / src / mediawiki.rcfilters / ui / RclTopSectionWidget.js
blob69dd964d0498bf522dd2bb26de2376b87e88a62c
1 const RclToOrFromWidget = require( './RclToOrFromWidget.js' );
2 const RclTargetPageWidget = require( './RclTargetPageWidget.js' );
4 /**
5  * Top section (between page title and filters) on Special:RecentChangesLinked (AKA RelatedChanges).
6  *
7  * @class mw.rcfilters.ui.RclTopSectionWidget
8  * @ignore
9  * @extends OO.ui.Widget
10  *
11  * @param {mw.rcfilters.ui.SavedLinksListWidget} savedLinksListWidget
12  * @param {mw.rcfilters.Controller} controller
13  * @param {mw.rcfilters.dm.FilterItem} showLinkedToModel Model for 'showlinkedto' parameter
14  * @param {mw.rcfilters.dm.FilterItem} targetPageModel Model for 'target' parameter
15  * @param {Object} [config] Configuration object
16  */
17 const RclTopSectionWidget = function MwRcfiltersUiRclTopSectionWidget(
18         savedLinksListWidget, controller, showLinkedToModel, targetPageModel, config
19 ) {
20         config = config || {};
22         // Parent
23         RclTopSectionWidget.super.call( this, config );
25         this.controller = controller;
27         const toOrFromWidget = new RclToOrFromWidget( controller, showLinkedToModel );
28         const targetPage = new RclTargetPageWidget( controller, targetPageModel );
30         // Initialize
31         this.$element
32                 .addClass( 'mw-rcfilters-ui-rclTopSectionWidget' )
33                 .append(
34                         $( '<div>' )
35                                 .addClass( 'mw-rcfilters-ui-table' )
36                                 .append(
37                                         $( '<div>' )
38                                                 .addClass( 'mw-rcfilters-ui-row' )
39                                                 .append(
40                                                         $( '<div>' )
41                                                                 .addClass( 'mw-rcfilters-ui-cell' )
42                                                                 .append( toOrFromWidget.$element )
43                                                 ),
44                                         $( '<div>' )
45                                                 .addClass( 'mw-rcfilters-ui-row' )
46                                                 .append(
47                                                         $( '<div>' )
48                                                                 .addClass( 'mw-rcfilters-ui-cell' )
49                                                                 .append( targetPage.$element ),
50                                                         $( '<div>' )
51                                                                 .addClass( 'mw-rcfilters-ui-table-placeholder' )
52                                                                 .addClass( 'mw-rcfilters-ui-cell' ),
53                                                         !mw.user.isAnon() ?
54                                                                 $( '<div>' )
55                                                                         .addClass( 'mw-rcfilters-ui-cell' )
56                                                                         .addClass( 'mw-rcfilters-ui-rclTopSectionWidget-savedLinks' )
57                                                                         .append( savedLinksListWidget.$element ) :
58                                                                 null
59                                                 )
60                                 )
61                 );
64 /* Initialization */
66 OO.inheritClass( RclTopSectionWidget, OO.ui.Widget );
68 module.exports = RclTopSectionWidget;