return parent::getPageTitle( $subpage );
}
+
+ protected function outputNoResults() {
+ if ( $this->getTargetTitle() === false ) {
+ $this->getOutput()->addHTML(
+ '<div class="mw-changeslist-notargetpage">' .
+ $this->msg( 'recentchanges-notargetpage' )->parse() .
+ '</div>'
+ );
+ } else {
+ parent::outputNoResults();
+ }
+ }
}
"recentchanges-noresult": "No changes during the given period match these criteria.",
"recentchanges-timeout": "This search has timed out. You may wish to try different search parameters.",
"recentchanges-network": "Due to a technical error, no results could be loaded. Please try refreshing the page.",
+ "recentchanges-notargetpage": "Enter a page name above to see changes related to that page.",
"recentchanges-feed-description": "Track the most recent changes to the wiki in this feed.",
"recentchanges-label-newpage": "This edit created a new page",
"recentchanges-label-minor": "This is a minor edit",
"rcfilters-watchlist-showupdated": "Changes to pages you haven't visited since the changes occurred are in <strong>bold</strong>, with solid markers.",
"rcfilters-preference-label": "Hide the improved version of Recent Changes",
"rcfilters-preference-help": "Rolls back the 2017 interface redesign and all tools added then and since.",
- "rcfilters-filter-showlinkedfrom-label": "Show changes on pages linked from:",
- "rcfilters-filter-showlinkedfrom-option-label": "Show changes on pages linked FROM a page",
- "rcfilters-filter-showlinkedto-label": "Show changes on pages linked to:",
- "rcfilters-filter-showlinkedto-option-label": "Show changes on pages linked TO a page",
- "rcfilters-target-page-placeholder": "Select a page",
+ "rcfilters-filter-showlinkedfrom-label": "Show changes on pages linked from",
+ "rcfilters-filter-showlinkedfrom-option-label": "Show changes on pages linked <strong>FROM</strong> a page",
+ "rcfilters-filter-showlinkedto-label": "Show changes on pages linked to",
+ "rcfilters-filter-showlinkedto-option-label": "Show changes on pages linked <strong>TO</strong> a page",
+ "rcfilters-target-page-placeholder": "Enter a page name",
"rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
"rclistfromreset": "Reset date selection",
"rclistfrom": "Show new changes starting from $2, $3",
"recentchangeslinked-feed": "Related changes",
"recentchangeslinked-toolbox": "Related changes",
"recentchangeslinked-title": "Changes related to \"$1\"",
- "recentchangeslinked-summary": "This is a list of changes made recently to pages linked from a specified page (or to members of a specified category).\nPages on [[Special:Watchlist|your watchlist]] are <strong>bold</strong>.",
+ "recentchangeslinked-summary": "Enter a page name to see changes on pages linked to or from that page. (To see members of a category, enter Category:Name of category). Changes to pages on [[Special:Watchlist|your Watchlist]] are in <strong>bold</strong>.",
"recentchangeslinked-page": "Page name:",
"recentchangeslinked-to": "Show changes to pages linked to the given page instead",
"recentchanges-page-added-to-category": "[[:$1]] added to category",
"recentchanges-noresult": "Used in [[Special:RecentChanges]], [[Special:RecentChangesLinked]], and [[Special:Watchlist]] when there are no changes to be shown.",
"recentchanges-timeout": "Used in [[Special:RecentChanges]], [[Special:RecentChangesLinked]], and [[Special:Watchlist]] when a query times out.",
"recentchanges-network": "Used in [[Special:RecentChanges]], [[Special:RecentChangesLinked]] and [[Special:Watchlist]] when network error occurs.",
+ "recentchanges-notargetpage": "Used in [[Special:RecentChangesLinked]] to explain why no results are shown when no target page is specified.",
"recentchanges-feed-description": "Used in feed of RecentChanges. See example [{{canonicalurl:Special:RecentChanges|feed=atom}} feed].",
"recentchanges-label-newpage": "# Used as tooltip for {{msg-mw|Newpageletter}}.\n# Also used as legend. Preceded by {{msg-mw|Newpageletter}} and followed by {{msg-mw|Recentchanges-legend-newpage}}.",
"recentchanges-label-minor": "# Used as tooltip for {{msg-mw|Minoreditletter}}\n# Also used as legend. Preceded by {{msg-mw|Minoreditletter}}",
'recentchanges-noresult',
'recentchanges-timeout',
'recentchanges-network',
+ 'recentchanges-notargetpage',
'quotation-marks',
],
'dependencies' => [
* @return {jQuery} return.fieldset Fieldset
*/
mw.rcfilters.Controller.prototype._extractChangesListInfo = function ( $root ) {
- var info, isTimeout,
+ var info,
$changesListContents = $root.find( '.mw-changeslist' ).first().contents(),
areResults = !!$changesListContents.length;
};
if ( !areResults ) {
- isTimeout = !!$root.find( '.mw-changeslist-timeout' ).length;
- info.noResultsDetails = isTimeout ? 'NO_RESULTS_TIMEOUT' : 'NO_RESULTS_NORMAL';
+ if ( $root.find( '.mw-changeslist-timeout' ).length ) {
+ info.noResultsDetails = 'NO_RESULTS_TIMEOUT';
+ } else if ( $root.find( '.mw-changeslist-notargetpage' ).length ) {
+ info.noResultsDetails = 'NO_RESULTS_NO_TARGET_PAGE';
+ } else {
+ info.noResultsDetails = 'NO_RESULTS_NORMAL';
+ }
}
return info;
controller, savedQueriesModel, { $overlay: $overlay }
),
specialPage = mw.config.get( 'wgCanonicalSpecialPageName' ),
- $changesListRoot = $( '.mw-changeslist, .mw-changeslist-empty, .mw-changeslist-timeout' );
+ $changesListRoot = $( [
+ '.mw-changeslist',
+ '.mw-changeslist-empty',
+ '.mw-changeslist-timeout',
+ '.mw-changeslist-notargetpage'
+ ].join( ', ' ) );
// TODO: The changesListWrapperWidget should be able to initialize
// after the model is ready.
}
}
- // Temporarily hide any 'empty' or 'timeout' message while we
- // load rcfilters.
+ // Temporarily hide any specific 'no result' message while we load rcfilters.
.mw-changeslist-empty,
- .mw-changeslist-timeout {
+ .mw-changeslist-timeout,
+ .mw-changeslist-notargetpage {
display: none;
}
.oo-ui-dropdownWidget-handle {
border: 0;
background-color: transparent;
+ font-weight: bold;
}
}
}
mw.rcfilters.ui.ChangesListWrapperWidget.prototype.onModelUpdate = function (
$changesListContent, $fieldset, noResultsDetails, isInitialDOM, from
) {
- var conflictItem, noResultsKey,
+ var conflictItem,
$message = $( '<div>' )
.addClass( 'mw-rcfilters-ui-changesListWrapperWidget-results' ),
isEmpty = $changesListContent === 'NO_RESULTS',
.text( mw.message( conflictItem.getCurrentConflictResultMessage() ).text() )
);
} else {
- noResultsKey =
- ( noResultsDetails === 'NO_RESULTS_TIMEOUT' ) ?
- 'recentchanges-timeout' :
- ( noResultsDetails === 'NO_RESULTS_NETWORK_ERROR' ) ?
- 'recentchanges-network' :
- 'recentchanges-noresult';
-
$message
.append(
$( '<div>' )
.addClass( 'mw-rcfilters-ui-changesListWrapperWidget-results-noresult' )
- .text( mw.message( noResultsKey ).text() )
+ .text( mw.msg( this.getMsgKeyForNoResults( noResultsDetails ) ) )
);
this.$element.removeClass( 'mw-changeslist-timeout' );
+ this.$element.removeClass( 'mw-changeslist-notargetpage' );
}
this.$element.append( $message );
} );
};
+ /**
+ * Map a reason for having no results to its message key
+ *
+ * @param {string} reason One of the NO_RESULTS_* "constant" that represent
+ * a reason for having no results
+ * @return {string} Key for the message that explains why there is no results in this case
+ */
+ mw.rcfilters.ui.ChangesListWrapperWidget.prototype.getMsgKeyForNoResults = function ( reason ) {
+ var reasonMsgKeyMap = {
+ NO_RESULTS_NORMAL: 'recentchanges-noresult',
+ NO_RESULTS_TIMEOUT: 'recentchanges-timeout',
+ NO_RESULTS_NETWORK_ERROR: 'recentchanges-network',
+ NO_RESULTS_NO_TARGET_PAGE: 'recentchanges-notargetpage'
+ };
+ return reasonMsgKeyMap[ reason ];
+ };
/**
* Emphasize the elements (or groups) newer than the 'from' parameter
* @param {string} from Anything newer than this is considered 'new'
validate: false,
placeholder: mw.msg( 'rcfilters-target-page-placeholder' ),
showImages: true,
- showDescriptions: true
+ showDescriptions: true,
+ addQueryInput: false
} );
// Events
this.showLinkedFrom = new OO.ui.MenuOptionWidget( {
data: 'from', // default (showlinkedto=0)
- label: mw.msg( 'rcfilters-filter-showlinkedfrom-option-label' )
+ label: new OO.ui.HtmlSnippet( mw.msg( 'rcfilters-filter-showlinkedfrom-option-label' ) )
} );
this.showLinkedTo = new OO.ui.MenuOptionWidget( {
data: 'to', // showlinkedto=1
- label: mw.msg( 'rcfilters-filter-showlinkedto-option-label' )
+ label: new OO.ui.HtmlSnippet( mw.msg( 'rcfilters-filter-showlinkedto-option-label' ) )
} );
// Parent