mirror of https://github.com/kianby/stacosys
commit
8d663c7ee7
@ -0,0 +1,17 @@
|
||||
import configparser
|
||||
import os
|
||||
|
||||
|
||||
class Messages:
|
||||
def __init__(self):
|
||||
self.property_dict = {}
|
||||
|
||||
def load_messages(self, lang):
|
||||
config = configparser.ConfigParser()
|
||||
config.read(os.path.join(os.path.dirname(__file__), 'messages_' + lang + '.properties'))
|
||||
|
||||
for key, value in config.items('messages'):
|
||||
self.property_dict[key] = value
|
||||
|
||||
def get(self, key):
|
||||
return self.property_dict.get(key)
|
@ -0,0 +1,6 @@
|
||||
[messages]
|
||||
login.failure.username=Username or password incorrect
|
||||
logout.flash=You have been logged out.
|
||||
admin.comment.notfound=Comment not found.
|
||||
admin.comment.approved=Comment published.
|
||||
admin.comment.deleted=Comment deleted.
|
@ -0,0 +1,6 @@
|
||||
[messages]
|
||||
login.failure.username=Identifiant ou mot de passe incorrect
|
||||
logout.flash=Vous avez été déconnecté.
|
||||
admin.comment.notfound=Commentaire introuvable
|
||||
admin.comment.approved=Commentaire publié
|
||||
admin.comment.deleted=Commentaire supprimé
|
@ -0,0 +1,64 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Stacosys Comment Moderation</title>
|
||||
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h2>Comment Moderation</h2>
|
||||
<nav>
|
||||
<a href="/web/logout">Log out</a>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<blockquote>
|
||||
{% for message in messages %}
|
||||
<p>{{ message }}</p>
|
||||
{% endfor %}
|
||||
</blockquote>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Author</th>
|
||||
<th>Comment</th>
|
||||
<th>Article</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for comment in comments %}
|
||||
<tr>
|
||||
<td>{{ comment.created }}</td>
|
||||
<td>{{ comment.author_name }}</td>
|
||||
<td>{{ comment.content }}</td>
|
||||
<td><a href="{{ baseurl + comment.url }}">{{ comment.url }}</a></td>
|
||||
<td>
|
||||
<form action="/web/admin" method="post">
|
||||
<input type="hidden" name="comment" value="{{comment.id}}">
|
||||
<input type="hidden" name="action" value="APPROVE">
|
||||
<button type="submit">Approve</button>
|
||||
</form>
|
||||
<form action="/web/admin" method="post">
|
||||
<input type="hidden" name="comment" value="{{comment.id}}">
|
||||
<input type="hidden" name="action" value="REJECT">
|
||||
<button type="submit">Reject</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
<footer>
|
||||
<p>This page was designed by Yax with <a href="https://simplecss.org">Simple.css</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,42 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Stacosys</title>
|
||||
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
|
||||
<style>
|
||||
form {
|
||||
width: 350px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h2>Comment Moderation Login</h2>
|
||||
</header>
|
||||
<main>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<blockquote>
|
||||
{% for message in messages %}
|
||||
<p>{{ message }}</p>
|
||||
{% endfor %}
|
||||
</blockquote>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form action="/web/login" method="POST">
|
||||
<p><label>Username:</label></p>
|
||||
<p><input type="text" name="username" /></p>
|
||||
<p><label>Password:</label></p>
|
||||
<p><input type="password" name="password" /></p>
|
||||
<input type="submit" value="Log in" />
|
||||
</form>
|
||||
</main>
|
||||
<footer>
|
||||
<p>This page was designed with <a href="https://simplecss.org">Simple.css</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue