mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-04-25 13:39:22 +03:00
Доработка компонента user
This commit is contained in:
parent
b03c548497
commit
75b373839e
|
@ -16,4 +16,4 @@
|
|||
mods = 'blog-users'
|
||||
title = $smarty.capture.block_title
|
||||
titleUrl = "{$blog->getUrlFull()}users/"
|
||||
content = {component 'user' template='list-avatar' users=$blogUsers}}
|
||||
content = {component 'user' template='avatar-list' users=$blogUsers blankslateParams=[ 'mods' => 'no-background' ]}}
|
|
@ -0,0 +1,20 @@
|
|||
{**
|
||||
* Список пользователей (аватары)
|
||||
*
|
||||
* @param array $users Список пользователей
|
||||
* @param array $pagination Массив с параметрами пагинации
|
||||
* @param array $emptyText
|
||||
*}
|
||||
|
||||
{$items = []}
|
||||
|
||||
{foreach $users as $user}
|
||||
{* TODO: Костыль для блогов *}
|
||||
{if $user->getUser()}{$user = $user->getUser()}{/if}
|
||||
|
||||
{$items[] = {component 'user' template='avatar' size=$smarty.local.size|default:'small' user=$user}}
|
||||
{/foreach}
|
||||
|
||||
{component 'avatar' template='list' items=$items params=$smarty.local.params}
|
||||
|
||||
{component 'pagination' total=+$pagination.iCountPage current=+$pagination.iCurrentPage url="{$pagination.sBaseUrl}/page__page__/"}
|
26
application/frontend/components/user/avatar/user-avatar.tpl
Normal file
26
application/frontend/components/user/avatar/user-avatar.tpl
Normal file
|
@ -0,0 +1,26 @@
|
|||
{**
|
||||
* Блок с аватаркой и именем пользователя
|
||||
*
|
||||
* @param object $user
|
||||
* @param string $classes
|
||||
* @param array $attributes
|
||||
* @param array $mods
|
||||
*}
|
||||
|
||||
{$sizes = [
|
||||
'large' => 200,
|
||||
'default' => 100,
|
||||
'small' => 64,
|
||||
'xsmall' => 48,
|
||||
'xxsmall' => 24,
|
||||
'text' => 18
|
||||
]}
|
||||
|
||||
{$user = $smarty.local.user}
|
||||
|
||||
{component 'avatar'
|
||||
image = $user->getProfileAvatarPath( $sizes[ $smarty.local.size|default:'default' ] )
|
||||
url = $user->getUserWebPath()
|
||||
classes = 'user-item'
|
||||
name = $user->getDisplayName()
|
||||
params = $smarty.local.params}
|
|
@ -2,7 +2,25 @@
|
|||
* Статистика по пользователям
|
||||
*}
|
||||
|
||||
{capture 'user_block_stat'}
|
||||
<div class="user-stat">
|
||||
{* Кол-во пользователей *}
|
||||
{component 'info-list' list=[
|
||||
[ 'label' => "{lang name='user.stats.all'}:", 'content' => $usersStat.count_all ],
|
||||
[ 'label' => "{lang name='user.stats.active'}:", 'content' => $usersStat.count_active ],
|
||||
[ 'label' => "{lang name='user.stats.not_active'}:", 'content' => $usersStat.count_inactive ]
|
||||
]}
|
||||
|
||||
{* Пол *}
|
||||
{component 'info-list' list=[
|
||||
[ 'label' => "{lang name='user.stats.men'}:", 'content' => $usersStat.count_sex_man ],
|
||||
[ 'label' => "{lang name='user.stats.women'}:", 'content' => $usersStat.count_sex_woman ],
|
||||
[ 'label' => "{lang name='user.stats.none'}:", 'content' => $usersStat.count_sex_other ]
|
||||
]}
|
||||
</div>
|
||||
{/capture}
|
||||
|
||||
{component 'block'
|
||||
mods = 'info users-stats'
|
||||
title = {lang 'user.stats.title'}
|
||||
content = {component 'user' template='stat' stat=$usersStat}}
|
||||
content = $smarty.capture.user_block_stat}
|
|
@ -8,10 +8,10 @@
|
|||
"button": "*",
|
||||
"field": "*",
|
||||
"photo": "*",
|
||||
"avatar": "*",
|
||||
"alert": "*"
|
||||
},
|
||||
"templates": {
|
||||
"list": "user-list.tpl",
|
||||
"actions": "actions.tpl",
|
||||
"header": "header.tpl",
|
||||
"friend-item": "friend-item.tpl",
|
||||
|
@ -19,10 +19,14 @@
|
|||
"info": "info.tpl",
|
||||
"search-form": "search-form.users.tpl",
|
||||
"stat": "stat.tpl",
|
||||
"item": "user-item.tpl",
|
||||
"list-avatar": "user-list-avatar.tpl",
|
||||
"list-item": "user-list-item.tpl",
|
||||
"list-loop": "user-list-loop.tpl",
|
||||
|
||||
"avatar": "avatar/user-avatar.tpl",
|
||||
"avatar-list": "avatar/user-avatar-list.tpl",
|
||||
|
||||
"list": "list/user-list.tpl",
|
||||
"list-item": "list/user-list-item.tpl",
|
||||
"list-loop": "list/user-list-loop.tpl",
|
||||
|
||||
"list-small-item": "user-list-small-item.tpl",
|
||||
"list-small": "user-list-small.tpl",
|
||||
|
||||
|
@ -52,8 +56,6 @@
|
|||
"styles": {
|
||||
"blocks": "css/user-blocks.css",
|
||||
"header": "css/user-header.css",
|
||||
"item": "css/user-item.css",
|
||||
"list-avatar": "css/user-list-avatar.css",
|
||||
"list-small": "css/user-list-small.css",
|
||||
"user": "css/user.css"
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* Блок с аватарой и логином пользователя
|
||||
*
|
||||
* @template user-item.tpl
|
||||
*/
|
||||
|
||||
.user-item {
|
||||
display: inline-block;
|
||||
}
|
||||
.user-item-avatar {
|
||||
vertical-align: middle;
|
||||
margin-right: 2px;
|
||||
}
|
||||
.user-item-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
.user-item--rounded .user-item-avatar {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.user-item.inactive {
|
||||
opacity: .5;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
/**
|
||||
* Список пользователей
|
||||
*
|
||||
* @template user_list_avatar.tpl
|
||||
*/
|
||||
.user-list-avatar { overflow: hidden; zoom: 1; }
|
||||
.user-list-avatar li { width: 64px; overflow: hidden; float: left; margin-right: 20px; margin-bottom: 15px; text-align: center; }
|
||||
.user-list-avatar .user-item-avatar { margin-bottom: 2px; margin-right: 0; display: block; }
|
||||
.user-list-avatar .user-item-name { font-size: 11px; font-weight: normal; }
|
|
@ -217,7 +217,7 @@
|
|||
*}
|
||||
{if $smarty.local.friends}
|
||||
{capture 'user_info_friends'}
|
||||
{component 'user' template='list-avatar' users=$smarty.local.friends}
|
||||
{component 'user' template='avatar-list' users=$smarty.local.friends}
|
||||
{/capture}
|
||||
|
||||
{component 'user' template='info-group'
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{$stat = $smarty.local.stat}
|
||||
|
||||
<div class="user-stat">
|
||||
{* Кол-во пользователей *}
|
||||
{component 'info-list' list=[
|
||||
[ 'label' => "{lang name='user.stats.all'}:", 'content' => $stat.count_all ],
|
||||
[ 'label' => "{lang name='user.stats.active'}:", 'content' => $stat.count_active ],
|
||||
[ 'label' => "{lang name='user.stats.not_active'}:", 'content' => $stat.count_inactive ]
|
||||
]}
|
||||
|
||||
{* Пол *}
|
||||
{component 'info-list' list=[
|
||||
[ 'label' => "{lang name='user.stats.men'}:", 'content' => $stat.count_sex_man ],
|
||||
[ 'label' => "{lang name='user.stats.women'}:", 'content' => $stat.count_sex_woman ],
|
||||
[ 'label' => "{lang name='user.stats.none'}:", 'content' => $stat.count_sex_other ]
|
||||
]}
|
||||
</div>
|
|
@ -1,26 +0,0 @@
|
|||
{**
|
||||
* Блок с аватаркой и именем пользователя
|
||||
*
|
||||
* @param object $user
|
||||
* @param integer $avatarSize
|
||||
*
|
||||
* @param string $classes
|
||||
* @param array $attributes
|
||||
* @param array $mods
|
||||
*}
|
||||
|
||||
{$component = 'user-item'}
|
||||
|
||||
{$user = $smarty.local.user}
|
||||
|
||||
<div class="{$component} {cmods name=$component mods=$smarty.local.mods} {$smarty.local.classes}"
|
||||
{cattr list=$smarty.local.attributes}>
|
||||
|
||||
<a href="{$user->getUserWebPath()}" class="{$component}-avatar-link">
|
||||
<img src="{$user->getProfileAvatarPath( $smarty.local.avatarSize|default:24 )}" alt="{$user->getLogin()}" class="{$component}-avatar" />
|
||||
</a>
|
||||
|
||||
<a href="{$user->getUserWebPath()}" class="{$component}-name">
|
||||
{$user->getDisplayName()}
|
||||
</a>
|
||||
</div>
|
|
@ -1,28 +0,0 @@
|
|||
{**
|
||||
* Список пользователей (аватары)
|
||||
*
|
||||
* @param array $users Список пользователей
|
||||
* @param array $pagination Массив с параметрами пагинации
|
||||
* @param array $emptyText
|
||||
*}
|
||||
|
||||
{$users = $smarty.local.users}
|
||||
{$pagination = $smarty.local.pagination}
|
||||
{$emptyText = $smarty.local.emptyText}
|
||||
|
||||
{$emptyText = $emptyText|default:$aLang.common.empty}
|
||||
|
||||
{if $users}
|
||||
<ul class="user-list-avatar">
|
||||
{foreach $users as $user}
|
||||
{* TODO: Костыль для блогов *}
|
||||
{if $user->getUser()}{$user = $user->getUser()}{/if}
|
||||
|
||||
<li>{component 'user' template='item' user=$user avatarSize=64}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
{component 'blankslate' text=$emptyText}
|
||||
{/if}
|
||||
|
||||
{component 'pagination' total=+$pagination.iCountPage current=+$pagination.iCurrentPage url="{$pagination.sBaseUrl}/page__page__/"}
|
|
@ -28,6 +28,6 @@
|
|||
|
||||
{* Пользователь *}
|
||||
{block 'user_list_small_item_content'}
|
||||
{component 'user' template='item' user=$user}
|
||||
{component 'user' template='avatar' size='xxsmall' mods='inline' user=$user}
|
||||
{/block}
|
||||
</li>
|
Loading…
Reference in a new issue