mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Automatically set selected current one on highscores filters
This commit is contained in:
parent
c49c9d99a9
commit
e96227fbe4
@ -35,11 +35,12 @@ $settingHighscoresVocationBox = setting('core.highscores_vocation_box');
|
|||||||
$configVocations = config('vocations');
|
$configVocations = config('vocations');
|
||||||
$configVocationsAmount = config('vocations_amount');
|
$configVocationsAmount = config('vocations_amount');
|
||||||
|
|
||||||
if($settingHighscoresVocationBox && $vocation !== 'all')
|
$vocationId = null;
|
||||||
{
|
if($settingHighscoresVocationBox && $vocation !== 'all') {
|
||||||
foreach($configVocations as $id => $name) {
|
foreach($configVocations as $id => $name) {
|
||||||
if(strtolower($name) == $vocation) {
|
if(strtolower($name) == $vocation) {
|
||||||
$add_vocs = array($id);
|
$vocationId = $id;
|
||||||
|
$add_vocs = [$id];
|
||||||
|
|
||||||
$i = $id + $configVocationsAmount;
|
$i = $id + $configVocationsAmount;
|
||||||
while(isset($configVocations[$i])) {
|
while(isset($configVocations[$i])) {
|
||||||
@ -287,6 +288,7 @@ $twig->display('highscores.html.twig', [
|
|||||||
'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))),
|
'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))),
|
||||||
'levelName' => ($skill != SKILL_FRAGS && $skill != SKILL_BALANCE ? 'Level' : ($skill == SKILL_BALANCE ? 'Balance' : 'Frags')),
|
'levelName' => ($skill != SKILL_FRAGS && $skill != SKILL_BALANCE ? 'Level' : ($skill == SKILL_BALANCE ? 'Balance' : 'Frags')),
|
||||||
'vocation' => $vocation !== 'all' ? $vocation : null,
|
'vocation' => $vocation !== 'all' ? $vocation : null,
|
||||||
|
'vocationId' => $vocationId,
|
||||||
'types' => $types,
|
'types' => $types,
|
||||||
'linkPreviousPage' => $linkPreviousPage,
|
'linkPreviousPage' => $linkPreviousPage,
|
||||||
'linkNextPage' => $linkNextPage,
|
'linkNextPage' => $linkNextPage,
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<select onchange="location = this.value;" aria-label="skillFilter" id="skillFilter">
|
<select onchange="location = this.value;" aria-label="skillFilter" id="skillFilter">
|
||||||
{% set i = 0 %}
|
{% set i = 0 %}
|
||||||
{% for link, name in types %}
|
{% for link, name in types %}
|
||||||
<option value="{{ getLink('highscores') }}/{{ link }}{% if vocation is not null %}{{ vocation }}{% endif %}" class="size_xs">{{ name }}</option>
|
<option value="{{ getLink('highscores') }}/{{ link }}/{% if vocation is not null %}{{ vocation }}{% endif %}" class="size_xs" {% if list is not null and list == link %}selected{% endif %}>{{ name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<option value="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</option>
|
<option value="{{ getLink('highscores') }}/{{ list }}" class="size_xs">[ALL]</option>
|
||||||
{% set i = 0 %}
|
{% set i = 0 %}
|
||||||
{% for i in 1..config.vocations_amount %}
|
{% for i in 1..config.vocations_amount %}
|
||||||
<option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs">{{ config.vocations[i]}}</option>
|
<option value="{{ getLink('highscores') }}/{{ list }}/{{ config.vocations[i]|lower }}" class="size_xs" {% if vocationId is not null and vocationId == i %}selected{% endif %}>{{ config.vocations[i]}}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user