1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Доработка компонентов

This commit is contained in:
Denis Shakhov 2014-11-10 19:47:55 +07:00
parent 2bd4ac36ba
commit eda4843dca
8 changed files with 129 additions and 60 deletions

View file

@ -171,7 +171,7 @@ class ActionAjax extends Action
$oViewer = $this->Viewer_GetLocalViewer();
$oViewer->Assign('sImageSrc', getRequestStr('image_src'));
$oViewer->Assign('image', getRequestStr('image_src'), true);
$this->Viewer_AssignAjax('sText', $oViewer->Fetch("components/crop/crop.tpl"));
}

View file

@ -146,9 +146,9 @@ class ActionPeople extends Action
* Формируем ответ
*/
$oViewer = $this->Viewer_GetLocalViewer();
$oViewer->Assign('usersList', $aResult['collection'], true);
$oViewer->Assign('users', $aResult['collection'], true);
$oViewer->Assign('oUserCurrent', $this->User_GetUserCurrent());
$oViewer->Assign('userListEmpty', $this->Lang_Get('search.alerts.empty'), true);
$oViewer->Assign('textEmpty', $this->Lang_Get('search.alerts.empty'), true);
$oViewer->Assign('useMore', true, true);
$oViewer->Assign('hideMore', $bHideMore, true);
$oViewer->Assign('searchCount', $aResult['count'], true);

View file

@ -67,7 +67,7 @@
<section class = "{$component} {mod name=$component mods=$mods} {$smarty.local.classes} open js-{$component}"
id = "comment{$commentId}"
data-id = "{$commentId}"
{$smarty.local.attributes}>
{foreach $smarty.local.attributes as $attr}{$attr@key}="{$attr@value}" {/foreach}>
{* Показываем удаленные комментарии только администраторам *}
{if ! $isDeleted || ( $oUserCurrent && $oUserCurrent->isAdministrator() )}

View file

@ -1,5 +1,8 @@
{**
* Ресайз загруженного изображения
*
* @param string $image
* @param array $sizes
*}
{extends 'components/modal/modal.tpl'}
@ -9,21 +12,25 @@
{block 'modal_title'}{lang 'modal_image_crop.title'}{/block}
{block 'modal_content'}
<div class="crop">
<div class="crop-image-holder js-crop-image-holder">
<img src="{$sImageSrc|escape}" style="width: 370px;" class="crop-image js-crop-image">
</div>
{$image = "{$smarty.local.image|escape}?v{rand( 0, 10e10 )}"}
<div class="crop-previews js-crop-previews">
{foreach [ 100, 64, 48 ] as $size}
<div style="width: {$size}px; height: {$size}px;" class="crop-preview js-crop-preview">
<img src="{$sImageSrc|escape}" class="js-crop-preview-image" data-size="{$size}">
</div>
{/foreach}
</div>
</div>
<div class="crop">
{* Изображение *}
<div class="crop-image-holder js-crop-image-holder">
<img src="{$image}" style="width: 370px;" class="crop-image js-crop-image">
</div>
{* Превью *}
<div class="crop-previews js-crop-previews">
{foreach [ 100, 64, 48 ] as $size}
<div style="width: {$size}px; height: {$size}px;" class="crop-preview js-crop-preview">
<img src="{$image}" class="js-crop-preview-image" data-size="{$size}">
</div>
{/foreach}
</div>
</div>
{/block}
{block 'modal_footer_begin'}
{include 'components/button/button.tpl' text=$aLang.common.save classes='js-ajax-image-crop-submit' mods='primary'}
{include 'components/button/button.tpl' text=$aLang.common.save classes='js-ajax-image-crop-submit' mods='primary'}
{/block}

View file

@ -96,5 +96,5 @@ form .icon-question-sign { cursor: help; }
/* Input File Replacer */
.form-input-file { position: relative; overflow: hidden; cursor: pointer; display: inline; }
.form-input-file input[type=file] { position: absolute; top: -999px; left: -999px; }
.form-input-file { position: relative; overflow: hidden; cursor: pointer; display: block; }
.form-input-file input[type=file] { position: absolute; top: 0; left: -200%; }

View file

@ -8,43 +8,56 @@
{extends 'components/block/block.tpl'}
{block 'block_options' append}
{$mods = "{$mods} user-photo"}
{$classes = "{$classes} js-ajax-photo-upload"}
{$mods = "{$mods} user-photo"}
{$classes = "{$classes} js-ajax-photo-upload"}
{/block}
{block 'block_content'}
<div class="profile-photo-wrapper">
{* Статус онлайн\оффлайн *}
{if $oSession}
{if $oUserProfile->isOnline() && $smarty.now - strtotime($oSession->getDateLast()) < 60*5}
<div class="status status-online">{$aLang.user.status.online}</div>
{else}
<div class="status status-offline">
{$date = {date_format date=$oSession->getDateLast() hours_back="12" minutes_back="60" day_back="8" now="60*5" day="day H:i" format="j F в G:i"}}
<div class="user-photo {if ! $oUserProfile->getProfileFoto()}user-photo--nophoto{/if} js-user-photo">
{* Статус онлайн\оффлайн *}
{if $oSession}
{if $oUserProfile->isOnline() && $smarty.now - strtotime($oSession->getDateLast()) < 60*5}
<div class="user-status user-status--online">{$aLang.user.status.online}</div>
{else}
<div class="user-status user-status--offline">
{$date = {date_format date=$oSession->getDateLast() hours_back="12" minutes_back="60" day_back="8" now="60*5" day="day H:i" format="j F в G:i"}}
{if $oUserProfile->getProfileSex() != 'woman'}
{lang name='user.status.was_online_male' date=$date}
{else}
{lang name='user.status.was_online_female' date=$date}
{/if}
</div>
{/if}
{/if}
{if $oUserProfile->getProfileSex() != 'woman'}
{lang 'user.status.was_online_male' date=$date}
{else}
{lang 'user.status.was_online_female' date=$date}
{/if}
</div>
{/if}
{/if}
{* Фото *}
<a href="{$oUserProfile->getUserWebPath()}">
<img src="{$oUserProfile->getProfileFotoPath()}" alt="{$oUserProfile->getDisplayName()} photo" class="profile-photo js-ajax-user-photo-image" />
</a>
</div>
{* Фото *}
<a href="{$oUserProfile->getUserWebPath()}">
<img src="{$oUserProfile->getProfileFotoPath()}" alt="{$oUserProfile->getDisplayName()} photo" class="user-photo-image js-ajax-user-photo-image" />
</a>
{if $oUserProfile->isAllowEdit()}
<p class="upload-photo">
<label for="photo" class="form-input-file">
<span class="js-ajax-user-photo-upload-choose link-dotted">{if $oUserProfile->getProfileFoto()}{lang 'user.blocks.photo.change_photo'}{else}{lang 'user.blocks.photo.upload_photo'}{/if}</span>
<input type="file" name="photo" id="photo" class="js-ajax-user-photo-upload" data-user-id="{$oUserProfile->getId()}">
</label>
<a href="#" data-user-id="{$oUserProfile->getId()}" class="js-ajax-user-avatar-change link-dotted" style="{if !$oUserProfile->getProfileFoto()}display:none;{/if}">{lang 'user.blocks.photo.change_avatar'}</a>
<a href="#" data-user-id="{$oUserProfile->getId()}" class="js-ajax-user-photo-upload-remove link-dotted" style="{if !$oUserProfile->getProfileFoto()}display:none;{/if}">{lang 'user.blocks.photo.remove'}</a>
</p>
{/if}
{* Действия (редактировать/удалить) *}
{if $oUserProfile->isAllowEdit()}
<ul class="user-photo-actions">
<li>
<label class="form-input-file">
<span class="js-ajax-user-photo-upload-choose">
{if $oUserProfile->getProfileFoto()}
{lang 'user.blocks.photo.change_photo'}
{else}
{lang 'user.blocks.photo.upload_photo'}
{/if}
</span>
<input type="file" name="photo" class="js-ajax-user-photo-upload" data-user-id="{$oUserProfile->getId()}">
</label>
</li>
<li data-user-id="{$oUserProfile->getId()}" class="js-ajax-user-avatar-change" style="{if !$oUserProfile->getProfileFoto()}display:none;{/if}">
{lang 'user.blocks.photo.change_avatar'}
</li>
<li data-user-id="{$oUserProfile->getId()}" class="js-ajax-user-photo-upload-remove" style="{if !$oUserProfile->getProfileFoto()}display:none;{/if}">
{lang 'user.blocks.photo.remove'}
</li>
</ul>
{/if}
</div>
{/block}

View file

@ -4,15 +4,62 @@
* @modifier user
* @template blocks/block.userPhoto.tpl
*/
.block--user-photo .block-content { padding: 0; }
.block--user-photo .profile-photo-wrapper { position: relative; min-width: 100%; min-height: 50px; display: inline-block; }
.block--user-photo .profile-photo { vertical-align: top; min-width: 100%; }
.block--user-photo .block-content {
padding: 0;
}
.user-photo {
position: relative;
min-width: 100%;
min-height: 50px;
display: inline-block;
}
.user-photo-image {
vertical-align: top;
max-width: 100%;
}
.user-photo--nophoto .user-photo-image {
width: 100%;
}
.block--user-photo .status { position: absolute; top: 20px; left: 0; padding: 12px 15px; font: 300 16px/1em 'Open Sans'; }
.block--user-photo .status.status-online { background: #b7bc1c; background: rgba(183, 188, 28, .8); color: #fff; }
.block--user-photo .status.status-offline { background: #333; background: rgba(0, 0, 0, .6); color: #fff; }
/* Статус (онлайн/оффлайн) */
.user-status {
position: absolute;
top: 20px;
left: 0;
padding: 12px 15px;
font: 300 16px/1em 'Open Sans';
}
.user-status--online {
background: #b7bc1c;
background: rgba(183, 188, 28, .8);
color: #fff;
}
.user-status--offline {
background: #333;
background: rgba(0, 0, 0, .6);
color: #fff;
}
.block--user-photo .upload-photo { padding: 7px 10px 10px; background: #f7f7f7; }
/* Действия */
.user-photo-actions {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 5px 0;
background: rgba( 0, 0, 0, .7 );
}
.user-photo-actions li {
padding: 7px 15px;
color: #bbb;
font-size: 13px;
cursor: pointer;
-webkit-transition: color .2s;
transition: color .2s;
}
.user-photo-actions li:hover {
color: #eee;
}
/**
* Блок управления на странице пользователя

View file

@ -118,7 +118,7 @@ ls.user = (function ($) {
// Мержим логины
oInput.val( $.richArray.unique($.merge(aLoginsOld, aLoginsAdd)).join(', ') );
console.log($('#modal-users-select'))
$('#modal-users-select').lsModal('hide');
});
@ -212,6 +212,7 @@ console.log($('#modal-users-select'))
if (result.bStateError) {
ls.msg.error(null,result.sMsg);
} else {
$('.js-user-photo').addClass('user-photo--nophoto');
$('.js-ajax-user-photo-image').attr('src',result.sFile);
$('.js-ajax-user-photo-upload-choose').html(result.sChooseText);
$('.js-ajax-user-photo-upload-remove').hide();
@ -231,6 +232,7 @@ console.log($('#modal-users-select'))
},
save_url : aRouter.settings+'ajax-crop-photo/',
save_callback : function(result, modal, image, previews) {
$('.js-user-photo').removeClass('user-photo--nophoto');
$('.js-ajax-user-photo-image').attr('src',result.sFile);
$('.js-ajax-user-photo-upload-choose').html(result.sChooseText);
$('.js-ajax-user-photo-upload-remove').show();