Merge "Skin: Make skins aware of their registered skin name"
[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 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-savedLinksTable' )
56 .append(
57 $( '<div>' )
58 .addClass( 'mw-rcfilters-ui-row' )
59 .append(
60 $( '<div>' )
61 .addClass( 'mw-rcfilters-ui-cell' )
62 .append( markSeenButton.$element )
63 )
64 .append(
65 $( '<div>' )
66 .addClass( 'mw-rcfilters-ui-cell' )
67 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-savedLinks' )
68 .append( savedLinksListWidget.$element )
69 )
70 );
71
72 $separator = $( '<div>' )
73 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget-separator' );
74
75 this.$element
76 .addClass( 'mw-rcfilters-ui-watchlistTopSectionWidget' )
77 .append( $topTable, $separator, $bottomTable );
78 };
79
80 /* Initialization */
81
82 OO.inheritClass( mw.rcfilters.ui.WatchlistTopSectionWidget, OO.ui.Widget );
83 }( mediaWiki ) );