From: Andrey Kutejko Date: Sun, 22 Apr 2018 19:57:50 +0000 (+0200) Subject: render filters X-Git-Tag: 0.6~11 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=288c9e0fea8c36d5a07d8328d83d8af5f7d89a17;p=ipf.git render filters --- diff --git a/ipf/admin/component.php b/ipf/admin/component.php index 6986d0a..fd52693 100644 --- a/ipf/admin/component.php +++ b/ipf/admin/component.php @@ -1,10 +1,13 @@ request->GET; + $paramName = $filter->paramName(); + + $ul = Tag::ul(); + foreach ($filter->getItems() as $item) { + unset($params[$paramName]); + if ($item['id'] !== null) { + $params[$paramName] = $item['id']; + } + $url = '?'.IPF_HTTP_URL::generateParams($params, false); + + $ul->append(Tag::li() + ->toggleClass('selected', $item['selected']) + ->append(Tag::a() + ->attr('href', $url) + ->append($item['label']) + ) + ); + } + + return $ul->html(); + } +} diff --git a/ipf/admin/templates/admin/items.html b/ipf/admin/templates/admin/items.html index e6786ee..bbf31c8 100644 --- a/ipf/admin/templates/admin/items.html +++ b/ipf/admin/templates/admin/items.html @@ -40,7 +40,7 @@

Filter

{foreach $filters as $f}

{$f->title()}

- {$f->render($request->GET)|safe} + {$component->renderFilter($f)|safe} {/foreach} {/if}