Browse Source

Revert "Делаем новый скин с сеткой постов"

This reverts commit d17bf44cc4.
master
Alexander Yakovlev 2 years ago
parent
commit
111a6f6ec1
Signed by: oreolek
GPG Key ID: 1CDC4B7820C93BD3
  1. 72
      assets/css/layout.css
  2. 67
      components/nav/nav.tpl
  3. 22
      components/topic/topic-list.tpl
  4. 221
      components/topic/topic.tpl
  5. 53
      layouts/layout.base.tpl
  6. 78
      layouts/layout.topics.tpl
  7. 9
      template.xml

72
assets/css/layout.css

@ -14,6 +14,10 @@
margin: 0 auto;
padding: 0 50px;
}
.layout-content {
background: #fff;
padding: 40px !important;
}
.layout-nav .ls-nav.ls-nav--main {
margin: 0 auto;
}
@ -32,51 +36,11 @@
.layout-sidebar .ls-block {
margin-bottom: 10px;
}
.ls-nav-group .ls-nav:only-child {
float: none;
}
.ls-nav-group .ls-nav:first-child {
float: left;
clear: left;
}
.ls-nav-group .ls-nav:last-child {
float: right;
clear: right;
}
.ls-nav-group {
clear: both;
}
.layout-content {
background: #fff;
padding: 40px !important;
width: 100%;
}
.ifhub-content {
columns: 3 200px;
column-gap: 1rem;
}
.ifhub-content article {
}
.layout-sidebar {
width: 100%;
}
/* Responsive */
@media (max-width: 999px) {
.layout-content {
width: 100% !important;
margin-bottom: 30px;
padding: 15px !important;
}
.ifhub-content {
columns: 1 100%;
column-gap: 0;
}
.layout-sidebar {
width: 100% !important;
margin-bottom: 30px;
padding: 0;
}
.layout-content { width: 100% !important; margin-bottom: 30px; padding: 15px !important; }
.layout-sidebar { width: 100% !important; margin-bottom: 30px; padding: 0; }
.ls-toolbar {
display: none;
@ -135,33 +99,9 @@
float: right;
}
/**
* Выделяем заголовок
*/
h2.ls-topic-title a {
font-weight: bold;
}
/**
* Центруем пагинацию
*/
.ls-pagination .ls-pagination-list {
/*
margin-left: auto;
margin-right: auto;
margin-top: 1rem;
*/
}
/**
* Делаем минус незаметнее, разделяем кнопки визуально
*/
.ls-topic-footer .ls-topic-info .ls-topic-info-item.ls-topic-info-item--comments {
float: right;
}
.ls-topic-footer .ls-topic-info .ls-topic-info-item {
margin-right: 0.5rem;
}
.ls-topic-footer .ls-vote .ls-vote-body .ls-vote-item {
padding: 0.5em 1em;
margin-left: 0.2em;

67
components/nav/nav.tpl

@ -1,67 +0,0 @@
{**
* Навигация
*
* @param string $hook
* @param array $hookParams
* @param array $items
* @param string $activeItem
* @param boolean $showSingle
* @param boolean $isSubnav
* @param string $mods
* @param string $classes
* @param array $attributes
*}
{* Название компонента *}
{$component = 'ls-nav'}
{component_define_params params=[ 'hook', 'hookParams', 'items', 'activeItem', 'showSingle', 'isSubnav', 'items', 'mods', 'classes', 'attributes' ]}
{* Получаем пункты установленные плагинами *}
{if $hook}
{hook run="nav_{$hook}" assign='hookItems' params=$hookParams items=$items array=true}
{$items = ( $hookItems ) ? $hookItems : $items}
{/if}
{* Считаем кол-во неактивных пунктов *}
{$disabledItemsCounter = 0}
{foreach $items as $item}
{$disabledItemsCounter = $disabledItemsCounter + ( ! $item['is_enabled']|default:true && $item['name'] != '-' )}
{/foreach}
{$classes = "{$classes}"}
{if $isSubnav}
{$mods = "$mods sub"}
{else}
{$mods = "$mods root"}
{/if}
{* Smarty-блок для изменения опций *}
{block 'nav_options'}{/block}
{* Отображем меню только если есть активные пункты *}
{if count( $items ) - $disabledItemsCounter - ( ( $showSingle|default:true ) ? 0 : 1 )}
<ul class="{$component} {cmods name=$component mods=$mods} {$classes}" {cattr list=$attributes}>
{foreach $items as $item}
{$isEnabled = $item[ 'is_enabled' ]}
{if $item['html']}
{$item['html']}
{else}
{if $isEnabled|default:true}
{if $item['name'] != '-'}
{component 'nav' template='item'
isRoot = !$isSubnav
activeItem = $activeItem
isActive = ($activeItem && $activeItem == $item['name'])
params = $item}
{else}
{* Разделитель *}
<li class="{$component}-separator"></li>
{/if}
{/if}
{/if}
{/foreach}
</ul>
{/if}

22
components/topic/topic-list.tpl

@ -1,22 +0,0 @@
{**
* Список топиков
*
* @param array $topics
* @param array $paging
*}
{component_define_params params=[ 'topics', 'paging' ]}
{if $topics}
{add_block group='toolbar' name='component@toolbar-scrollnav.toolbar.scrollnav' show=count( $topics )}
<div class="ifhub-content">
{foreach $topics as $topic}
{component 'topic' template='type' topic=$topic isList=true}
{/foreach}
</div>
{component 'pagination' total=+$paging.iCountPage current=+$paging.iCurrentPage url="{$paging.sBaseUrl}/page__page__/{$paging.sGetParams}" classes='js-pagination-topics'}
{else}
{component 'blankslate' text=$aLang.common.empty}
{/if}

221
components/topic/topic.tpl

@ -1,221 +0,0 @@
{**
* Базовый шаблон топика
* Используется также для отображения превью топика
*
* @param object $topic
* @param boolean $isList
* @param boolean $isPreview
*}
{$component = 'ls-topic'}
{component_define_params params=[ 'type', 'topic', 'isPreview', 'isList', 'mods', 'classes', 'attributes' ]}
{$user = $topic->getUser()}
{$type = ($topic->getType()) ? $topic->getType() : $type}
{if ! $isList}
{$mods = "{$mods} single"}
{/if}
{$classes = "{$classes} topic js-topic"}
{block 'topic_options'}{/block}
<article class="{$component} {cmods name=$component mods=$mods} {$classes}" {cattr list=$attributes}>
{**
* Хидер
*}
{block 'topic_header'}
<header class="{$component}-header">
{$_headingTag = ($isList) ? Config::Get('view.seo.topic_heading_list') : Config::Get('view.seo.topic_heading')}
{* Заголовок *}
<{$_headingTag} class="{$component}-title ls-word-wrap">
{block 'topic_title'}
{if $topic->getPublish() == 0}
{component 'icon' icon='file' attributes=[ title => {lang 'topic.is_draft'} ]}
{/if}
{if $isList}
<a href="{$topic->getUrl()}">{$topic->getTitle()|escape}</a>
{else}
{$topic->getTitle()|escape}
{/if}
{/block}
</{$_headingTag}>
{* Информация *}
<ul class="{$component}-info">
{block 'topic_header_info'}
{if ! $isPreview}
{foreach $topic->getBlogs() as $blog}
{if $blog->getType() != 'personal'}
<li class="{$component}-info-item {$component}-info-item--blog">
<a href="{$blog->getUrlFull()}">{$blog->getTitle()|escape}</a>
</li>
{/if}
{/foreach}
{/if}
{$isDeferred = (strtotime($topic->getDatePublish())>time()) ? true : false}
<li class="{$component}-info-item {$component}-info-item--date{if $isDeferred}--deferred{/if}">
<time datetime="{date_format date=$topic->getDatePublish() format='c'}" title="{if $isDeferred}{lang 'topic.is_deferred'}{else}{date_format date=$topic->getDatePublish() format='j F Y, H:i'}{/if}">
{date_format date=$topic->getDatePublish() format="j F Y, H:i"}
</time>
</li>
{/block}
</ul>
{* Управление *}
{if $topic->getIsAllowAction() && ! $isPreview}
{block 'topic_header_actions'}
{$items = [
[ 'icon' => 'edit', 'url' => $topic->getUrlEdit(), 'text' => $aLang.common.edit, 'show' => $topic->getIsAllowEdit() ],
[ 'icon' => 'trash', 'url' => "{$topic->getUrlDelete()}?security_ls_key={$LIVESTREET_SECURITY_KEY}", 'text' => $aLang.common.remove, 'show' => $topic->getIsAllowDelete(), 'classes' => 'js-confirm-remove-default' ]
]}
{/block}
{component 'actionbar' items=[[ 'buttons' => $items ]]}
{/if}
</header>
{/block}
{**
* Текст
*}
{block 'topic_body'}
{* Превью *}
{$previewImage = $topic->getPreviewImageWebPath(Config::Get('module.topic.default_preview_size'))}
{if $previewImage}
<div class="ls-topic-preview-image">
<img src="{$previewImage}" />
</div>
{/if}
<div class="{$component}-content">
<div class="{$component}-text ls-text">
{block 'topic_content_text'}
{if $isList and $topic->getTextShort()}
{$topic->getTextShort()}
{else}
{$topic->getText()}
{/if}
{/block}
</div>
{* Кат *}
{if $isList && $topic->getTextShort()}
{component 'button'
classes = "{$component}-cut"
url = "{$topic->getUrl()}#cut"
text = "{$topic->getCutText()|default:$aLang.topic.read_more}"}
{/if}
</div>
{* Дополнительные поля *}
{block 'topic_content_properties'}
{if ! $isList}
{component 'property' template='output.list' properties=$topic->property->getPropertyList()}
{/if}
{/block}
{* Опросы *}
{block 'topic_content_polls'}
{if ! $isList}
{component 'poll' template='list' polls=$topic->getPolls()}
{/if}
{/block}
{/block}
{**
* Футер
*}
{block 'topic_footer'}
{if ! $isList && $topic->getTypeObject()->getParam('allow_tags')}
{$favourite = $topic->getFavourite()}
{if ! $isPreview}
{component 'tags-personal'
classes = 'js-tags-favourite'
tags = $topic->getTagsObjects()
tagsPersonal = ( $favourite ) ? $favourite->getTagsObjects() : []
isEditable = ! $favourite
targetType = 'topic'
targetId = $topic->getId()}
{/if}
{/if}
<footer class="{$component}-footer">
{* Информация *}
{block 'topic_footer_info'}
<ul class="{$component}-info ls-clearfix">
{block 'topic_footer_info_items'}
{* Голосование *}
{if ! $isPreview}
<li class="{$component}-info-item {$component}-info-item--vote">
{$isExpired = strtotime($topic->getDatePublish()) < $smarty.now - Config::Get('acl.vote.topic.limit_time')}
{component 'vote'
target = $topic
classes = 'js-vote-topic'
mods = 'small white topic'
useAbstain = true
isLocked = ( $oUserCurrent && $topic->getUserId() == $oUserCurrent->getId() ) || $isExpired
showRating = $topic->getVote() || ($oUserCurrent && $topic->getUserId() == $oUserCurrent->getId()) || $isExpired}
</li>
{/if}
{* Не показываем если комментирование запрещено и кол-во комментариев равно нулю *}
{if $isList && ( ! $topic->getForbidComment() || ( $topic->getForbidComment() && $topic->getCountComment() ) )}
<li class="{$component}-info-item {$component}-info-item--comments">
<a href="{$topic->getUrl()}#comments">
{lang name='comments.comments_declension' count=$topic->getCountComment() plural=true}
</a>
{if $topic->getCountCommentNew()}<span>+{$topic->getCountCommentNew()}</span>{/if}
</li>
{/if}
{* Автор топика *}
<li class="{$component}-info-item {$component}-info-item--author">
{component 'user' template='avatar' user=$user size='xsmall' mods='inline'}
</li>
{* Ссылка на комментарии *}
{if ! $isList && ! $isPreview}
{* Избранное *}
<li class="{$component}-info-item {$component}-info-item--favourite">
{component 'favourite' classes="js-favourite-topic" target=$topic attributes=[ 'data-param-target_type' => $type ]}
</li>
{* Поделиться *}
<li class="{$component}-info-item {$component}-info-item--share">
{component 'icon' icon='share'
classes="js-popover-default"
attributes=[
'title' => {lang 'topic.share'},
'data-tooltip-target' => "#topic_share_{$topic->getId()}"
]}
</li>
{/if}
{/block} {* /topic_footer_info_items *}
</ul>
{/block} {* /topic_footer_info *}
</footer>
{* Всплывающий блок появляющийся при нажатии на кнопку Поделиться *}
{if ! $isList && ! $isPreview}
<div class="ls-tooltip" id="topic_share_{$topic->getId()}">
<div class="ls-tooltip-content js-ls-tooltip-content">
{hookb run="topic_share" topic=$topic isList=$isList}
<div class="yashare-auto-init" data-yashareTitle="{$topic->getTitle()|escape}" data-yashareLink="{$topic->getUrl()}" data-yashareL10n="ru" data-yashareType="small" data-yashareTheme="counter" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,gplus"></div>
{/hookb}
</div>
</div>
{/if}
{/block} {* /topic_footer *}
</article>

53
layouts/layout.base.tpl

@ -32,6 +32,30 @@
{$layoutSidebarBlocks = trim( $layoutSidebarBlocks )}
{$layoutShowSidebar = !!$layoutSidebarBlocks}
{/if}
{**
* Тип сетки сайта
*}
{if {Config::Get('view.grid.type')} == 'fluid'}
<style>
.layout-userbar,
.layout-nav .ls-nav--main,
.layout-header .ls-jumbotron-inner,
.layout-container,
.container {
min-width: {Config::Get('view.grid.fluid_min_width')};
max-width: {Config::Get('view.grid.fluid_max_width')};
}
</style>
{else}
<style>
.layout-userbar,
.layout-nav .ls-nav--main,
.layout-header .ls-jumbotron-inner,
.layout-container,
.container { width: {Config::Get('view.grid.fixed_width')}; }
</style>
{/if}
{/block}
{block 'layout_body'}
@ -106,7 +130,7 @@
{**
* Контент
*}
<div class="ls-grid-col layout-content"
<div class="ls-grid-col ls-grid-col-8 layout-content"
role="main"
{if $sMenuItemSelect == 'profile'}itemscope itemtype="http://data-vocabulary.org/Person"{/if}>
@ -159,8 +183,8 @@
{hook run='layout_content_begin' action=$sAction}
{block 'layout_content'}{/block}
{hook run='layout_content_end' action=$sAction}
{hook run='layout_content_end' action=$sAction}
{show_blocks group='similar'}
</div>
@ -169,7 +193,7 @@
* Показываем сайдбар
*}
{if $layoutShowSidebar}
<aside class="ls-grid-col layout-sidebar" role="complementary">
<aside class="ls-grid-col ls-grid-col-4 layout-sidebar" role="complementary">
{$layoutSidebarBlocks}
<div class="ls-block">
@ -198,29 +222,6 @@
{* Подвал *}
<footer class="ls-grid-row layout-footer">
<a href="{router page='rss'}/index">RSS главной страницы</a><br>
<a href="{router page='rss'}new/">RSS всех топиков</a><br>
<a href="{router page='rss'}allcomments/">RSS комментариев</a>
<div class="ls-block">
<header class="ls-block-header">
<h3 class="ls-block-title">Мы в социальных сетях</h3>
</header>
<ul class="ls-item-group">
<li class="ls-item">
<p><i class="fa fa-twitter"></i> <a href="https://twitter.com/if_hub">Twitter: @if_hub</a></p>
</li>
<li class="ls-item">
<p><i class="fa fa-vk"></i> <a href="https://vk.com/ifhub">ВКонтакте: ifhub</a></p>
</li>
<li class="ls-item">
<p><i class="fa fa-telegram"></i> <a href="https://t.me/ifhub">Telegram: @IFHub</a></p>
</li>
<li class="ls-item">
<p><i class="fa fa-pencil"></i> <a rel="me" href="https://botsin.space/@ifhub">Mastodon: @IFHub@botsin.space</a></p>
</li>
</ul>
</div>
{block 'layout_footer'}
{hook run='layout_footer_begin'}
{hook run='copyright'}

78
layouts/layout.topics.tpl

@ -5,48 +5,48 @@
{extends './layout.base.tpl'}
{block 'layout_options' append}
{* Меню фильтрации топиков *}
{if $sNavTopicsSubUrl}
{if ! isset($layoutNav)}
{$layoutNav = []}
{/if}
{$layoutNav[] = [
hook => 'topics_sub',
activeItem => $sMenuSubItemSelect,
items => [
[ 'name' => 'good', 'url' => $sNavTopicsSubUrl, 'text' => {lang name='blog.menu.all_good'} ],
[ 'name' => 'new', 'url' => "{$sNavTopicsSubUrl}newall/", 'text' => {lang name='blog.menu.all_new'} ],
[ 'name' => 'discussed', 'url' => "{$sNavTopicsSubUrl}discussed/", 'text' => {lang name='blog.menu.all_discussed'} ],
[ 'name' => 'top', 'url' => "{$sNavTopicsSubUrl}top/", 'text' => {lang name='blog.menu.all_top'} ]
]
]}
{* Меню фильтрации топиков *}
{if $sNavTopicsSubUrl}
{if ! isset($layoutNav)}
{$layoutNav = []}
{/if}
{if $periodSelectCurrent}
{* Фильтр по времени *}
{$layoutNav[] = [
hook => 'topics_sub_timespan',
activeItem => $periodSelectCurrent,
items => [
[
'name' => 'good',
'text' => {lang name='blog.menu.all_good'},
'menu' => [
activeItem => $periodSelectCurrent,
items => [
[ 'name' => '1', 'url' => "{$periodSelectRoot}?period=1", 'text' => {lang 'blog.menu.top_period_1'} ],
[ 'name' => '7', 'url' => "{$periodSelectRoot}?period=7", 'text' => {lang 'blog.menu.top_period_7'} ],
[ 'name' => '30', 'url' => "{$periodSelectRoot}?period=30", 'text' => {lang 'blog.menu.top_period_30'} ],
[ 'name' => 'all', 'url' => "{$periodSelectRoot}?period=all", 'text' => {lang 'blog.menu.top_period_all'} ]
]
{$layoutNav[] = [
hook => 'topics_sub',
activeItem => $sMenuSubItemSelect,
items => [
[ 'name' => 'good', 'url' => $sNavTopicsSubUrl, 'text' => {lang name='blog.menu.all_good'} ],
[ 'name' => 'new', 'url' => "{$sNavTopicsSubUrl}newall/", 'text' => {lang name='blog.menu.all_new'} ],
[ 'name' => 'discussed', 'url' => "{$sNavTopicsSubUrl}discussed/", 'text' => {lang name='blog.menu.all_discussed'} ],
[ 'name' => 'top', 'url' => "{$sNavTopicsSubUrl}top/", 'text' => {lang name='blog.menu.all_top'} ]
]
]
]
]}
]}
{if $periodSelectCurrent}
{* Фильтр по времени *}
{$layoutNav[] = [
hook => 'topics_sub_timespan',
activeItem => $periodSelectCurrent,
items => [
[
'name' => 'good',
'text' => {lang name='blog.menu.all_good'},
'menu' => [
activeItem => $periodSelectCurrent,
items => [
[ 'name' => '1', 'url' => "{$periodSelectRoot}?period=1", 'text' => {lang 'blog.menu.top_period_1'} ],
[ 'name' => '7', 'url' => "{$periodSelectRoot}?period=7", 'text' => {lang 'blog.menu.top_period_7'} ],
[ 'name' => '30', 'url' => "{$periodSelectRoot}?period=30", 'text' => {lang 'blog.menu.top_period_30'} ],
[ 'name' => 'all', 'url' => "{$periodSelectRoot}?period=all", 'text' => {lang 'blog.menu.top_period_all'} ]
]
]
]
]
]}
{/if}
{/if}
{/if}
{/block}
{block 'layout_content'}
{component 'topic.list' topics=$topics paging=$paging}
{/block}
{component 'topic.list' topics=$topics paging=$paging}
{/block}

9
template.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<skin>
<name>
<lang name="default">IFHub 2</lang>
<lang name="default">IFHub</lang>
</name>
<author>
<lang name="default">Alexander Yakovlev</lang>
@ -25,5 +25,12 @@
<lang name="default">default</lang>
</description>
</item>
<item>
<value>light</value>
<description>
<lang name="ru">облегченная</lang>
<lang name="default">light</lang>
</description>
</item>
</themes>
</skin>

Loading…
Cancel
Save