Commit a227a1f08ed7e1c33ea73b10c7bb720a18a33fb8
1 parent
1f6e9673
Скрытые фильтры в категориях
Showing
3 changed files
with
75 additions
and
1 deletions
Show diff stats
frontend/views/category/view.php
... | ... | @@ -124,7 +124,6 @@ _________________________________________________________ --> |
124 | 124 | ); |
125 | 125 | } |
126 | 126 | ?> |
127 | - | |
128 | 127 | <?php |
129 | 128 | $brands = $filterHelper->getBrands($model); |
130 | 129 | if (!empty($brands)) { |
... | ... | @@ -212,6 +211,19 @@ _________________________________________________________ --> |
212 | 211 | <div class="panel-body"> |
213 | 212 | <div class="form-group"> |
214 | 213 | <?php |
214 | + $firstsix = 0; | |
215 | + $buthiddenmore = Html::tag('div', | |
216 | + Html::a( | |
217 | + 'Ещё', | |
218 | + '#', | |
219 | + [ | |
220 | + 'class' => 'btn btn-primary btn-xs', | |
221 | + ] | |
222 | + ), | |
223 | + [ | |
224 | + 'class' => 'hiddens-button', | |
225 | + ] | |
226 | + ); | |
215 | 227 | foreach ($group->options as $option) { |
216 | 228 | /** |
217 | 229 | * @var Product $product |
... | ... | @@ -232,8 +244,46 @@ _________________________________________________________ --> |
232 | 244 | ) ? 'radio-but checked' : 'radio-but', |
233 | 245 | ] |
234 | 246 | ); |
247 | + $firstsix++; | |
248 | + if($firstsix == 6) break; | |
235 | 249 | } |
236 | 250 | ?> |
251 | + <div class="hiddens"> | |
252 | + <?php | |
253 | + $nextsix = 0; | |
254 | + foreach ($group->options as $option) { | |
255 | + /** | |
256 | + * @var Product $product | |
257 | + */ | |
258 | + $nextsix++; | |
259 | + if($nextsix>6){ | |
260 | + echo Html::tag( | |
261 | + 'div', | |
262 | + Html::a( | |
263 | + $option->lang->value, | |
264 | + [ | |
265 | + '/category/view', | |
266 | + 'category' => $model->lang->alias->value, | |
267 | + 'filter' => $filterHelper->buildLink($option), | |
268 | + ] | |
269 | + ), | |
270 | + [ | |
271 | + 'class' => $filterHelper->has( | |
272 | + $option->lang->alias->value | |
273 | + ) ? 'radio-but checked' : 'radio-but', | |
274 | + ] | |
275 | + ); | |
276 | + } | |
277 | + } | |
278 | + if($nextsix>6){ | |
279 | + $morebutton = $buthiddenmore; | |
280 | + } | |
281 | + else{ | |
282 | + $morebutton = ''; | |
283 | + } | |
284 | + ?> | |
285 | + </div> | |
286 | + <?php echo $morebutton;?> | |
237 | 287 | </div> |
238 | 288 | </div> |
239 | 289 | </div> | ... | ... |
frontend/web/css/style.css
... | ... | @@ -4896,4 +4896,20 @@ button.price-apply{ |
4896 | 4896 | |
4897 | 4897 | button.price-apply:hover{ |
4898 | 4898 | background-color:#005bac; |
4899 | +} | |
4900 | + | |
4901 | +.sidebar-menu .form-group .hiddens { | |
4902 | + height: 0px; | |
4903 | + overflow: hidden; | |
4904 | +} | |
4905 | + | |
4906 | +.sidebar-menu .form-group .hiddens.active { | |
4907 | + height: inherit; | |
4908 | +} | |
4909 | + | |
4910 | +.hiddens-button a.btn{ | |
4911 | + padding: 5px 20px; | |
4912 | + min-width: 75px; | |
4913 | + border-radius: 15px; | |
4914 | + margin: 20px 0 0; | |
4899 | 4915 | } |
4900 | 4916 | \ No newline at end of file | ... | ... |
frontend/web/js/script.js
... | ... | @@ -371,6 +371,14 @@ $(function() { |
371 | 371 | $('.vcovers') |
372 | 372 | .perfectScrollbar({wheelSpeed: 0.5}); |
373 | 373 | |
374 | + $(document).on('click', '.sidebar-menu .form-group .hiddens-button a.btn', function(){ | |
375 | + $(this).parent().parent().find(".hiddens").toggleClass("active"); | |
376 | + $(this).text(function(i, text){ | |
377 | + return text === "Ещё" ? "Скрыть" : "Ещё"; | |
378 | + }); | |
379 | + return false; | |
380 | + }); | |
381 | + | |
374 | 382 | }); |
375 | 383 | function showLoader(container) { |
376 | 384 | $(container) | ... | ... |