Add a basic admin interface (Fix issue #10)
Add a basic admin interface (Fix issue #10) wip again still wip fix login pagepull/256/head
parent
d37b5bb030
commit
0a93c866ff
@ -0,0 +1,115 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
input {
|
||||
text-align: center;
|
||||
}
|
||||
.header::before, .header::after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
.header::after {
|
||||
clear: both;
|
||||
}
|
||||
.header::before, .header::after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
.header {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 68em;
|
||||
padding-bottom: 1em;
|
||||
padding-top: 1em;
|
||||
}
|
||||
.header header {
|
||||
display: block;
|
||||
float: left;
|
||||
font-weight: normal;
|
||||
margin-right: 16.0363%;
|
||||
width: 41.9818%;
|
||||
}
|
||||
.header header .logo {
|
||||
float: left;
|
||||
max-height: 60px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.header header h1 {
|
||||
font-size: 1.55em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
.header header h2 {
|
||||
font-size: 1.05em;
|
||||
}
|
||||
.header a, .header a:visited {
|
||||
color: #4d4c4c;
|
||||
text-decoration: none;
|
||||
}
|
||||
.outer {
|
||||
background-color: #eeeeee;
|
||||
box-shadow: 0 0 0.5em #c0c0c0 inset;
|
||||
}
|
||||
.outer .filters::before, .outer .filters::after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
.outer .filters::after {
|
||||
clear: both;
|
||||
}
|
||||
.outer .filters::before, .outer .filters::after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
.outer .filters {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 68em;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #4d4c4c;
|
||||
}
|
||||
.label {
|
||||
background-color: #ddd;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
cursor: pointer;
|
||||
line-height: 1.4em;
|
||||
outline: 0 none;
|
||||
padding: calc(0.6em - 1px);
|
||||
}
|
||||
.active {
|
||||
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.6) inset;
|
||||
}
|
||||
.label-valid {
|
||||
background-color: #cfc;
|
||||
border-color: #cfc;
|
||||
}
|
||||
.label-pending {
|
||||
background-color: #ffc;
|
||||
border-color: #ffc;
|
||||
}
|
||||
.mode {
|
||||
float: left;
|
||||
}
|
||||
.pagination {
|
||||
float: right;
|
||||
}
|
||||
.note .label {
|
||||
margin: 9px;
|
||||
padding: 3px;
|
||||
}
|
||||
#login {
|
||||
margin-top: 40px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
After Width: | Height: | Size: 11 KiB |
@ -0,0 +1,154 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Isso admin</title>
|
||||
<link type="text/css" href="/css/isso.css" rel="stylesheet">
|
||||
<link type="text/css" href="/css/admin.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
function ajax(req) {
|
||||
var r = new XMLHttpRequest();
|
||||
r.open(req.method, req.url, true);
|
||||
r.onreadystatechange = function () {
|
||||
if (r.readyState != 4 || r.status != 200) {
|
||||
if (req.failure) {
|
||||
req.failure();
|
||||
}
|
||||
return;
|
||||
}
|
||||
req.success(r.responseText);
|
||||
};
|
||||
r.send(req.data);
|
||||
}
|
||||
function fade(element) {
|
||||
var op = 1; // initial opacity
|
||||
var timer = setInterval(function () {
|
||||
if (op <= 0.1){
|
||||
clearInterval(timer);
|
||||
element.style.display = 'none';
|
||||
}
|
||||
element.style.opacity = op;
|
||||
element.style.filter = 'alpha(opacity=' + op * 100 + ")";
|
||||
op -= op * 0.1;
|
||||
}, 10);
|
||||
}
|
||||
function moderate(com_id, hash, action) {
|
||||
ajax({method: "POST",
|
||||
url: "/id/" + com_id + "/" + action + "/" + hash,
|
||||
success: function(){
|
||||
fade(document.getElementById("isso-" + com_id));
|
||||
}});
|
||||
}
|
||||
function validate_com(com_id, hash) {
|
||||
moderate(com_id, hash, "validate");
|
||||
}
|
||||
function delete_com(com_id, hash) {
|
||||
moderate(com_id, hash, "delete");
|
||||
}
|
||||
</script>
|
||||
<div class="wrapper">
|
||||
<div class="header">
|
||||
<header>
|
||||
<img class="logo" src="/img/isso.svg" alt="Wynaut by @veekun"/>
|
||||
<div class="title">
|
||||
<a href="./">
|
||||
<h1>Isso</h1>
|
||||
<h2>Administration</h2>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
<div class="outer">
|
||||
<div class="filters">
|
||||
<div class="mode">
|
||||
<a href="?mode=1&page={{page}}">
|
||||
<span class="label label-valid {% if mode == 1 %}active{% endif %}">
|
||||
Valid ({{counts.get(1, 0)}})
|
||||
</span>
|
||||
</a>
|
||||
<a href="?mode=2&page={{page}}">
|
||||
<span class="label label-pending {% if mode == 2 %}active{% endif %}">
|
||||
Pending ({{counts.get(2, 0)}})
|
||||
</span>
|
||||
</a>
|
||||
<a href="?mode=4&page={{page}}">
|
||||
<span class="label label-staled {% if mode == 4 %}active{% endif %}">
|
||||
Staled ({{counts.get(4, 0)}})
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
Pages:
|
||||
{% if page > 0 %}
|
||||
<a href="?mode={{mode}}&page={{page - 1}}">
|
||||
«
|
||||
</a>
|
||||
{% endif %}
|
||||
<input type="text" size="1" name="page" value="{{page}}" />
|
||||
{% if page < max_page %}
|
||||
<a href="?mode={{mode}}&page={{page + 1}}">
|
||||
»
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<main>
|
||||
{% for comment in comments %}
|
||||
<div class='isso-comment' id='isso-{{comment.id}}'>
|
||||
{% if conf.avatar %}
|
||||
<div class='avatar'>
|
||||
svg(data-hash='#{{comment.hash}}')
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class='text-wrapper'>
|
||||
<div class='isso-comment-header' role='meta'>
|
||||
{% if comment.author %}
|
||||
<span class='author'>{{comment.author}}</span>
|
||||
{% else %}
|
||||
<span class='author'>Anonymous</span>
|
||||
{% endif %}
|
||||
{% if comment.website %}
|
||||
<a href="{{comment.website}}" rel='nofollow' class='website'>({{comment.website}})</a>
|
||||
{% endif %}
|
||||
<span class="spacer"> •</span>
|
||||
<time>{{comment.created | datetimeformat}}</time>
|
||||
<span class='note'>
|
||||
{% if comment.mode == 1 %}
|
||||
<span class="label label-valid">Valid</span>
|
||||
{% elif comment.mode == 2 %}
|
||||
<span class="label label-pending">Pending</span>
|
||||
{% elif comment.mode == 4 %}
|
||||
<span class="label label-staled">Staled</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
<div class='text'>
|
||||
{% if comment.mode == 4 %}
|
||||
<strong>HIDDEN</strong>. Original text: <br />
|
||||
{% endif %}
|
||||
{{comment.text}}
|
||||
</div>
|
||||
<div class='isso-comment-footer'>
|
||||
{% if conf.votes and comment.likes - comment.dislikes != 0 %}
|
||||
<span class='votes'>{{comment.likes - comment.dislikes}}</span>
|
||||
{% endif %}
|
||||
<span class='spacer'></span>
|
||||
{% if comment.mode != 4 %}
|
||||
<a class="delete"
|
||||
onClick="javascript:delete_com({{comment.id}}, '{{comment.hash}}')">
|
||||
Delete
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if comment.mode == 2 %}
|
||||
<a class='validate'
|
||||
onClick="javascript:validate_com({{comment.id}}, '{{comment.hash}}')">Validate</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Isso admin</title>
|
||||
<link type="text/css" href="/css/isso.css" rel="stylesheet">
|
||||
<link type="text/css" href="/css/admin.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="header">
|
||||
<header>
|
||||
<img class="logo" src="/img/isso.svg" alt="Wynaut by @veekun"/>
|
||||
<div class="title">
|
||||
<a href="./">
|
||||
<h1>Isso</h1>
|
||||
<h2>Administration</h2>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
<main>
|
||||
<div id="login">
|
||||
Administration secured by password:
|
||||
<form method="POST" action="/login">
|
||||
<input type="password" name="password" />
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue