Vinoteca: модуль, шаблон и компоненты интернет-магазина вина на 1С-Битрикс
This commit is contained in:
commit
f6ba0d2174
470 files changed
+26454
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Bitrix\Main\Localization\Loc;
|
||||
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
||||
die();
|
||||
}
|
||||
|
||||
Loc::loadMessages(__FILE__);
|
||||
|
||||
class JinovePersonalNavComponent extends CBitrixComponent
|
||||
{
|
||||
private const SECTIONS = ["profile" => "", "orders" => "orders/", "reviews" => "reviews/"];
|
||||
|
||||
public function executeComponent(): array
|
||||
{
|
||||
$items = [];
|
||||
foreach (self::SECTIONS as $code => $path) {
|
||||
$items[] = [
|
||||
"CODE" => $code,
|
||||
"URL" => SITE_DIR . "personal/" . $path,
|
||||
"ACTIVE" => ($this->arParams["ACTIVE"] ?? "") === $code,
|
||||
];
|
||||
}
|
||||
$this->arResult = ["ITEMS" => $items];
|
||||
$this->includeComponentTemplate();
|
||||
|
||||
return $this->arResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$MESS["VINO_NAV_LABEL"] = "Account sections";
|
||||
$MESS["VINO_NAV_KICKER"] = "My account";
|
||||
$MESS["VINO_NAV_PROFILE"] = "Profile";
|
||||
$MESS["VINO_NAV_ORDERS"] = "Orders";
|
||||
$MESS["VINO_NAV_REVIEWS"] = "My reviews";
|
||||
$MESS["VINO_NAV_LOGOUT"] = "Sign out";
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$MESS["VINO_NAV_LABEL"] = "Sekcje konta";
|
||||
$MESS["VINO_NAV_KICKER"] = "Moje konto";
|
||||
$MESS["VINO_NAV_PROFILE"] = "Profil";
|
||||
$MESS["VINO_NAV_ORDERS"] = "Zamówienia";
|
||||
$MESS["VINO_NAV_REVIEWS"] = "Moje opinie";
|
||||
$MESS["VINO_NAV_LOGOUT"] = "Wyloguj się";
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$MESS["VINO_NAV_LABEL"] = "Разделы кабинета";
|
||||
$MESS["VINO_NAV_KICKER"] = "Личный кабинет";
|
||||
$MESS["VINO_NAV_PROFILE"] = "Профиль";
|
||||
$MESS["VINO_NAV_ORDERS"] = "Заказы";
|
||||
$MESS["VINO_NAV_REVIEWS"] = "Мои отзывы";
|
||||
$MESS["VINO_NAV_LOGOUT"] = "Выйти";
|
||||
@@ -0,0 +1,21 @@
|
||||
(function () {
|
||||
function init() {
|
||||
var logout = document.querySelector('[data-cab-logout]');
|
||||
if (!logout || !window.BX || !BX.ajax || !BX.ajax.runAction) return;
|
||||
logout.addEventListener('click', function () {
|
||||
if (logout.getAttribute('aria-disabled') === 'true') return;
|
||||
logout.setAttribute('aria-disabled', 'true');
|
||||
BX.ajax.runAction('jinove:vinoteca.profile.logout', { data: { lang: document.documentElement.lang || 'en' } }).then(function (response) {
|
||||
window.location.href = (response.data && response.data.redirect) || '/';
|
||||
}, function () {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
use Bitrix\Main\Localization\Loc;
|
||||
|
||||
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
||||
die();
|
||||
}
|
||||
|
||||
Loc::loadMessages(__FILE__);
|
||||
?>
|
||||
<nav class="vino-cab__nav" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_NAV_LABEL")) ?>">
|
||||
<p class="vino-cab__kicker"><?= Loc::getMessage("VINO_NAV_KICKER") ?></p>
|
||||
<ul class="vino-cab__list">
|
||||
<?php foreach ($arResult["ITEMS"] as $item): ?>
|
||||
<li class="vino-cab__item"><a class="vino-cab__link<?= $item["ACTIVE"] ? " vino-cab__link--active" : "" ?>" href="<?= htmlspecialcharsbx($item["URL"]) ?>"<?= $item["ACTIVE"] ? ' aria-current="page"' : "" ?>><?= Loc::getMessage("VINO_NAV_" . strtoupper($item["CODE"])) ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
<li class="vino-cab__item"><button class="vino-cab__link vino-cab__link--button" type="button" data-cab-logout><?= Loc::getMessage("VINO_NAV_LOGOUT") ?></button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
Reference in new issue
Block a user