clean up html template
This commit is contained in:
parent
7a8d2fe793
commit
f3e6c165f4
6 changed files with 63 additions and 121 deletions
26
src/web/templates/base.html
Normal file
26
src/web/templates/base.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>{% block title %} {% endblock %}</title>
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="logo">Steamgifts Bot</h1>
|
||||||
|
<strong><nav>
|
||||||
|
<ul class="menu">
|
||||||
|
<li><a href="{{ url_for('config') }}">Config</a></li>
|
||||||
|
<li><a href="{{ url_for('log_info') }}">Info Logs</a></li>
|
||||||
|
<li><a href="{{ url_for('log_debug') }}">Debug Logs</a></li>
|
||||||
|
<li><a href="{{ url_for('db_giveaways') }}">Giveaways</a></li>
|
||||||
|
<li><a href="{{ url_for('db_notifications') }}">Notifications</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav></strong>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
{% block content %} {% endblock %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,26 +1,6 @@
|
||||||
<!DOCTYPE html>
|
{% extends 'base.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
{% block title %} {{name}} Steamgifts Bot Configuration {% endblock %}
|
||||||
<title>{{name}} Steamgifts Bot Configuration</title>
|
{% block content %}
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
|
<pre>{{data}}</pre>
|
||||||
</head>
|
{% endblock %}
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="logo">Steamgifts Bot</h1>
|
|
||||||
<strong><nav>
|
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{ url_for('config') }}">Config</a></li>
|
|
||||||
<li><a href="{{ url_for('log_info') }}">Info Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('log_debug') }}">Debug Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('db_giveaways') }}">Giveaways</a></li>
|
|
||||||
<li><a href="{{ url_for('db_notifications') }}">Notifications</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav></strong>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<pre>{{content}}</pre>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,35 +1,15 @@
|
||||||
<!DOCTYPE html>
|
{% extends 'base.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
{% block title %} {{name}} Steamgifts Bot Giveaways {% endblock %}
|
||||||
<title>{{name}} Steamgifts Bot DB View</title>
|
{% block content %}
|
||||||
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
|
<ul class="pagination">
|
||||||
</head>
|
{% if data.previous_page %}
|
||||||
<body>
|
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=data.previous_page) }}">Previous</a></li>
|
||||||
<header>
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="logo">Steamgifts Bot</h1>
|
|
||||||
<strong>
|
|
||||||
<nav>
|
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{ url_for('config') }}">Config</a></li>
|
|
||||||
<li><a href="{{ url_for('log_info') }}">Info Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('log_debug') }}">Debug Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('db_giveaways') }}">Giveaways</a></li>
|
|
||||||
<li><a href="{{ url_for('db_notifications') }}">Notifications</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<ul class="pagination">
|
|
||||||
{% if content.previous_page %}
|
|
||||||
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=content.previous_page) }}">Previous</a></li>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="page-item">Previous</li>
|
<li class="page-item">Previous</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if content.next_page %}
|
{% if data.next_page %}
|
||||||
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=content.next_page) }}">Next</a></li>
|
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=data.next_page) }}">Next</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="page-item">Next</li>
|
<li class="page-item">Next</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -52,7 +32,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for row in content.items %}
|
{% for row in data.items %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{row.giveaway_id}}</td>
|
<td>{{row.giveaway_id}}</td>
|
||||||
<td>{{row.steam_id}}</td>
|
<td>{{row.steam_id}}</td>
|
||||||
|
@ -70,6 +50,4 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
{% endblock %}
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,26 +1,6 @@
|
||||||
<!DOCTYPE html>
|
{% extends 'base.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
{% block title %} {{name}} Steamgifts Bot {{log_type}} Logs{% endblock %}
|
||||||
<title>{{name}} Steamgifts Bot {{log_type}} Logs</title>
|
{% block content %}
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
|
<pre id="output">{{data}}</pre>
|
||||||
</head>
|
{% endblock %}
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="logo">Steamgifts Bot</h1>
|
|
||||||
<strong><nav>
|
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{ url_for('config') }}">Config</a></li>
|
|
||||||
<li><a href="{{ url_for('log_info') }}">Info Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('log_debug') }}">Debug Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('db_giveaways') }}">Giveaways</a></li>
|
|
||||||
<li><a href="{{ url_for('db_notifications') }}">Notifications</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav></strong>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<pre id="output">{{content}}</pre>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,28 +1,8 @@
|
||||||
<!DOCTYPE html>
|
{% extends 'base.html' %}
|
||||||
<html>
|
|
||||||
<head>
|
{% block title %} {{name}} Steamgifts Bot Notifications {% endblock %}
|
||||||
<title>{{name}} Steamgifts Bot DB View</title>
|
{% block content %}
|
||||||
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
|
<table>
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="logo">Steamgifts Bot</h1>
|
|
||||||
<strong>
|
|
||||||
<nav>
|
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{ url_for('config') }}">Config</a></li>
|
|
||||||
<li><a href="{{ url_for('log_info') }}">Info Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('log_debug') }}">Debug Logs</a></li>
|
|
||||||
<li><a href="{{ url_for('db_giveaways') }}">Giveaways</a></li>
|
|
||||||
<li><a href="{{ url_for('db_notifications') }}">Notifications</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
|
||||||
<table>
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
|
@ -46,6 +26,4 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
{% endblock %}
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -42,20 +42,20 @@ class WebServerThread(threading.Thread):
|
||||||
@app.route(f"{self.app_root}")
|
@app.route(f"{self.app_root}")
|
||||||
def config():
|
def config():
|
||||||
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/config.ini", 'r') as f:
|
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/config.ini", 'r') as f:
|
||||||
content = f.read()
|
data = f.read()
|
||||||
return render_template('configuration.html', name=self.prefix, content=content)
|
return render_template('configuration.html', name=self.prefix, data=data)
|
||||||
|
|
||||||
@app.route(f"{self.app_root}log_info")
|
@app.route(f"{self.app_root}log_info")
|
||||||
def log_info():
|
def log_info():
|
||||||
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", 'r') as f:
|
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", 'r') as f:
|
||||||
content = f.read()
|
data = f.read()
|
||||||
return render_template('log.html', name=self.prefix, log_type='info', content=content)
|
return render_template('log.html', name=self.prefix, log_type='info', data=data)
|
||||||
|
|
||||||
@app.route(f"{self.app_root}log_debug")
|
@app.route(f"{self.app_root}log_debug")
|
||||||
def log_debug():
|
def log_debug():
|
||||||
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", 'r') as f:
|
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", 'r') as f:
|
||||||
content = f.read()
|
data = f.read()
|
||||||
return render_template('log.html', name=self.prefix, log_type='debug', content=content)
|
return render_template('log.html', name=self.prefix, log_type='debug', data=data)
|
||||||
|
|
||||||
@app.route(f"{self.app_root}alive")
|
@app.route(f"{self.app_root}alive")
|
||||||
def alive():
|
def alive():
|
||||||
|
@ -63,12 +63,12 @@ class WebServerThread(threading.Thread):
|
||||||
|
|
||||||
@app.route(f"{self.app_root}notifications")
|
@app.route(f"{self.app_root}notifications")
|
||||||
def db_notifications():
|
def db_notifications():
|
||||||
return render_template('notifications.html', name=self.prefix, content=NotificationHelper.get())
|
return render_template('notifications.html', name=self.prefix, data=NotificationHelper.get())
|
||||||
|
|
||||||
@app.route(f"{self.app_root}giveaways", methods=['GET'], defaults={"page": 1})
|
@app.route(f"{self.app_root}giveaways", methods=['GET'], defaults={"page": 1})
|
||||||
@app.route(f"{self.app_root}giveaways/<int:page>", methods=['GET'])
|
@app.route(f"{self.app_root}giveaways/<int:page>", methods=['GET'])
|
||||||
def db_giveaways(page):
|
def db_giveaways(page):
|
||||||
return render_template('giveaways.html', name=self.prefix, content=GiveawayHelper.paginate(page=page))
|
return render_template('giveaways.html', name=self.prefix, data=GiveawayHelper.paginate(page=page))
|
||||||
|
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
logger.info("Webserver Enabled. Running")
|
logger.info("Webserver Enabled. Running")
|
||||||
|
|
Loading…
Reference in a new issue