1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-16 21:34:25 +03:00
ifhub.club/application/frontend/components/favourite/favourite.tpl

42 lines
1.4 KiB
Smarty
Raw Normal View History

{**
* Добавление в избранное
*
2016-01-19 04:34:44 +02:00
* @param object $target Объект который добавляется в избранное
* @param boolean $hideZeroCounter
*}
{* Название компонента *}
{$component = 'ls-favourite'}
2016-01-19 04:34:44 +02:00
{component_define_params params=[ 'target', 'hideZeroCounter', 'mods', 'classes', 'attributes' ]}
{* True если объект находится в избранном *}
{$isActive = $target && $target->getIsFavourite()}
{* Кол-во объектов в избранном *}
{$count = $target->getCountFavourite()}
{* Добавляем модификаторы *}
{if $count}
{$mods = "$mods has-counter"}
{/if}
{if $isActive}
{$mods = "$mods added"}
{/if}
2016-01-19 04:34:44 +02:00
<div class="{$component} {cmods name=$component mods=$mods} {if $isActive}active{/if} {$classes}"
2015-10-27 11:02:57 +02:00
data-param-i-target-id="{$target->getId()}"
title="{$aLang.favourite[ ($isActive) ? 'remove' : 'add' ]}"
2016-01-19 04:34:44 +02:00
{cattr list=$attributes}>
2015-10-27 11:02:57 +02:00
{* Кнопка добавления/удаления из избранного *}
{component 'icon' icon='heart' classes="{$component}-toggle js-favourite-toggle"}
{* Кол-во объектов в избранном *}
{if isset( $count )}
2016-01-19 04:34:44 +02:00
<span class="{$component}-count js-favourite-count" {if ! $count && $hideZeroCounter|default:true}style="display: none;"{/if}>
2015-10-27 11:02:57 +02:00
{$count}
</span>
{/if}
</div>