forgery/templates/index.html

178 lines
4.6 KiB
HTML
Raw Normal View History

{% import "macros.html" as macros %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Forgejo Spam Admin</title>
<!-- Font Awesome -->
<!-- <link -->
<!-- rel="stylesheet" -->
<!-- href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" -->
<!-- /> -->
<!-- Google Fonts Roboto -->
<!-- <link -->
<!-- rel="stylesheet" -->
<!-- href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap" -->
<!-- /> -->
<!-- MDB -->
<!-- <link rel="stylesheet" href="css/mdb.min.css" /> -->
</head>
<style>
.main {
display: flex;
flex-direction: column;
gap: 30px;
align-items: center;
}
.users {
display: flex;
flex-direction: column;
gap: 15px;
}
.user {
display: flex;
flex-direction: row;
gap: 10px;
align-items: center;
border: 1px dotted #000;
padding: 3px 8px 3px 8px;
margin: 3px;
}
.user-card {
display: flex;
flex-direction: column;
}
.user-name {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 10px;
}
.user-info {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 10px;
}
.user-classification {
display: flex;
flex-direction: column;
gap: 3px;
}
input.radio-classify {
display: none;
}
input.radio-classify + label {
border: 1px solid #000;
padding: 2px;
text-align: center;
}
input.radio-spam:checked + label {
border: 1px solid #d00400;
background: #d00400;
color: #fff;
}
input.radio-legit:checked + label {
border: 1px solid #048e02;
background: #048e02;
color: #fff;
}
.score {
padding-left: 3px;
padding-right: 3px;
width: 2.8em;
text-align: center;
flex-grow: 0;
flex-shrink: 0;
}
.score-high {
background: #ff696b;
}
.score-mid {
background: #ffa769;
}
.score-low {
background: #5fd770;
}
</style>
<body>
<form method="post">
<div class="main">
<div class="stats">
Users: unclassified: {{unclassified_users_count}} | total: {{total_users_count}}
</div>
<div class="users">
{% for id_user_score in users %}
{% set user_id = id_user_score[0] %}
{% set user = id_user_score[1] %}
{% set score = id_user_score[2] %}
<div class="user">
<div class="user-classification">
<input type="radio" name="{{user_id}}" id="{{user_id}}-spam" value="spam"
class="radio-classify radio-spam"
{% if score >= 0.8 %}checked{% endif %}
/>
<label for="{{user_id}}-spam">Spam</label>
<input type="radio" name="{{user_id}}" id="{{user_id}}-legit" value="legit"
class="radio-classify radio-legit"
{% if score < 0.8 %}checked{% endif %}
/>
<label for="{{user_id}}-legit">Legit</label>
</div>
<div class="score
{% if score >= 0.8 %} score-high {% endif %}
{% if score < 0.8 and score > 0.3 %} score-mid {% endif %}
{% if score <= 0.3 %} score-low {% endif %}
">
{{ score | round(precision=2) }}
</div>
<div class="user-card">
<div class="user-name">
<div><strong>{{ user.login }}</strong></div>
{%- if user.full_name %}<div><strong>({{ user.full_name }})</strong></div>{% endif -%}
</div>
<div class="user-info">
{%- if user.location %}<div>[L] {{ user.location }}</div>{% endif -%}
{%- if user.website %}<div>[W] {{ user.website }}</div>{% endif -%}
</div>
{%- if user.description %}<div>[D] {{ user.description }}</div>{% endif -%}
{%- if user.repos | length > 0 %}
<div class="user-repos">
<div>Repositories:</div>
{% for repo in user.repos %}
<div>{{ macros::compact(name=repo[1].name, desc=repo[1].description) }}</div>
{% endfor %}
</div>
{% endif -%}
{%- if user.issues | length > 0 %}
<div class="user-issues">
<div>Issues:</div>
{% for issue in user.issues %}
<div>{{ macros::compact(name=issue[1].title, desc=issue[1].body) }}</div>
{% endfor %}
</div>
{% endif -%}
</div>
</div>
{% endfor %}
</div>
<input type="submit" value="Apply" class="button" style="width: 200px; height: 30px"/>
</div>
</form>
</body>
</html>