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>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{name}} Steamgifts Bot Configuration</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">
|
||||
<pre>{{content}}</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} {{name}} Steamgifts Bot Configuration {% endblock %}
|
||||
{% block content %}
|
||||
<pre>{{data}}</pre>
|
||||
{% endblock %}
|
|
@ -1,35 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{name}} Steamgifts Bot DB View</title>
|
||||
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
|
||||
</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">
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} {{name}} Steamgifts Bot Giveaways {% endblock %}
|
||||
{% block content %}
|
||||
<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>
|
||||
{% if data.previous_page %}
|
||||
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=data.previous_page) }}">Previous</a></li>
|
||||
{% else %}
|
||||
<li class="page-item">Previous</li>
|
||||
{% endif %}
|
||||
{% if content.next_page %}
|
||||
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=content.next_page) }}">Next</a></li>
|
||||
{% if data.next_page %}
|
||||
<li class="page-item"> <a class="page-link" href="{{ url_for('db_giveaways', page=data.next_page) }}">Next</a></li>
|
||||
{% else %}
|
||||
<li class="page-item">Next</li>
|
||||
{% endif %}
|
||||
|
@ -52,7 +32,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in content.items %}
|
||||
{% for row in data.items %}
|
||||
<tr>
|
||||
<td>{{row.giveaway_id}}</td>
|
||||
<td>{{row.steam_id}}</td>
|
||||
|
@ -70,6 +50,4 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
|
@ -1,26 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{name}} Steamgifts Bot {{log_type}} Logs</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">
|
||||
<pre id="output">{{content}}</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} {{name}} Steamgifts Bot {{log_type}} Logs{% endblock %}
|
||||
{% block content %}
|
||||
<pre id="output">{{data}}</pre>
|
||||
{% endblock %}
|
|
@ -1,28 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{name}} Steamgifts Bot DB View</title>
|
||||
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
|
||||
</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>
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} {{name}} Steamgifts Bot Notifications {% endblock %}
|
||||
{% block content %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -46,6 +26,4 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
|
@ -42,20 +42,20 @@ class WebServerThread(threading.Thread):
|
|||
@app.route(f"{self.app_root}")
|
||||
def config():
|
||||
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/config.ini", 'r') as f:
|
||||
content = f.read()
|
||||
return render_template('configuration.html', name=self.prefix, content=content)
|
||||
data = f.read()
|
||||
return render_template('configuration.html', name=self.prefix, data=data)
|
||||
|
||||
@app.route(f"{self.app_root}log_info")
|
||||
def log_info():
|
||||
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", 'r') as f:
|
||||
content = f.read()
|
||||
return render_template('log.html', name=self.prefix, log_type='info', content=content)
|
||||
data = f.read()
|
||||
return render_template('log.html', name=self.prefix, log_type='info', data=data)
|
||||
|
||||
@app.route(f"{self.app_root}log_debug")
|
||||
def log_debug():
|
||||
with open(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", 'r') as f:
|
||||
content = f.read()
|
||||
return render_template('log.html', name=self.prefix, log_type='debug', content=content)
|
||||
data = f.read()
|
||||
return render_template('log.html', name=self.prefix, log_type='debug', data=data)
|
||||
|
||||
@app.route(f"{self.app_root}alive")
|
||||
def alive():
|
||||
|
@ -63,12 +63,12 @@ class WebServerThread(threading.Thread):
|
|||
|
||||
@app.route(f"{self.app_root}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/<int:page>", methods=['GET'])
|
||||
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:
|
||||
logger.info("Webserver Enabled. Running")
|
||||
|
|
Loading…
Reference in a new issue