ADD: Шаблон Light

+ упростим добавление.
См. https://libarea.ru/post/1557/kak-sozdat-svoy-shablon-dlya-libarea
This commit is contained in:
Evg 2023-10-17 11:14:48 +03:00
parent 59989d29d4
commit 11a0896327
7 changed files with 169 additions and 18 deletions

View file

@ -15,18 +15,6 @@ return [
// Paths to template files
'path_css' => [
// Base path to css files
// Базовый путь к css файлам
'style' => '/resources/views/default/css/build.css',
// Template for qa style
// Шаблон для стиля qa
'qa' => '/resources/views/qa/css/build.css',
// Template for minimum style
// Шаблон для стиля minimum
'minimum' => '/resources/views/minimum/css/build.css',
// Single templates without assembly
// Одиночные шаблоны без сборки
'rtl' => '/resources/views/default/css/rtl.css',

View file

@ -14,13 +14,14 @@ return [
// TRUE - только по приглашению
'invite' => false,
// Шаблон по умолчанию + какие языки есть в системе
// Default template + what languages are in the system
// Шаблон по умолчанию + какие шаблоны есть в системе
// Default template + what templates are in the system
'template' => 'default',
'templates' => [
'default' => 'Default',
'qa' => 'Q&A',
'minimum' => 'Minimum',
'light' => 'Light',
],
// Default localization (+ languages represented)

View file

@ -8,14 +8,25 @@ class Sass
{
public static function collect()
{
foreach (config('assembly-js-css.path_css') as $key => $putch) {
self::buildCss(HLEB_GLOBAL_DIRECTORY . $putch, $key);
// css templates
foreach (config('general.templates') as $key => $putch) {
$name = ($key == 'default') ? 'style' : $key;
self::buildCss(HLEB_GLOBAL_DIRECTORY . '/resources/views/' . $key . '/css/build.css', $name);
}
// Generic js
foreach (config('assembly-js-css.path_js') as $key => $putch) {
self::buildJs(HLEB_GLOBAL_DIRECTORY . $putch, $key);
}
// Separate style files that may not be included in the templates (example: catalog.css, rtl.css)
// Отдельные файлы стилей, которые могут не войти в шаблоны (пример: catalog.css, rtl.css)
foreach (config('assembly-js-css.path_css') as $key => $putch) {
self::buildCss(HLEB_GLOBAL_DIRECTORY . $putch, $key);
}
}
public static function buildCss($putch, $key)

View file

@ -0,0 +1,3 @@
## Как создать свой шаблон?
Смотрим: https://libarea.ru/post/1557/kak-sozdat-svoy-shablon-dlya-libarea

View file

@ -0,0 +1,8 @@
/*
* List of resources to build
*
* Перечень ресурсов для сборки
*/
/* Test Template */
@import 'custom.css';

View file

@ -0,0 +1,19 @@
/*
* Additional styles
*
* Дополнительные стили
*/
body { background-color: #f3f3f3; }
.box,
.indent-body { background-color: #fff; }
.indent-body { padding: 15px; }
ul.nav > li.active {
background-color: #111;
color: #fff;
}
ul.nav > li.active > a { color: #fff; }

View file

@ -0,0 +1,121 @@
<?php
use Hleb\Constructor\Handlers\Request;
Request::getHead()->addStyles('/assets/css/style.css?' . config('assembly-js-css.version'));
Request::getHead()->addStyles('/assets/css/light.css?' . config('assembly-js-css.version'));
$type = $data['type'] ?? false;
$facet = $data['facet'] ?? false;
$post = $data['post'] ?? false;
?>
<?= insert('/meta', ['meta' => $meta]); ?>
<body class="general<?php if (Request::getCookie('dayNight') == 'dark') : ?> dark<?php endif; ?><?php if (Request::getCookie('menuYesNo') == 'menuno') : ?> menuno<?php endif; ?>">
<header class="d-header<?php if ($post || $facet) : ?> scroll-hide-search<?php endif; ?>">
<div class="wrap">
<div class="d-header_contents">
<div class="box-logo">
<svg id="togglemenu" class="icons pointer">
<use xlink:href="/assets/svg/icons.svg#menu"></use>
</svg>
<svg class="icons menu__button none">
<use xlink:href="/assets/svg/icons.svg#menu"></use>
</svg>
<a title="<?= __('app.home'); ?>" class="logo" href="/"><?= config('meta.name'); ?></a>
</div>
<?php if ($post) : ?>
<div class="d-header-post none">
<span class="v-line mb-none"></span>
<a class="mb-none" href="<?= post_slug($post['post_id'], $post['post_slug']) ?>">
<?= $data['post']['post_title'] ?>
</a>
</div>
<?php endif; ?>
<?php if ($facet) : ?>
<div class="d-header-facet none">
<span class="v-line mb-none"></span>
<a class="mb-none" href="<?= url($facet['facet_type'], ['slug' => $facet['facet_slug']]) ?>">
<?= Img::image($facet['facet_img'], $facet['facet_title'], 'img-base mr15', 'logo', 'max'); ?>
<?= $facet['facet_title']; ?>
</a>
<span class="gray-600 text-sm lowercase mb-none"> - <?= $facet['facet_short_description']; ?></span>
</div>
<?php endif; ?>
<div class="box-search mb-none">
<form class="form" method="get" action="<?= url('search.go'); ?>">
<input data-id="topic" type="text" name="q" autocomplete="off" id="find" placeholder="<?= __('app.find'); ?>" class="search">
</form>
<div class="box-results none" id="search_items"></div>
</div>
<?php if (!UserData::checkActiveUser()) : ?>
<div class="flex gap-max items-center">
<div id="toggledark" class="gray-600">
<svg class="icons">
<use xlink:href="/assets/svg/icons.svg#sun"></use>
</svg>
</div>
<?php if (config('general.invite') == false) : ?>
<a class="gray min-w75 center mb-none block" href="<?= url('register'); ?>">
<?= __('app.registration'); ?>
</a>
<?php endif; ?>
<a class="btn btn-outline-primary min-w75" href="<?= url('login'); ?>">
<?= __('app.sign_in'); ?>
</a>
</div>
<?php else : ?>
<div class="flex gap-max items-center">
<?= Html::addPost($facet['facet_id'] ?? false); ?>
<a id="toggledark" class="gray-600"><svg class="icons">
<use xlink:href="/assets/svg/icons.svg#sun"></use>
</svg></a>
<a id="notif" class="gray-600 relative" href="<?= url('notifications'); ?>">
<svg class="icons">
<use xlink:href="/assets/svg/icons.svg#bell"></use>
</svg>
<span class="number-notif"></span>
</a>
<div class="relative">
<div class="trigger pointer">
<?= Img::avatar(UserData::getUserAvatar(), UserData::getUserLogin(), 'img-base', 'small'); ?>
</div>
<div class="dropdown user">
<?= insert('/_block/navigation/menu-user'); ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</header>
<?php if (!UserData::checkActiveUser() && $type == 'main') : ?>
<div class="banner mb-none">
<h1><?= config('meta.banner_title'); ?></h1>
<p><?= config('meta.banner_desc'); ?>...</p>
</div>
<?php endif; ?>
<div id="contentWrapper" class="wrap">
<nav class="menu__left mb-none">
<ul class="menu sticky top-sm">
<?= insert('/_block/navigation/menu', ['type' => $type, 'list' => config('navigation/menu.left')]); ?>
</ul>
</nav>