Merge "Show a warning in edit preview when a template loop is detected"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.WatchlistTopSectionWidget.js
1 ( function ( mw ) {
2 /**
3 * Top section (between page title and filters) on Special:Watchlist
4 *
5 * @extends OO.ui.Widget
6 *
7 * @constructor
8 * @param {mw.rcfilters.Controller} controller
9 * @param {mw.rcfilters.dm.ChangesListViewModel} changesListModel
10 * @param {mw.rcfilters.ui.SavedLinksListWidget} savedLinksListWidget
11 * @param {jQuery} $watchlistDetails Content of the 'details' section that includes watched pages count
12 * @param {Object} [config] Configuration object
13 */
14 mw.rcfilters.ui.WatchlistTopSectionWidget = function MwRcfiltersUiWatchlistTopSectionWidget(
15 controller, changesListModel, savedLinksListWidget, $watchlistDetails, config
16 ) {
17 var editWatchlistButton,
18 markSeenButton,
19 $topTable,
20 $bottomTable,
21 $separator;
22 config = config || {};
23
24 // Parent
25 mw.rcfilters.ui.WatchlistTopSectionWidget.parent.call( this, config );
26
27 editWatchlistButton = new OO.ui.ButtonWidget( {
28 label: mw.msg( 'rcfilters-watchlist-edit-watchlist-button' ),
29 icon: 'edit',
30 href: mw.config.get( 'wgStructuredChangeFiltersEditWatchlistUrl' )
31 } );
32 markSeenButton = new mw.rcfilters.ui.MarkSeenButtonWidget( controller, changesListModel );
33
34 $topTable = $( '<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 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-watchlistDetails' )
43 .append( $watchlistDetails )
44 )
45 .append(
46 $( '<div>' )
47 .addClass( 'mw-rcfilters-ui-cell' )
48 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-editWatchlistButton' )
49 .append( editWatchlistButton.$element )
50 )
51 );
52
53 $bottomTable = $( '<div>' )
54 .addClass( 'mw-rcfilters-ui-table' )
55 .append(
56 $( '<div>' )
57 .addClass( 'mw-rcfilters-ui-row' )
58 .append(
59 $( '<div>' )
60 .addClass( 'mw-rcfilters-ui-cell' )
61 .append( markSeenButton.$element )
62 )
63 .append(
64 $( '<div>' )
65 .addClass( 'mw-rcfilters-ui-cell' )
66 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-savedLinks' )
67 .append( savedLinksListWidget.$element )
68 )
69 );
70
71 $separator = $( '<div>' )
72 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-separator' );
73
74 this.$element
75 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget' )
76 .append( $topTable, $separator, $bottomTable );
77 };
78
79 /* Initialization */
80
81 OO.inheritClass( mw.rcfilters.ui.WatchlistTopSectionWidget, OO.ui.Widget );
82 }( mediaWiki ) );