mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-24 00:13:28 +00:00
refactor: convert part of HTML to Mustache
This commit is contained in:
parent
bd5738afe8
commit
e85d4785b1
|
@ -19,6 +19,7 @@ use JsonException;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
use Parser;
|
use Parser;
|
||||||
use PPFrame;
|
use PPFrame;
|
||||||
|
use TemplateParser;
|
||||||
use Sanitizer;
|
use Sanitizer;
|
||||||
|
|
||||||
class Tabber {
|
class Tabber {
|
||||||
|
@ -107,11 +108,13 @@ class Tabber {
|
||||||
return sprintf( '[%s]', $tabpanels );
|
return sprintf( '[%s]', $tabpanels );
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<div id='tabber-$count' class='tabber tabber--init'>" .
|
$templateParser = new TemplateParser( __DIR__ . '/templates' );
|
||||||
'<header class="tabber__header"><button class="tabber__header__prev" aria-hidden="true"></button>' .
|
$data = [
|
||||||
'<nav class="tabber__tabs" role="tablist">' . $tabs . '</nav>' .
|
'count' => $count,
|
||||||
'<button class="tabber__header__next" aria-hidden="true"></button></header>' .
|
'html-tabs' => $tabs,
|
||||||
'<section class="tabber__section">' . $tabpanels . '</section></div>';
|
'html-tabpanels' => $tabpanels
|
||||||
|
];
|
||||||
|
return $templateParser->processTemplate( 'Tabber', $data );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
13
includes/templates/Tabber.mustache
Normal file
13
includes/templates/Tabber.mustache
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{{!
|
||||||
|
int count Current Tabber count
|
||||||
|
string html-tabs
|
||||||
|
string html-tabpanels
|
||||||
|
}}
|
||||||
|
<div id="tabber-{{count}}" class='tabber tabber--init'>
|
||||||
|
<header class="tabber__header">
|
||||||
|
<button class="tabber__header__prev" aria-hidden="true"></button>
|
||||||
|
<nav class="tabber__tabs" role="tablist">{{{html-tabs}}}</nav>
|
||||||
|
<button class="tabber__header__next" aria-hidden="true"></button>
|
||||||
|
</header>
|
||||||
|
<section class="tabber__section">{{{html-tabpanels}}}</section>
|
||||||
|
</div>
|
Loading…
Reference in a new issue