Рефакторинг структуры проекта: шаблоны, статика и модули приложения
This commit is contained in:
151
templates/admin.html
Normal file
151
templates/admin.html
Normal file
@@ -0,0 +1,151 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Admin Matrix</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/admin.css') }}" />
|
||||
</head>
|
||||
<body class="{% if scope == 'ib' %}ib{% endif %}">
|
||||
<main class="wrap">
|
||||
<section class="top">
|
||||
<div>
|
||||
<strong>Админ-панель матрицы</strong>
|
||||
<div class="scope-switch" style="margin-top:8px;">
|
||||
<a class="scope-chip {% if scope == 'infra' %}active{% endif %}" href="{{ request.path }}?scope=infra">Инфраструктура</a>
|
||||
<a class="scope-chip {% if scope == 'ib' %}active{% endif %}" href="{{ request.path }}?scope=ib">ИБ</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; gap:8px;">
|
||||
<a href="/" style="text-decoration:none;"><button class="warn" type="button">На сайт</button></a>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<input type="hidden" name="action" value="logout" />
|
||||
<button class="danger" type="submit">Выйти</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="grid">
|
||||
<div class="box">
|
||||
<h3>Добавить вендора</h3>
|
||||
<form method="post" class="inline">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<input type="hidden" name="action" value="add_vendor" />
|
||||
<input type="text" name="name" placeholder="Название вендора" required />
|
||||
<button class="pri" type="submit">Добавить</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>Добавить категорию</h3>
|
||||
<form method="post" class="inline">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<input type="hidden" name="action" value="add_category" />
|
||||
<input type="text" name="name" placeholder="Название категории" required />
|
||||
<button class="pri" type="submit">Добавить</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>Добавить продукт</h3>
|
||||
<form method="post" class="inline inline-product">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<input type="hidden" name="action" value="add_product" />
|
||||
<select name="vendor_id" required style="padding:9px 10px; border:1px solid #c6d8fb; border-radius:9px;">
|
||||
{% for v in vendors %}
|
||||
<option value="{{ v.id }}">{{ v.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="text" name="name" placeholder="Название продукта" required />
|
||||
<input type="text" name="url" placeholder="URL продукта (необязательно)" />
|
||||
<button class="pri" type="submit">Добавить</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="lists">
|
||||
<div class="box">
|
||||
<h3>Удалить вендора</h3>
|
||||
<div class="list-box">
|
||||
{% for v in vendors %}
|
||||
<form class="list-item" method="post">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<span>{{ v.name }}</span>
|
||||
<input type="hidden" name="action" value="delete_vendor" />
|
||||
<input type="hidden" name="vendor_id" value="{{ v.id }}" />
|
||||
<button class="danger" type="submit">Удалить</button>
|
||||
</form>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>Удалить категорию</h3>
|
||||
<div class="list-box">
|
||||
{% for c in categories %}
|
||||
<form class="list-item" method="post">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<span>{{ c.name }}</span>
|
||||
<input type="hidden" name="action" value="delete_category" />
|
||||
<input type="hidden" name="category_id" value="{{ c.id }}" />
|
||||
<button class="danger" type="submit">Удалить</button>
|
||||
</form>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>Удалить продукт</h3>
|
||||
<div class="list-box">
|
||||
{% for p in products %}
|
||||
<form class="list-item" method="post">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<span>
|
||||
{{ p.vendor_name }} :: {{ p.name }}
|
||||
{% if p.url %}<a href="{{ p.url }}" target="_blank" rel="noopener noreferrer" style="margin-left:6px; font-size:11px;">ссылка</a>{% endif %}
|
||||
</span>
|
||||
<input type="hidden" name="action" value="delete_product" />
|
||||
<input type="hidden" name="product_id" value="{{ p.id }}" />
|
||||
<button class="danger" type="submit">Удалить</button>
|
||||
</form>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="matrix-wrap">
|
||||
<p class="matrix-tip">Прокрутка: колесо/тачпад вниз-вверх внутри таблицы, полосой ниже - влево-вправо.</p>
|
||||
<form method="post" id="matrixForm">
|
||||
<input type="hidden" name="scope" value="{{ scope }}" />
|
||||
<input type="hidden" name="action" value="save_matrix" />
|
||||
<div id="matrixHScroll" class="matrix-h-scroll"><div id="matrixHScrollInner" class="matrix-h-scroll-inner"></div></div>
|
||||
<div id="matrixScroll" class="matrix-scroll">
|
||||
<table id="matrixTable">
|
||||
<tr>
|
||||
<th>Вендор / Продукт</th>
|
||||
{% for c in categories %}
|
||||
<th>{{ c.name }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for p in products %}
|
||||
<tr>
|
||||
<td><strong>{{ p.vendor_name }}</strong><br/>{{ p.name }}</td>
|
||||
{% for c in categories %}
|
||||
<td>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="pc_{{ p.id }}_{{ c.id }}"
|
||||
{% if (p.id, c.id) in links %}checked{% endif %}
|
||||
/>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
<script src="{{ url_for('static', filename='js/admin.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
81
templates/index.html
Normal file
81
templates/index.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Корзина МОНТ</title>
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Caveat:wght@600;700&family=Manrope:wght@400;600;700;800&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/index.css') }}" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
<section class="brand-strip">
|
||||
<div class="brand-logo">
|
||||
<img src="/assets/mont-logo" alt="MONT logo" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="hero">
|
||||
<div class="hero-layout">
|
||||
<div>
|
||||
<h1>Вендоры в корзине МОНТ</h1>
|
||||
<p>Актуальная матрица вендоров, продуктов и категорий. Выбирайте вендоров или категории, чтобы видеть релевантные продуктовые линейки в Инфраструктуре и ИБ.</p>
|
||||
<div class="mode-switch">
|
||||
<button id="modeInfra" class="mode-btn active" type="button">Инфраструктура</button>
|
||||
<button id="modeIb" class="mode-btn" type="button">ИБ</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="board">
|
||||
<article class="card">
|
||||
<h2>Вендоры</h2>
|
||||
<input id="vendorSearch" class="search" placeholder="Поиск вендора..." />
|
||||
<div id="vendorList" class="chip-grid"></div>
|
||||
</article>
|
||||
|
||||
<article class="card">
|
||||
<h2>Категории</h2>
|
||||
<input id="categorySearch" class="search" placeholder="Поиск категории..." />
|
||||
<div id="categoryList" class="chip-grid"></div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<div class="footer-bar">
|
||||
<div id="stats">Загрузка...</div>
|
||||
<button class="action" id="clearBtn">Сбросить фильтры</button>
|
||||
</div>
|
||||
|
||||
<section class="result">
|
||||
<div class="result-head">
|
||||
<h3>Вендоры и продукты (после фильтрации)</h3>
|
||||
</div>
|
||||
<div id="resultRows" class="rows"></div>
|
||||
</section>
|
||||
<div class="credit">
|
||||
<div class="name">Made by Galyaviev</div>
|
||||
<a href="mailto:RGalyaviev@mont.com">RGalyaviev@mont.com</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Yandex.Metrika counter -->
|
||||
<script type="text/javascript">
|
||||
(function(m,e,t,r,i,k,a){
|
||||
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
||||
m[i].l=1*new Date();
|
||||
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
||||
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)
|
||||
})(window, document,'script','https://mc.yandex.ru/metrika/tag.js?id=108577107', 'ym');
|
||||
|
||||
ym(108577107, 'init', {ssr:true, webvisor:true, clickmap:true, ecommerce:"dataLayer", referrer: document.referrer, url: location.href, accurateTrackBounce:true, trackLinks:true});
|
||||
</script>
|
||||
<noscript><div><img src="https://mc.yandex.ru/watch/108577107" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||
<!-- /Yandex.Metrika counter -->
|
||||
|
||||
<script src="{{ url_for('static', filename='js/index.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
22
templates/login.html
Normal file
22
templates/login.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Admin Login</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/login.css') }}" />
|
||||
</head>
|
||||
<body>
|
||||
<form method="post">
|
||||
<h1>Редактор матрицы</h1>
|
||||
{% if error %}<p class="error">{{ error }}</p>{% endif %}
|
||||
<input type="hidden" name="action" value="login" />
|
||||
<input name="username" placeholder="Логин" autocomplete="username" required />
|
||||
<input type="password" name="password" placeholder="Пароль" autocomplete="current-password" required />
|
||||
<button type="submit">Войти</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user