From a227a1f08ed7e1c33ea73b10c7bb720a18a33fb8 Mon Sep 17 00:00:00 2001 From: Eugeny Galkovskiy Date: Wed, 7 Jun 2017 13:49:19 +0300 Subject: [PATCH] Скрытые фильтры в категориях --- frontend/views/category/view.php | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- frontend/web/css/style.css | 16 ++++++++++++++++ frontend/web/js/script.js | 8 ++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/frontend/views/category/view.php b/frontend/views/category/view.php index 46efa2c..02ecafc 100755 --- a/frontend/views/category/view.php +++ b/frontend/views/category/view.php @@ -124,7 +124,6 @@ _________________________________________________________ --> ); } ?> - getBrands($model); if (!empty($brands)) { @@ -212,6 +211,19 @@ _________________________________________________________ -->
'btn btn-primary btn-xs', + ] + ), + [ + 'class' => 'hiddens-button', + ] + ); foreach ($group->options as $option) { /** * @var Product $product @@ -232,8 +244,46 @@ _________________________________________________________ --> ) ? 'radio-but checked' : 'radio-but', ] ); + $firstsix++; + if($firstsix == 6) break; } ?> +
+ options as $option) { + /** + * @var Product $product + */ + $nextsix++; + if($nextsix>6){ + echo Html::tag( + 'div', + Html::a( + $option->lang->value, + [ + '/category/view', + 'category' => $model->lang->alias->value, + 'filter' => $filterHelper->buildLink($option), + ] + ), + [ + 'class' => $filterHelper->has( + $option->lang->alias->value + ) ? 'radio-but checked' : 'radio-but', + ] + ); + } + } + if($nextsix>6){ + $morebutton = $buthiddenmore; + } + else{ + $morebutton = ''; + } + ?> +
+
diff --git a/frontend/web/css/style.css b/frontend/web/css/style.css index 9939720..6281b69 100755 --- a/frontend/web/css/style.css +++ b/frontend/web/css/style.css @@ -4896,4 +4896,20 @@ button.price-apply{ button.price-apply:hover{ background-color:#005bac; +} + +.sidebar-menu .form-group .hiddens { + height: 0px; + overflow: hidden; +} + +.sidebar-menu .form-group .hiddens.active { + height: inherit; +} + +.hiddens-button a.btn{ + padding: 5px 20px; + min-width: 75px; + border-radius: 15px; + margin: 20px 0 0; } \ No newline at end of file diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index e91ea18..e29cc59 100755 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -371,6 +371,14 @@ $(function() { $('.vcovers') .perfectScrollbar({wheelSpeed: 0.5}); + $(document).on('click', '.sidebar-menu .form-group .hiddens-button a.btn', function(){ + $(this).parent().parent().find(".hiddens").toggleClass("active"); + $(this).text(function(i, text){ + return text === "Ещё" ? "Скрыть" : "Ещё"; + }); + return false; + }); + }); function showLoader(container) { $(container) -- libgit2 0.21.4