mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-28 00:01:05 +00:00
refactor(core): ♻️ use core data for search box
This commit is contained in:
parent
dfbaa67995
commit
d78ffeadb4
|
@ -73,23 +73,14 @@ final class Header extends Partial {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the search box
|
* Decorate search box template data
|
||||||
*
|
*
|
||||||
|
* @param array $searchBoxData original data-search-box
|
||||||
* @return array
|
* @return array
|
||||||
* @throws MWException
|
|
||||||
*/
|
*/
|
||||||
public function buildSearchProps(): array {
|
public function decorateSearchBoxData( $searchBoxData ): array {
|
||||||
$skin = $this->skin;
|
return $searchBoxData +=[
|
||||||
|
'msg-citizen-search-toggle-shortcut' => '[/]',
|
||||||
$toggleMsg = $skin->msg( 'citizen-search-toggle' )->text();
|
|
||||||
|
|
||||||
return [
|
|
||||||
// TODO: This should be called in skin.json
|
|
||||||
'msg-citizen-search-toggle' => $toggleMsg,
|
|
||||||
'msg-citizen-search-toggle-shortcut' => $toggleMsg . ' [/]',
|
|
||||||
'form-action' => $this->getConfigValue( 'Script' ),
|
|
||||||
'html-input' => $skin->makeSearchInput( [ 'id' => 'searchInput' ] ),
|
|
||||||
'page-title' => SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey(),
|
|
||||||
'html-random-href' => Skin::makeSpecialUrl( 'Randompage' ),
|
'html-random-href' => Skin::makeSpecialUrl( 'Randompage' ),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ class SkinCitizen extends SkinMustache {
|
||||||
// Data objects
|
// Data objects
|
||||||
'data-header' => [
|
'data-header' => [
|
||||||
'data-personal-menu' => $header->buildPersonalMenu(),
|
'data-personal-menu' => $header->buildPersonalMenu(),
|
||||||
'data-search-box' => $header->buildSearchProps(),
|
|
||||||
],
|
],
|
||||||
'data-sitestats' => $drawer->getSiteStatsData(),
|
'data-sitestats' => $drawer->getSiteStatsData(),
|
||||||
// HTML strings
|
// HTML strings
|
||||||
|
@ -109,6 +108,7 @@ class SkinCitizen extends SkinMustache {
|
||||||
'msg-citizen-footer-desc' => $this->msg( "citizen-footer-desc" )->inContentLanguage()->parse(),
|
'msg-citizen-footer-desc' => $this->msg( "citizen-footer-desc" )->inContentLanguage()->parse(),
|
||||||
'msg-citizen-footer-tagline' => $this->msg( "citizen-footer-tagline" )->inContentLanguage()->parse(),
|
'msg-citizen-footer-tagline' => $this->msg( "citizen-footer-tagline" )->inContentLanguage()->parse(),
|
||||||
// Decorate data provided by core
|
// Decorate data provided by core
|
||||||
|
'data-search-box' => $header->decorateSearchBoxData( $parentData['data-search-box'] ),
|
||||||
'data-portlets-sidebar' => $drawer->decorateSidebarData( $parentData['data-portlets-sidebar'] ),
|
'data-portlets-sidebar' => $drawer->decorateSidebarData( $parentData['data-portlets-sidebar'] ),
|
||||||
'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ),
|
'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ),
|
||||||
];
|
];
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
"citizen-drawer-toggle",
|
"citizen-drawer-toggle",
|
||||||
"citizen-languages-toggle",
|
"citizen-languages-toggle",
|
||||||
"citizen-personalmenu-toggle",
|
"citizen-personalmenu-toggle",
|
||||||
|
"citizen-search-toggle",
|
||||||
"randompage",
|
"randompage",
|
||||||
"search",
|
"search",
|
||||||
"sitetitle"
|
"sitetitle"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{!
|
{{!
|
||||||
string msg-citizen-search-toggle-shortcut message with shortcut key for search toggle
|
string msg-citizen-search-toggle-shortcut shortcut key message
|
||||||
string msg-citizen-search-toggle tooltip message for search toggle
|
string msg-citizen-search-toggle tooltip message for search toggle
|
||||||
}}
|
}}
|
||||||
<div class="citizen-search__button citizen-header__button">
|
<div class="citizen-search__button citizen-header__button">
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
id="citizen-search__buttonCheckbox"
|
id="citizen-search__buttonCheckbox"
|
||||||
class="mw-checkbox-hack-button citizen-header__buttonCheckbox"
|
class="mw-checkbox-hack-button citizen-header__buttonCheckbox"
|
||||||
for="citizen-search__checkbox"
|
for="citizen-search__checkbox"
|
||||||
title="{{msg-citizen-search-toggle-shortcut}}"
|
title="{{msg-citizen-search-toggle}} {{msg-citizen-search-toggle-shortcut}}"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<span>{{msg-citizen-search-toggle}}</span>
|
<span>{{msg-citizen-search-toggle}}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
Loading…
Reference in a new issue