mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Доработка компонента blog
This commit is contained in:
parent
8fc5386cab
commit
0111d4798d
|
@ -1884,7 +1884,7 @@ class ActionBlog extends Action
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$sBlogId = getRequestStr('idBlog', null, 'post');
|
||||
$sBlogId = getRequestStr('blog_id', null, 'post');
|
||||
/**
|
||||
* Определяем тип блога и получаем его
|
||||
*/
|
||||
|
@ -1907,7 +1907,7 @@ class ActionBlog extends Action
|
|||
if ($sBlogId == 0) {
|
||||
$sText = $this->Lang_Get('blog.personal_description');
|
||||
}
|
||||
$this->Viewer_AssignAjax('sText', $sText);
|
||||
$this->Viewer_AssignAjax('text', $sText);
|
||||
} else {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
|
@ -1933,7 +1933,7 @@ class ActionBlog extends Action
|
|||
/**
|
||||
* Блог существует?
|
||||
*/
|
||||
$idBlog = getRequestStr('idBlog', null, 'post');
|
||||
$idBlog = getRequestStr('blog_id', null, 'post');
|
||||
if (!($oBlog = $this->Blog_GetBlogById($idBlog))) {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
|
|
|
@ -503,12 +503,10 @@ $config['head']['default']['js'] = array(
|
|||
"___path.skin.web___/components/ls-vendor/jquery.jqplugin.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.cookie.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.serializejson.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.file.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.hotkeys.js",
|
||||
"___path.skin.web___/components/ls-vendor/jcrop/jquery.Jcrop.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.placeholder.min.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.charcount.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.imagesloaded.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.fileupload.js",
|
||||
"___path.skin.web___/components/ls-vendor/jquery.timers.js",
|
||||
"___path.skin.web___/components/ls-vendor/prettify/prettify.js",
|
||||
|
@ -525,7 +523,6 @@ $config['head']['default']['js'] = array(
|
|||
"___path.skin.web___/components/ls-core/dev.js",
|
||||
"___path.skin.web___/components/ls-core/hook.js",
|
||||
"___path.skin.web___/components/ls-core/i18n.js",
|
||||
"___path.skin.web___/components/ls-core/ie.js",
|
||||
"___path.skin.web___/components/ls-core/ajax.js",
|
||||
"___path.skin.web___/components/ls-core/registry.js",
|
||||
"___path.skin.web___/components/ls-core/utils.js",
|
||||
|
@ -556,6 +553,8 @@ $config['head']['default']['js'] = array(
|
|||
"___path.skin.web___/components/wall/js/wall-entry.js",
|
||||
"___path.skin.web___/components/blog/js/blog.js",
|
||||
"___path.skin.web___/components/blog/js/blog-invites.js",
|
||||
"___path.skin.web___/components/blog/js/blog-join.js",
|
||||
"___path.skin.web___/components/blog/js/blog-info.js",
|
||||
"___path.skin.web___/components/poll/js/poll.js",
|
||||
"___path.skin.web___/components/poll/js/poll-manage.js",
|
||||
"___path.skin.web___/components/more/js/more.js",
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
{/block}
|
||||
|
||||
{block 'layout_content_header'}
|
||||
{include 'components/blog/blog.tpl' blog=$oBlog}
|
||||
{include 'components/blog/blog.tpl' blog=$oBlog blogs=$aBlogs}
|
||||
|
||||
{$smarty.block.parent}
|
||||
|
||||
|
|
|
@ -22,6 +22,15 @@ jQuery(document).ready(function($){
|
|||
ls.dev.init();
|
||||
|
||||
|
||||
/**
|
||||
* IE
|
||||
*/
|
||||
if ( $( 'html' ).hasClass( 'oldie' ) ) {
|
||||
// Эмуляция placeholder'ов в IE
|
||||
$( 'input[type=text], textarea' ).placeholder();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Actionbar
|
||||
*/
|
||||
|
@ -386,6 +395,52 @@ jQuery(document).ready(function($){
|
|||
// Приглашение пользователей в блог
|
||||
$('.js-user-list-add-blog-invite').lsBlogInvites();
|
||||
|
||||
// Информация о блоге
|
||||
$('.js-blog-info').lsBlogInfo({
|
||||
urls: {
|
||||
load: aRouter.blog + 'ajaxbloginfo'
|
||||
},
|
||||
selectors: {
|
||||
select: '.js-topic-add-title'
|
||||
}
|
||||
});
|
||||
|
||||
// Вступить/покинуть блог
|
||||
$('.js-blog-join').lsBlogJoin({
|
||||
urls: {
|
||||
toggle: aRouter.blog + 'ajaxblogjoin'
|
||||
}
|
||||
});
|
||||
|
||||
// Поиск
|
||||
$( '.js-search-ajax-blog' ).lsSearchAjax({
|
||||
urls: {
|
||||
search: aRouter.blogs + 'ajax-search/'
|
||||
},
|
||||
filters : [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'sText',
|
||||
selector: '.js-search-text-main'
|
||||
},
|
||||
{
|
||||
type: 'radio',
|
||||
name: 'type',
|
||||
selector: '.js-search-ajax-blog-type'
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'category',
|
||||
selector: '#js-search-ajax-blog-category li'
|
||||
},
|
||||
{
|
||||
type: 'sort',
|
||||
name: 'sort_by',
|
||||
selector: '.js-search-sort-menu li'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Topic
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
{block 'block_type'}blog-actions{/block}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-actions"}
|
||||
{$mods = "{$mods} blog-actions"}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
<a href="{$oBlog->getUrlFull()}">
|
||||
<img src="{$oBlog->getAvatarPath(500)}" alt="{$oBlog->getTitle()|escape}" class="avatar" />
|
||||
</a>
|
||||
<a href="{$oBlog->getUrlFull()}">
|
||||
<img src="{$oBlog->getAvatarPath(500)}" alt="{$oBlog->getTitle()|escape}" class="avatar" />
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
{block 'block_footer'}
|
||||
{* Подписаться через RSS *}
|
||||
{include 'components/button/button.tpl' url="{router page='rss'}blog/{$oBlog->getUrl()}/" text=$aLang.blog.rss}
|
||||
{* Подписаться через RSS *}
|
||||
{include 'components/button/button.tpl' url="{router page='rss'}blog/{$oBlog->getUrl()}/" text=$aLang.blog.rss}
|
||||
|
||||
{* Вступить / Покинуть блог *}
|
||||
{include 'components/blog/join.tpl' blog=$oBlog}
|
||||
{* Вступить / Покинуть блог *}
|
||||
{include 'components/blog/join.tpl' blog=$oBlog}
|
||||
{/block}
|
|
@ -1,27 +1,25 @@
|
|||
{**
|
||||
* Блок с кнопкой добавления блога
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-add"}
|
||||
{$mods = "{$mods} blog-add"}
|
||||
|
||||
{if ! $oUserCurrent}
|
||||
{$show = false}
|
||||
{/if}
|
||||
{if ! $oUserCurrent}
|
||||
{$show = false}
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
{if $oUserCurrent && ($oUserCurrent->getRating() > {cfg name='acl.create.blog.rating'} or $oUserCurrent->isAdministrator())}
|
||||
<p>{$aLang.blog.can_add}</p>
|
||||
{if $oUserCurrent && ($oUserCurrent->getRating() > {cfg name='acl.create.blog.rating'} or $oUserCurrent->isAdministrator())}
|
||||
<p>{$aLang.blog.can_add}</p>
|
||||
|
||||
{include 'components/button/button.tpl' url="{router page='blog'}add/" mods='primary large' text=$aLang.blog.create_blog}
|
||||
{else}
|
||||
<p>{lang name='blog.cant_add' rating=Config::Get('acl.create.blog.rating')}</p>
|
||||
{include 'components/button/button.tpl' url="{router page='blog'}add/" mods='primary large' text=$aLang.blog.create_blog}
|
||||
{else}
|
||||
<p>{lang name='blog.cant_add' rating=Config::Get('acl.create.blog.rating')}</p>
|
||||
|
||||
{include 'components/button/button.tpl' mods='primary large' text=$aLang.blog.create_blog isDisabled=true}
|
||||
{/if}
|
||||
{include 'components/button/button.tpl' mods='primary large' text=$aLang.blog.create_blog isDisabled=true}
|
||||
{/if}
|
||||
{/block}
|
|
@ -1,30 +1,28 @@
|
|||
{**
|
||||
* Список управляющих блога
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_title'}
|
||||
{$aLang.blog.administrators}
|
||||
{$aLang.blog.administrators}
|
||||
{/block}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-admins"}
|
||||
{$mods = "{$mods} blog-admins"}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
{* Создатель *}
|
||||
{include 'components/user/user-list-small.tpl' users=[ $oBlog->getOwner() ] title=$aLang.blog.owner}
|
||||
{* Создатель *}
|
||||
{include 'components/user/user-list-small.tpl' users=[ $oBlog->getOwner() ] title=$aLang.blog.owner}
|
||||
|
||||
{* Администраторы *}
|
||||
{if count($aBlogAdministrators)}
|
||||
{include 'components/user/user-list-small.tpl' users=$aBlogAdministrators title="{$aLang.blog.administrators} ({count($aBlogAdministrators)})"}
|
||||
{/if}
|
||||
{* Администраторы *}
|
||||
{if count($aBlogAdministrators)}
|
||||
{include 'components/user/user-list-small.tpl' users=$aBlogAdministrators title="{$aLang.blog.administrators} ({count($aBlogAdministrators)})"}
|
||||
{/if}
|
||||
|
||||
{* Модераторы *}
|
||||
{if count($aBlogModerators)}
|
||||
{include 'components/user/user-list-small.tpl' users=$aBlogModerators title="{$aLang.blog.moderators} ({count($aBlogModerators)})"}
|
||||
{/if}
|
||||
{* Модераторы *}
|
||||
{if count($aBlogModerators)}
|
||||
{include 'components/user/user-list-small.tpl' users=$aBlogModerators title="{$aLang.blog.moderators} ({count($aBlogModerators)})"}
|
||||
{/if}
|
||||
{/block}
|
|
@ -1,19 +1,17 @@
|
|||
{**
|
||||
* Подсказка отображаемая при создании топика
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-info-note"}
|
||||
{$mods = "{$mods} blog-info-note"}
|
||||
{/block}
|
||||
|
||||
{block 'block_title'}
|
||||
{lang 'topic.blocks.tip.title'}
|
||||
{lang 'topic.blocks.tip.title'}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
{lang 'topic.blocks.tip.text'}
|
||||
{lang 'topic.blocks.tip.text'}
|
||||
{/block}
|
|
@ -1,19 +1,17 @@
|
|||
{**
|
||||
* Информация о блоге показываемая при создании топика
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_title'}
|
||||
{lang 'blog.blocks.info.title'}
|
||||
{lang 'blog.blocks.info.title'}
|
||||
{/block}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-info"}
|
||||
{$mods = "{$mods} blog-info"}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
<p class="text js-blog-info"></p>
|
||||
<p class="text js-blog-info"></p>
|
||||
{/block}
|
|
@ -1,40 +1,38 @@
|
|||
{**
|
||||
* Навигация по блогам с возможностью выбрать категорию и блог из этой категории
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_title'}
|
||||
{lang 'blog.blocks.navigator.title'}
|
||||
{lang 'blog.blocks.navigator.title'}
|
||||
{/block}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-navigation"}
|
||||
{$mods = "{$mods} blog-navigation"}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
{if $aNavigatorBlogCategories}
|
||||
<p><select class="width-full js-blog-nav-categories">
|
||||
<option value="0">{lang 'blog.blocks.navigator.category'}</option>
|
||||
{if $aNavigatorBlogCategories}
|
||||
<p><select class="width-full js-blog-nav-categories">
|
||||
<option value="0">{lang 'blog.blocks.navigator.category'}</option>
|
||||
|
||||
{foreach $aNavigatorBlogCategories as $aCategoryItem}
|
||||
{$oCategoryItem=$aCategoryItem.entity}
|
||||
<option style="margin-left: {$aCategoryItem.level*20}px;" value="{$oCategoryItem->getId()}">{$oCategoryItem->getTitle()}</option>
|
||||
{/foreach}
|
||||
</select></p>
|
||||
{foreach $aNavigatorBlogCategories as $aCategoryItem}
|
||||
{$oCategoryItem=$aCategoryItem.entity}
|
||||
<option style="margin-left: {$aCategoryItem.level*20}px;" value="{$oCategoryItem->getId()}">{$oCategoryItem->getTitle()}</option>
|
||||
{/foreach}
|
||||
</select></p>
|
||||
|
||||
<p><select class="width-full js-blog-nav-blogs" disabled>
|
||||
<option value="0">{lang 'blog.blocks.navigator.blog'}</option>
|
||||
<p><select class="width-full js-blog-nav-blogs" disabled>
|
||||
<option value="0">{lang 'blog.blocks.navigator.blog'}</option>
|
||||
|
||||
{foreach $aNavigatorBlogs as $oBlogItem}
|
||||
<option value="{$oBlogItem->getId()}" data-url="{$oBlogItem->getUrlFull()}">{$oBlogItem->getTitle()|escape}</option>
|
||||
{/foreach}
|
||||
</select></p>
|
||||
{foreach $aNavigatorBlogs as $oBlogItem}
|
||||
<option value="{$oBlogItem->getId()}" data-url="{$oBlogItem->getUrlFull()}">{$oBlogItem->getTitle()|escape}</option>
|
||||
{/foreach}
|
||||
</select></p>
|
||||
|
||||
{include 'components/button/button.tpl' text={lang 'blog.blocks.navigator.submit'} classes='js-blog-nav-submit' isDisabled=true}
|
||||
{else}
|
||||
{include 'components/alert/alert.tpl' text={lang 'blog.blocks.navigator.empty'} mods='empty'}
|
||||
{/if}
|
||||
{include 'components/button/button.tpl' text={lang 'blog.blocks.navigator.submit'} classes='js-blog-nav-submit' isDisabled=true}
|
||||
{else}
|
||||
{include 'components/alert/alert.tpl' text={lang 'blog.blocks.navigator.empty'} mods='empty'}
|
||||
{/if}
|
||||
{/block}
|
|
@ -1,27 +1,25 @@
|
|||
{**
|
||||
* Список пользователей блога
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_title'}
|
||||
{$iUsersCount = count($aBlogUsers)}
|
||||
{$iUsersCount = count($aBlogUsers)}
|
||||
|
||||
<a href="{$oBlog->getUrlFull()}users/">
|
||||
{if $iUsersCount}
|
||||
{$iUsersCount} {$iUsersCount|declension:$aLang.blog.readers_declension:'russian'}
|
||||
{else}
|
||||
{$aLang.blog.users.empty}
|
||||
{/if}
|
||||
</a>
|
||||
<a href="{$oBlog->getUrlFull()}users/">
|
||||
{if $iUsersCount}
|
||||
{$iUsersCount} {$iUsersCount|declension:$aLang.blog.readers_declension:'russian'}
|
||||
{else}
|
||||
{$aLang.blog.users.empty}
|
||||
{/if}
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog-users"}
|
||||
{$mods = "{$mods} blog-users"}
|
||||
{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
{include 'components/user/user-list-avatar.tpl' aUsersList=$aBlogUsers}
|
||||
{include 'components/user/user-list-avatar.tpl' aUsersList=$aBlogUsers}
|
||||
{/block}
|
|
@ -1,31 +1,29 @@
|
|||
{**
|
||||
* Краткая информация о блоге на странице топика
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
||||
{block 'block_options' append}
|
||||
{$mods = "{$mods} blog"}
|
||||
{$oBlog = $oTopic->getBlog()}
|
||||
{$show = $oTopic && $oBlog->getType() != 'personal'}
|
||||
{$mods = "{$mods} blog"}
|
||||
{$oBlog = $oTopic->getBlog()}
|
||||
{$show = $oTopic && $oBlog->getType() != 'personal'}
|
||||
{/block}
|
||||
|
||||
{block 'block_title'}<a href="{$oBlog->getUrlFull()}">{$oBlog->getTitle()|escape}</a>{/block}
|
||||
{block 'block_class'}block-type-blog{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
<span id="blog_user_count_{$oBlog->getId()}">{$oBlog->getCountUser()}</span>
|
||||
{$oBlog->getCountUser()|declension:$aLang.blog.readers_declension}<br />
|
||||
{$oBlog->getCountTopic()} {lang name=$aLang.topic.topic_plural count=$oBlog->getCountTopic() plural=true}
|
||||
<span id="blog_user_count_{$oBlog->getId()}">{$oBlog->getCountUser()}</span>
|
||||
{$oBlog->getCountUser()|declension:$aLang.blog.readers_declension}<br />
|
||||
{$oBlog->getCountTopic()} {lang name=$aLang.topic.topic_plural count=$oBlog->getCountTopic() plural=true}
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
{* Подписаться через RSS *}
|
||||
<a href="{router page='rss'}blog/{$oBlog->getUrl()}/" class="button">RSS</a>
|
||||
{* Подписаться через RSS *}
|
||||
<a href="{router page='rss'}blog/{$oBlog->getUrl()}/" class="button">RSS</a>
|
||||
|
||||
{* Вступить / Покинуть блог *}
|
||||
{include 'components/blog/join.tpl' blog=$oBlog}
|
||||
{* Вступить / Покинуть блог *}
|
||||
{include 'components/blog/join.tpl' blog=$oBlog}
|
||||
{/block}
|
|
@ -1,7 +1,5 @@
|
|||
{**
|
||||
* Статистика по пользователям
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{**
|
||||
* Блок со списоком блогов
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends 'components/block/block.tpl'}
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
*}
|
||||
|
||||
<ul class="block-item-list">
|
||||
{foreach $aBlogs as $oBlog}
|
||||
<li>
|
||||
<a href="{$oBlog->getUrlFull()}">
|
||||
<img src="{$oBlog->getAvatarPath(48)}" alt="{$oBlog->getTitle()|escape}" class="avatar" />
|
||||
</a>
|
||||
{foreach $aBlogs as $oBlog}
|
||||
<li>
|
||||
<a href="{$oBlog->getUrlFull()}">
|
||||
<img src="{$oBlog->getAvatarPath(48)}" alt="{$oBlog->getTitle()|escape}" class="avatar" />
|
||||
</a>
|
||||
|
||||
{if $oBlog->getType() == 'close'}
|
||||
<i title="{lang 'blog.blocks.blogs.item.private'}" class="icon icon-lock"></i>
|
||||
{/if}
|
||||
{if $oBlog->getType() == 'close'}
|
||||
<i title="{lang 'blog.blocks.blogs.item.private'}" class="icon icon-lock"></i>
|
||||
{/if}
|
||||
|
||||
<a href="{$oBlog->getUrlFull()}">{$oBlog->getTitle()|escape}</a>
|
||||
<a href="{$oBlog->getUrlFull()}">{$oBlog->getTitle()|escape}</a>
|
||||
|
||||
<p>{lang 'blog.blocks.blogs.item.rating'}: <strong>{$oBlog->getRating()}</strong></p>
|
||||
</li>
|
||||
{/foreach}
|
||||
<p>{lang 'blog.blocks.blogs.item.rating'}: <strong>{$oBlog->getRating()}</strong></p>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
{* Информация *}
|
||||
{$info = [
|
||||
[ 'label' => "{$aLang.blog.users.readers_total}:", 'content' => $blog->getCountUser() ],
|
||||
[ 'label' => "{$aLang.blog.users.readers_total}:", 'content' => "<span class=\"js-blog-users-count\" data-blog-id=\"{$blog->getId()}\">{$blog->getCountUser()}</span>" ],
|
||||
[ 'label' => "{$aLang.vote.rating}:", 'content' => $blog->getRating() ],
|
||||
[ 'label' => "{$aLang.blog.topics_total}:", 'content' => $blog->getCountTopic() ]
|
||||
]}
|
||||
|
@ -38,7 +38,7 @@
|
|||
{include 'components/info-list/info-list.tpl' list=$info classes='object-list-item-info'}
|
||||
|
||||
{* Действия *}
|
||||
<div class="object-list-item-actions">
|
||||
<div class="blog-list-item-actions">
|
||||
{* Вступить/покинуть блог *}
|
||||
{include './join.tpl' blog=$blog}
|
||||
</div>
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
|
||||
{* Переменные *}
|
||||
{$blog = $smarty.local.blog}
|
||||
{$blogs = $smarty.local.blogs}
|
||||
|
||||
{* Подключаем модальное окно удаления блога если пользователь админ *}
|
||||
{if $oUserCurrent && $oUserCurrent->isAdministrator()}
|
||||
{include './modals/modal.blog-delete.tpl'}
|
||||
{include './modals/modal.blog-delete.tpl' blog=$blog blogs=$blogs}
|
||||
{/if}
|
||||
|
||||
{* Является ли пользователь администратором или управляющим блога *}
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
* Блок с кнопкой "Создать блог"
|
||||
*
|
||||
* @modifier blog-add
|
||||
* @template blocks/block.blogAdd.tpl
|
||||
* @template blocks/block.blog-add.tpl
|
||||
*/
|
||||
.block.block--blog-add .block-content { padding: 30px; text-align: center; }
|
||||
.block.block--blog-add p { margin-bottom: 25px; }
|
||||
.block--blog-add .block-content { padding: 30px; text-align: center; }
|
||||
.block--blog-add p { margin-bottom: 25px; }
|
||||
|
||||
|
||||
/**
|
||||
* Навигация по блогам
|
||||
*
|
||||
* @modifier blog-navigation
|
||||
* @template blocks/block.blogNav.tpl
|
||||
* @template blocks/block.blog-nav.tpl
|
||||
*/
|
||||
.block--blog-navigation p { margin-bottom: 15px; }
|
||||
.block--blog-navigation .blog-navigator-categories option:first-child { color: #aaa; }
|
||||
|
@ -22,7 +22,7 @@
|
|||
* Информация о блоге
|
||||
*
|
||||
* @modifier blog-actions
|
||||
* @template blocks/block.blogActions.tpl
|
||||
* @template blocks/block.blog-actions.tpl
|
||||
*/
|
||||
.block--blog-actions .block-content { padding: 0; }
|
||||
.block--blog-actions .avatar { max-width: 100%; vertical-align: top; }
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
*/
|
||||
|
||||
.blog {
|
||||
width: 100%;
|
||||
padding: 40px;
|
||||
margin: -40px 0 40px -40px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
width: 100%;
|
||||
padding: 40px;
|
||||
margin: -40px 0 40px -40px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* Хидер */
|
||||
|
@ -47,8 +47,8 @@
|
|||
/**
|
||||
* Список блогов
|
||||
*/
|
||||
.blog-list-item-join {
|
||||
.blog-list-item-actions {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
{**
|
||||
*
|
||||
* Пользователь
|
||||
*}
|
||||
|
||||
{extends 'components/user-list-add/item.tpl'}
|
||||
|
||||
{block 'user_list_add_item_actions' prepend}
|
||||
{* Кнопка "Повторно отправить инвайт" *}
|
||||
<li class="icon-repeat js-blog-invite-user-repeat" title="{$aLang.blog.invite.repeat}" data-user-id="{$userId}"></li>
|
||||
{/block}
|
|
@ -1,6 +1,5 @@
|
|||
{**
|
||||
* Список пользователей с элементами управления / Пользователь
|
||||
* Расширяет основной шаблон с пользователем добавляя кнопку "Повторно отправить приглашение" в блоке "Пригласить пользователей в блог"
|
||||
* Список пользователей
|
||||
*}
|
||||
|
||||
{extends 'components/user-list-add/list.tpl'}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{**
|
||||
* Список пользователей с элементами управления / Пользователь
|
||||
* Расширяет основной шаблон с пользователем добавляя кнопку "Повторно отправить приглашение" в блоке "Пригласить пользователей в блог"
|
||||
* Приглашение пользователей в закрытый блог
|
||||
*}
|
||||
|
||||
{extends 'components/user-list-add/user-list-add.tpl'}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Информация о блоге
|
||||
*
|
||||
* @module ls/blog/info
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
$.widget( "livestreet.lsBlogInfo", {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
options: {
|
||||
// Ссылки
|
||||
urls: {
|
||||
load: null
|
||||
},
|
||||
// Селекторы
|
||||
selectors: {
|
||||
select: null
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
var _this = this;
|
||||
|
||||
this.elements = {
|
||||
select: $( this.option( 'selectors.select' ) )
|
||||
};
|
||||
|
||||
this.elements.select.on( 'change' + this.eventNamespace, function () {
|
||||
_this.load( _this.elements.select.val() );
|
||||
});
|
||||
|
||||
this.load( this.elements.select.val() );
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
load: function( blogId ) {
|
||||
if ( ! blogId ) return;
|
||||
|
||||
this.element.empty().addClass( ls.options.classes.states.loading );
|
||||
|
||||
ls.ajax.load( this.option( 'urls.load' ), { blog_id: blogId }, function( response ) {
|
||||
if ( response.bStateError ) {
|
||||
ls.msg.error( null, response.sMsg );
|
||||
} else {
|
||||
this.element.removeClass( ls.options.classes.states.loading ).html( response.text );
|
||||
}
|
||||
}.bind( this ));
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -9,53 +9,53 @@
|
|||
*/
|
||||
|
||||
(function($) {
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
$.widget( "livestreet.lsBlogInvites", $.livestreet.user_list_add, {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
options: {
|
||||
urls: {
|
||||
add: aRouter['blog'] + 'ajaxaddbloginvite/',
|
||||
remove: aRouter['blog'] + 'ajaxremovebloginvite/',
|
||||
reinvite: aRouter['blog'] + 'ajaxrebloginvite/'
|
||||
},
|
||||
selectors: {
|
||||
// Кнопка повторного отправления инвайта
|
||||
item_reinvite: '.js-blog-invite-user-repeat'
|
||||
}
|
||||
},
|
||||
$.widget( "livestreet.lsBlogInvites", $.livestreet.user_list_add, {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
options: {
|
||||
urls: {
|
||||
add: aRouter['blog'] + 'ajaxaddbloginvite/',
|
||||
remove: aRouter['blog'] + 'ajaxremovebloginvite/',
|
||||
reinvite: aRouter['blog'] + 'ajaxrebloginvite/'
|
||||
},
|
||||
selectors: {
|
||||
// Кнопка повторного отправления инвайта
|
||||
item_reinvite: '.js-blog-invite-user-repeat'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
var _this = this;
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
var _this = this;
|
||||
|
||||
this._super();
|
||||
this._super();
|
||||
|
||||
// Повторная отправка инвайта
|
||||
this.elements.list.on('click' + this.eventNamespace, this.options.selectors.item_reinvite, function (e) {
|
||||
_this.reinvite( $(this).data('user-id') );
|
||||
e.preventDefault();
|
||||
});
|
||||
},
|
||||
// Повторная отправка инвайта
|
||||
this.elements.list.on('click' + this.eventNamespace, this.options.selectors.item_reinvite, function (e) {
|
||||
_this.reinvite( $(this).data('user-id') );
|
||||
e.preventDefault();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Отправляет инвайт заново
|
||||
*/
|
||||
reinvite: function (iUserId) {
|
||||
var oParams = $.extend({}, { iUserId: iUserId }, this.options.params);
|
||||
/**
|
||||
* Отправляет инвайт заново
|
||||
*/
|
||||
reinvite: function (iUserId) {
|
||||
var oParams = $.extend({}, { iUserId: iUserId }, this.options.params);
|
||||
|
||||
ls.ajax.load(this.options.urls.reinvite, oParams, function(oResponse) {
|
||||
ls.msg.notice(null, oResponse.sMsg);
|
||||
ls.ajax.load(this.options.urls.reinvite, oParams, function(oResponse) {
|
||||
ls.msg.notice(null, oResponse.sMsg);
|
||||
|
||||
this._trigger("afterreinvite", null, { context: this, response: oResponse, oParams: oParams });
|
||||
}.bind(this));
|
||||
},
|
||||
});
|
||||
this._trigger("afterreinvite", null, { context: this, response: oResponse, oParams: oParams });
|
||||
}.bind(this));
|
||||
},
|
||||
});
|
||||
})(jQuery);
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* Join blog
|
||||
*
|
||||
* @module ls/blog/join
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
$.widget( "livestreet.lsBlogJoin", {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
options: {
|
||||
// Ссылки
|
||||
urls: {
|
||||
toggle: null
|
||||
},
|
||||
// Селекторы
|
||||
selectors: {
|
||||
count: '.js-blog-users-count'
|
||||
},
|
||||
// Классы
|
||||
classes : {
|
||||
active: 'button--primary'
|
||||
},
|
||||
// Ajax параметры
|
||||
params : {}
|
||||
},
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
this.option( 'params.blog_id', this.element.data( 'blog-id' ) );
|
||||
|
||||
this._on({ click: 'toggle' });
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
toggle: function() {
|
||||
this.element.addClass( ls.options.classes.states.loading );
|
||||
|
||||
ls.ajax.load( this.option( 'urls.toggle' ), this.option( 'params' ), function( response ) {
|
||||
if ( response.bStateError ) {
|
||||
ls.msg.error( null, response.sMsg );
|
||||
} else {
|
||||
ls.msg.notice( null, response.sMsg );
|
||||
|
||||
this.onToggle( response );
|
||||
}
|
||||
|
||||
this.element.removeClass( ls.options.classes.states.loading );
|
||||
}.bind( this ));
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
onToggle: function( response ) {
|
||||
this.element
|
||||
.text( ls.lang.get( response.bState ? 'blog.join.leave' : 'blog.join.join' ) )
|
||||
.toggleClass( this.option( 'classes.active' ) );
|
||||
|
||||
$( this.option( 'selectors.count' ) + '[data-blog-id=' + this.option( 'params.blog_id' ) + ']' ).text( response.iCountUser );
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -21,18 +21,12 @@ ls.blog = (function ($) {
|
|||
var _defaults = {
|
||||
// Роутеры
|
||||
routers: {
|
||||
join: aRouter['blog'] + 'ajaxblogjoin/',
|
||||
categories: aRouter['ajax'] + 'blogs/get-by-category/',
|
||||
info: aRouter['blog'] + 'ajaxbloginfo/',
|
||||
search: aRouter['blogs'] + 'ajax-search/',
|
||||
},
|
||||
|
||||
// Селекторы
|
||||
selectors: {
|
||||
addBlogSelectType: '.js-blog-add-type',
|
||||
toggle_join: '.js-blog-join',
|
||||
users_number: '.js-blog-users-number',
|
||||
info: '.js-blog-info',
|
||||
blog_add_type_note: '#blog_type_note',
|
||||
nav: {
|
||||
categories: '.js-blog-nav-categories',
|
||||
|
@ -58,8 +52,6 @@ ls.blog = (function ($) {
|
|||
blogs: $(this.options.selectors.nav.blogs),
|
||||
submit: $(this.options.selectors.nav.submit)
|
||||
},
|
||||
info: $(this.options.selectors.info),
|
||||
toggle_join: $(this.options.selectors.toggle_join),
|
||||
blog_add_type_note: $(this.options.selectors.blog_add_type_note),
|
||||
};
|
||||
|
||||
|
@ -68,40 +60,6 @@ ls.blog = (function ($) {
|
|||
_this.loadInfoType($(this).val());
|
||||
});
|
||||
|
||||
// Вступить/покинуть блог
|
||||
$(document).on('click', this.options.selectors.toggle_join, function (e) {
|
||||
_this.toggleJoin($(this), $(this).data('blog-id'));
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$( '.js-search-ajax-blog' ).lsSearchAjax({
|
||||
urls: {
|
||||
search: aRouter.blogs + 'ajax-search/'
|
||||
},
|
||||
filters : [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'sText',
|
||||
selector: '.js-search-text-main'
|
||||
},
|
||||
{
|
||||
type: 'radio',
|
||||
name: 'type',
|
||||
selector: '.js-search-ajax-blog-type'
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'category',
|
||||
selector: '#js-search-ajax-blog-category li'
|
||||
},
|
||||
{
|
||||
type: 'sort',
|
||||
name: 'sort_by',
|
||||
selector: '.js-search-sort-menu li'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* Блок навигации по категориям и блогам
|
||||
*/
|
||||
|
@ -117,57 +75,6 @@ ls.blog = (function ($) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Вступить или покинуть блог
|
||||
*/
|
||||
this.toggleJoin = function(oToggle, iIdBlog) {
|
||||
var sUrl = this.options.routers.join,
|
||||
oParams = { idBlog: iIdBlog };
|
||||
|
||||
oToggle.addClass(ls.options.classes.states.loading);
|
||||
|
||||
ls.hook.marker('toggleJoinBefore');
|
||||
|
||||
ls.ajax.load(sUrl, oParams, function(result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
ls.msg.notice(null, result.sMsg);
|
||||
|
||||
oToggle.empty().text( result.bState ? ls.lang.get('blog.join.leave') : ls.lang.get('blog.join.join') ).toggleClass('button--primary');
|
||||
$(this.options.selectors.users_number + '[data-blog-id=' + iIdBlog + ']').text(result.iCountUser);
|
||||
|
||||
ls.hook.run('ls_blog_toggle_join_after', [iIdBlog, result], oToggle);
|
||||
}
|
||||
|
||||
oToggle.removeClass(ls.options.classes.states.loading);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Отображение информации о блоге
|
||||
*/
|
||||
this.loadInfo = function(iBlogId) {
|
||||
if ( ! this.elements.info.length ) return;
|
||||
|
||||
var url = this.options.routers.info,
|
||||
params = { idBlog: iBlogId };
|
||||
|
||||
this.elements.info.empty().addClass(ls.options.classes.states.loading);
|
||||
|
||||
ls.hook.marker('loadInfoBefore');
|
||||
|
||||
ls.ajax.load(url, params, function(result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
this.elements.info.removeClass(ls.options.classes.states.loading).html(result.sText);
|
||||
|
||||
ls.hook.run('ls_blog_load_info_after', [iBlogId, result], this.elements.info);
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Отображение информации о типе блога
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{**
|
||||
* Удаление блога
|
||||
*
|
||||
* @styles css/modals.css
|
||||
* @param object $blog
|
||||
* @param array $blogs
|
||||
*}
|
||||
|
||||
{extends 'components/modal/modal.tpl'}
|
||||
|
@ -11,24 +12,25 @@
|
|||
{block 'modal_title'}{$aLang.blog.remove.title}{/block}
|
||||
|
||||
{block 'modal_content'}
|
||||
<form action="{router page='blog'}delete/{$oBlog->getId()}/" method="POST" id="js-blog-remove-form">
|
||||
{$blog = $smarty.local.blog}
|
||||
|
||||
<form action="{router page='blog'}delete/{$blog->getId()}/" method="POST" id="js-blog-remove-form">
|
||||
{* Переместить топики в блог *}
|
||||
{$aBlogsCustom = [
|
||||
{$selectBlogs = [
|
||||
[ 'value' => -1, 'text' => $aLang.blog.remove.remove_topics ]
|
||||
]}
|
||||
|
||||
{foreach $aBlogs as $oBlog}
|
||||
{$aBlogsCustom[] = [
|
||||
'value' => $oBlog->getId(),
|
||||
'text' => $oBlog->getTitle()|escape
|
||||
{foreach $smarty.local.blogs as $blog}
|
||||
{$selectBlogs[] = [
|
||||
'value' => $blog->getId(),
|
||||
'text' => $blog->getTitle()|escape
|
||||
]}
|
||||
{/foreach}
|
||||
|
||||
{include 'components/field/field.select.tpl'
|
||||
name = 'topic_move_to'
|
||||
label = $aLang.blog.remove.move_to
|
||||
items = $aBlogsCustom}
|
||||
|
||||
name = 'topic_move_to'
|
||||
label = $aLang.blog.remove.move_to
|
||||
items = $selectBlogs}
|
||||
|
||||
{* Скрытые поля *}
|
||||
{include 'components/field/field.hidden.security_key.tpl'}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* Костыли для IE
|
||||
*
|
||||
* @module ie
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
*/
|
||||
|
||||
var ls = ls || {};
|
||||
|
||||
ls.ie = (function ($) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
*/
|
||||
this.init = function() {
|
||||
if ($('html').hasClass('oldie')) {
|
||||
/**
|
||||
* Эмуляция placeholder'ов в IE
|
||||
*/
|
||||
$('input[type=text], textarea').placeholder();
|
||||
}
|
||||
};
|
||||
|
||||
return this;
|
||||
}).call(ls.ie || {}, jQuery);
|
|
@ -1,85 +0,0 @@
|
|||
;(function($) {
|
||||
|
||||
jQuery.fn.choose = function(f) {
|
||||
$(this).bind('choose', f);
|
||||
};
|
||||
|
||||
|
||||
jQuery.fn.file = function(options) {
|
||||
var config = $.extend({
|
||||
name: 'file-upload'
|
||||
}, options);
|
||||
return this.each(function() {
|
||||
var btn = $(this);
|
||||
var pos = btn.offset();
|
||||
|
||||
function update() {
|
||||
pos = btn.offset();
|
||||
file.css({
|
||||
'top': pos.top,
|
||||
'left': pos.left,
|
||||
'width': btn.width(),
|
||||
'height': btn.height()
|
||||
});
|
||||
}
|
||||
|
||||
btn.mouseover(update);
|
||||
|
||||
var hidden = $('<div></div>').css({
|
||||
'display': 'none'
|
||||
}).appendTo('body');
|
||||
|
||||
var file = $('<div id="area-form-file-'+config.name+'"><form></form></div>').appendTo('body').css({
|
||||
'position': 'absolute',
|
||||
'overflow': 'hidden',
|
||||
'-moz-opacity': '0',
|
||||
'filter': 'alpha(opacity: 0)',
|
||||
'opacity': '0',
|
||||
'cursor': 'pointer',
|
||||
'z-index': '2'
|
||||
});
|
||||
|
||||
var form = file.find('form');
|
||||
var input = form.find('input');
|
||||
|
||||
function reset() {
|
||||
var input = $('<input type="file" multiple>').attr('name',config.name).css({'cursor':'pointer'}).appendTo(form);
|
||||
input.change(function(e) {
|
||||
input.unbind();
|
||||
input.detach();
|
||||
btn.trigger('choose', [input]);
|
||||
reset();
|
||||
});
|
||||
};
|
||||
|
||||
reset();
|
||||
|
||||
function placer(e) {
|
||||
form.css('margin-left', e.pageX - pos.left - offset.width);
|
||||
form.css('margin-top', e.pageY - pos.top - offset.height + 3);
|
||||
}
|
||||
|
||||
function redirect(name) {
|
||||
file[name](function(e) {
|
||||
btn.trigger(name);
|
||||
});
|
||||
}
|
||||
|
||||
file.mousemove(placer);
|
||||
btn.mousemove(placer);
|
||||
|
||||
redirect('mouseover');
|
||||
redirect('mouseout');
|
||||
redirect('mousedown');
|
||||
redirect('mouseup');
|
||||
|
||||
var offset = {
|
||||
width: file.width() - 25,
|
||||
height: file.height() / 2
|
||||
};
|
||||
|
||||
update();
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -1,125 +0,0 @@
|
|||
/*!
|
||||
* jQuery imagesLoaded plugin v2.1.1
|
||||
* http://github.com/desandro/imagesloaded
|
||||
*
|
||||
* MIT License. by Paul Irish et al.
|
||||
*/
|
||||
|
||||
/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */
|
||||
/*global jQuery: false */
|
||||
|
||||
;(function($, undefined) {
|
||||
'use strict';
|
||||
|
||||
// blank image data-uri bypasses webkit log warning (thx doug jones)
|
||||
var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
|
||||
|
||||
$.fn.imagesLoaded = function( callback ) {
|
||||
var $this = this,
|
||||
deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
|
||||
hasNotify = $.isFunction(deferred.notify),
|
||||
$images = $this.find('img').add( $this.filter('img') ),
|
||||
loaded = [],
|
||||
proper = [],
|
||||
broken = [];
|
||||
|
||||
// Register deferred callbacks
|
||||
if ($.isPlainObject(callback)) {
|
||||
$.each(callback, function (key, value) {
|
||||
if (key === 'callback') {
|
||||
callback = value;
|
||||
} else if (deferred) {
|
||||
deferred[key](value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function doneLoading() {
|
||||
var $proper = $(proper),
|
||||
$broken = $(broken);
|
||||
|
||||
if ( deferred ) {
|
||||
if ( broken.length ) {
|
||||
deferred.reject( $images, $proper, $broken );
|
||||
} else {
|
||||
deferred.resolve( $images );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $.isFunction( callback ) ) {
|
||||
callback.call( $this, $images, $proper, $broken );
|
||||
}
|
||||
}
|
||||
|
||||
function imgLoadedHandler( event ) {
|
||||
imgLoaded( event.target, event.type === 'error' );
|
||||
}
|
||||
|
||||
function imgLoaded( img, isBroken ) {
|
||||
// don't proceed if BLANK image, or image is already loaded
|
||||
if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// store element in loaded images array
|
||||
loaded.push( img );
|
||||
|
||||
// keep track of broken and properly loaded images
|
||||
if ( isBroken ) {
|
||||
broken.push( img );
|
||||
} else {
|
||||
proper.push( img );
|
||||
}
|
||||
|
||||
// cache image and its state for future calls
|
||||
$.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } );
|
||||
|
||||
// trigger deferred progress method if present
|
||||
if ( hasNotify ) {
|
||||
deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] );
|
||||
}
|
||||
|
||||
// call doneLoading and clean listeners if all images are loaded
|
||||
if ( $images.length === loaded.length ) {
|
||||
setTimeout( doneLoading );
|
||||
$images.unbind( '.imagesLoaded', imgLoadedHandler );
|
||||
}
|
||||
}
|
||||
|
||||
// if no images, trigger immediately
|
||||
if ( !$images.length ) {
|
||||
doneLoading();
|
||||
} else {
|
||||
$images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoadedHandler )
|
||||
.each( function( i, el ) {
|
||||
var src = el.src;
|
||||
|
||||
// find out if this image has been already checked for status
|
||||
// if it was, and src has not changed, call imgLoaded on it
|
||||
var cached = $.data( el, 'imagesLoaded' );
|
||||
if ( cached && cached.src === src ) {
|
||||
imgLoaded( el, cached.isBroken );
|
||||
return;
|
||||
}
|
||||
|
||||
// if complete is true and browser supports natural sizes, try
|
||||
// to check for image status manually
|
||||
if ( el.complete && el.naturalWidth !== undefined ) {
|
||||
imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
// cached images don't fire load sometimes, so we reset src, but only when
|
||||
// dealing with IE, or image is complete (loaded) and failed manual check
|
||||
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
|
||||
if ( el.readyState || el.complete ) {
|
||||
el.src = BLANK;
|
||||
el.src = src;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return deferred ? deferred.promise( $this ) : $this;
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -61,7 +61,7 @@
|
|||
{* Участники диалога *}
|
||||
{if $usersCount > 2}
|
||||
<a href="{router page='talk'}read/{$talk->getId()}/" class="message-list-info-avatar">
|
||||
<img src="{cfg name="path.skin.web"}/assets/images/avatars/avatar_male_64x64.png" />
|
||||
<img src="{cfg name="path.skin.web"}/assets/images/avatars/avatar_male_64x64crop.png" />
|
||||
</a>
|
||||
|
||||
{lang name='talk.participants' count=$usersCount plural=true}
|
||||
|
|
|
@ -61,13 +61,6 @@ ls.topic = (function ($) {
|
|||
$(document).on('click', this.options.selectors.previewTopicTextHideButton, function (e) {
|
||||
_this.hidePreviewText();
|
||||
});
|
||||
|
||||
// Подгрузка информации о выбранном блоге при создании топика
|
||||
$(this.options.selectors.addTopicTitle).on('change', function (e) {
|
||||
ls.blog.loadInfo($(this).val());
|
||||
});
|
||||
|
||||
ls.blog.loadInfo($(this.options.selectors.addTopicTitle).val());
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue