forked from Minecraft/minecraft_manager
Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
jolheiser | 24fd3d6e45 |
2
admin.py
2
admin.py
|
@ -3,7 +3,7 @@ from __future__ import absolute_import
|
|||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from minecraft_manager.models import Application, Note, Ticket, TicketNote, Player, IP, UserSettings, Alert, Attachment
|
||||
from minecraft_manager.api.admin import register as api_register
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from minecraft_manager.api.models import Token
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from django.urls import path
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib.auth.decorators import login_required
|
||||
import minecraft_manager.external.views as external
|
||||
|
||||
urlpatterns = [
|
||||
path('apply/', external.Apply.as_view(), name="external-apply"),
|
||||
path('ticket/', external.Ticket.as_view(), name="external-ticket"),
|
||||
path('stats/', external.Stats.as_view(), name="external-stats"),
|
||||
path('stats/player/', external.StatsPlayer.as_view(), name="external-stats-player"),
|
||||
url(r'^apply/$', external.Apply.as_view(), name="external-apply"),
|
||||
url(r'^ticket/$', external.Ticket.as_view(), name="external-ticket"),
|
||||
url(r'^stats/$', external.Stats.as_view(), name="external-stats"),
|
||||
url(r'^stats/player/$', external.StatsPlayer.as_view(), name="external-stats-player"),
|
||||
]
|
||||
|
|
|
@ -66,12 +66,12 @@ class UserSettings(models.Model):
|
|||
class Application(models.Model):
|
||||
username = models.CharField("Minecraft Username", max_length=20, unique=True)
|
||||
age = models.PositiveSmallIntegerField()
|
||||
player_type = models.TextField("What's your favorite thing to do in Minecraft?", max_length=300)
|
||||
player_type = models.TextField("What type of player are you?", max_length=300)
|
||||
ever_banned = models.BooleanField("Have you ever been banned?", default=False)
|
||||
ever_banned_explanation = models.TextField("If you were previously banned, will you share why?", max_length=300, blank=True, null=True)
|
||||
reference = models.CharField("How did you find out about us? Please give a website or player name, if applicable.", max_length=50, blank=True, null=True)
|
||||
reference = models.CharField("How did you find out about our server?", max_length=50, blank=True, null=True)
|
||||
read_rules = models.CharField("Have you read the rules?", max_length=10)
|
||||
accepted = models.BooleanField(null=True)
|
||||
accepted = models.NullBooleanField()
|
||||
date = models.DateTimeField(auto_now_add=True, blank=True, null=True)
|
||||
objects = models.Manager()
|
||||
|
||||
|
|
|
@ -3,19 +3,22 @@
|
|||
min-height:100%;
|
||||
height:auto!important;
|
||||
position:fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
top:0px;
|
||||
left:0px;
|
||||
overflow:hidden;
|
||||
border:0;
|
||||
border:0px;
|
||||
z-index:-9;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#form {
|
||||
background: rgba(0, 0, 0, .75);
|
||||
background: rgba(255, 255, 255, .9);
|
||||
margin: auto;
|
||||
display: block;
|
||||
width: 75%;
|
||||
padding: 1em 5em;
|
||||
width: 35%;
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
padding-left: 5em;
|
||||
border-radius: 1em;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
@ -62,10 +65,6 @@
|
|||
color: black;
|
||||
}
|
||||
|
||||
.sub {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.rule {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
|
|
@ -1,249 +0,0 @@
|
|||
/* Sakura.css v1.3.1
|
||||
* ================
|
||||
* Minimal css theme.
|
||||
* Project: https://github.com/oxalorg/sakura/
|
||||
*/
|
||||
|
||||
/* Default Sakura Theme */
|
||||
:root {
|
||||
--color-blossom: #1d7484;
|
||||
--color-fade: #982c61;
|
||||
--color-bg: #f9f9f9;
|
||||
--color-bg-alt: #f1f1f1;
|
||||
--color-text: #4a4a4a;
|
||||
}
|
||||
|
||||
/* Sakura Dark Theme */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-blossom: #ffffff;
|
||||
--color-fade: #c9c9c9;
|
||||
--color-bg: #222222;
|
||||
--color-bg-alt: #4a4a4a;
|
||||
--color-text: #c9c9c9;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 62.5%;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 1.8rem;
|
||||
line-height: 1.618;
|
||||
max-width: 38em;
|
||||
margin: auto;
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-bg);
|
||||
padding: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 684px) {
|
||||
body {
|
||||
font-size: 1.53rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 382px) {
|
||||
body {
|
||||
font-size: 1.35rem;
|
||||
}
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
line-height: 1.1;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
||||
font-weight: 700;
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 1.5rem;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
-ms-word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.35em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 2.00em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.75em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
small, sub, sup {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-color: var(--color-blossom);
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: var(--color-blossom);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--color-fade);
|
||||
border-bottom: 2px solid var(--color-text);
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: var(--color-blossom);
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 1.4em;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
padding-left: 1em;
|
||||
padding-top: 0.8em;
|
||||
padding-bottom: 0.8em;
|
||||
padding-right: 0.8em;
|
||||
border-left: 5px solid var(--color-blossom);
|
||||
margin-bottom: 2.5rem;
|
||||
background-color: var(--color-bg-alt);
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
img, video {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
/* Pre and Code */
|
||||
pre {
|
||||
background-color: var(--color-bg-alt);
|
||||
display: block;
|
||||
padding: 1em;
|
||||
overflow-x: auto;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 0.9em;
|
||||
padding: 0 0.5em;
|
||||
background-color: var(--color-bg-alt);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre > code {
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
table {
|
||||
text-align: justify;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td, th {
|
||||
padding: 0.5em;
|
||||
border-bottom: 1px solid var(--color-bg-alt);
|
||||
}
|
||||
|
||||
/* Buttons, forms and input */
|
||||
input, textarea {
|
||||
border: 1px solid var(--color-text);
|
||||
}
|
||||
|
||||
input:focus, textarea:focus {
|
||||
border: 1px solid var(--color-blossom);
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.button, button, input[type="submit"], input[type="reset"], input[type="button"] {
|
||||
display: inline-block;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
background-color: var(--color-blossom);
|
||||
color: var(--color-bg);
|
||||
border-radius: 1px;
|
||||
border: 1px solid var(--color-blossom);
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.button[disabled], button[disabled], input[type="submit"][disabled], input[type="reset"][disabled], input[type="button"][disabled] {
|
||||
cursor: default;
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.button:focus:enabled, .button:hover:enabled, button:focus:enabled, button:hover:enabled, input[type="submit"]:focus:enabled, input[type="submit"]:hover:enabled, input[type="reset"]:focus:enabled, input[type="reset"]:hover:enabled, input[type="button"]:focus:enabled, input[type="button"]:hover:enabled {
|
||||
background-color: var(--color-fade);
|
||||
border-color: var(--color-fade);
|
||||
color: var(--color-bg);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
textarea, select, input {
|
||||
color: var(--color-text);
|
||||
padding: 6px 10px;
|
||||
/* The 6px vertically centers text on FF, ignored by Webkit */
|
||||
margin-bottom: 10px;
|
||||
background-color: var(--color-bg-alt);
|
||||
border: 1px solid var(--color-bg-alt);
|
||||
border-radius: 4px;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
textarea:focus, select:focus, input:focus {
|
||||
border: 1px solid var(--color-blossom);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:focus {
|
||||
outline: 1px dotted var(--color-blossom);
|
||||
}
|
||||
|
||||
label, legend, fieldset {
|
||||
display: block;
|
||||
margin-bottom: .5rem;
|
||||
font-weight: 600;
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
<!-- <p>Username: {{ application.username }}</p> -->
|
||||
<p>Age: {{ application.age }}</p>
|
||||
<p>Application Date: {{ application.date }}</p>
|
||||
<p>Favorite Activity:</p>
|
||||
<p>Type Of Player:</p>
|
||||
<p class="well">{{ application.player_type }}</p>
|
||||
{% if application.accepted is not null %}
|
||||
<p>Status: {{ application.status }}</p>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<p>Explanation: {{ application.ever_banned_explanation }}</p>
|
||||
{% endif %}
|
||||
{% if application.reference %}
|
||||
<p>Referral: {{ application.reference }}</p>
|
||||
<p>Reference: {{ application.reference }}</p>
|
||||
{% endif %}
|
||||
<p>Read The Rules: {{ application.read_rules }}</p>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{% extends 'minecraft_manager/external/base.html' %}
|
||||
{% load str_utils %}
|
||||
|
||||
{% block title %}Application Form{% endblock %}
|
||||
|
||||
|
@ -8,7 +7,7 @@
|
|||
{% block form_top %}
|
||||
<h3>Rules</h3>
|
||||
{% for rule in rules %}
|
||||
<div class="{% if rule|has_prefix:'*' %}sub {% endif %}rule">{{ rule }}</div>
|
||||
<div class="rule">{{ rule }}</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{% static 'minecraft_manager/css/external.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'minecraft_manager/css/sakura.css' %}">
|
||||
<link rel="stylesheet" href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
def has_prefix(value: str, arg: str) -> bool:
|
||||
return value.startswith(arg)
|
||||
|
||||
|
||||
register.filter('has_prefix', has_prefix)
|
42
urls.py
42
urls.py
|
@ -1,47 +1,47 @@
|
|||
from django.urls import path
|
||||
from django.conf.urls import url
|
||||
from django.views.generic import RedirectView
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
import minecraft_manager.views as mcm
|
||||
|
||||
urlpatterns = [
|
||||
path('', RedirectView.as_view(pattern_name='overview')),
|
||||
url(r'^$', RedirectView.as_view(pattern_name='overview')),
|
||||
|
||||
# Dashboard
|
||||
path('overview/', login_required(mcm.Overview.as_view()), name="overview"),
|
||||
path('ban/', login_required(mcm.Ban.as_view()), name="ban"),
|
||||
url(r'^overview/$', login_required(mcm.Overview.as_view()), name="overview"),
|
||||
url(r'^ban/$', login_required(mcm.Ban.as_view()), name="ban"),
|
||||
|
||||
# Alerts
|
||||
path('alert/', login_required(mcm.Alert.as_view()), name="alert"),
|
||||
path('alert/<int:alert_id>/', login_required(mcm.AlertInfo.as_view()), name="alert_info"),
|
||||
url(r'^alert/$', login_required(mcm.Alert.as_view()), name="alert"),
|
||||
url(r'^alert/(?P<alert_id>[0-9]{1,5})/$', login_required(mcm.AlertInfo.as_view()), name="alert_info"),
|
||||
|
||||
# Applications
|
||||
path('application/', login_required(mcm.Application.as_view()), name="application"),
|
||||
path('reference/', login_required(mcm.Reference.as_view()), name="reference"),
|
||||
path('application/<int:application_id>/', login_required(mcm.ApplicationInfo.as_view()), name="application_info"),
|
||||
url(r'^application/$', login_required(mcm.Application.as_view()), name="application"),
|
||||
url(r'^reference/$', login_required(mcm.Reference.as_view()), name="reference"),
|
||||
url(r'^application/(?P<application_id>[0-9]{1,5})/$', login_required(mcm.ApplicationInfo.as_view()), name="application_info"),
|
||||
|
||||
# Players
|
||||
path('player/', login_required(mcm.Player.as_view()), name="player"),
|
||||
path('player/<int:player_id>/', login_required(mcm.PlayerInfo.as_view()), name="player_info"),
|
||||
url(r'^player/$', login_required(mcm.Player.as_view()), name="player"),
|
||||
url(r'^player/(?P<player_id>[0-9]{1,5})/$', login_required(mcm.PlayerInfo.as_view()), name="player_info"),
|
||||
|
||||
# Tickets
|
||||
path('ticket/', login_required(mcm.Ticket.as_view()), name="ticket"),
|
||||
path('ticket/<int:ticket_id>/', login_required(mcm.TicketInfo.as_view()), name="ticket_info"),
|
||||
url(r'^ticket/$', login_required(mcm.Ticket.as_view()), name="ticket"),
|
||||
url(r'^ticket/(?P<ticket_id>[0-9]{1,5})/$', login_required(mcm.TicketInfo.as_view()), name="ticket_info"),
|
||||
|
||||
# Notes
|
||||
path('note/', login_required(mcm.Note.as_view()), name="note"),
|
||||
path('note/<int:note_id>/', login_required(mcm.NoteInfo.as_view()), name='note_info'),
|
||||
path('note/add', login_required(mcm.NoteAdd.as_view()), name="note_add"),
|
||||
url(r'^note/$', login_required(mcm.Note.as_view()), name="note"),
|
||||
url(r'^note/(?P<note_id>[0-9]{1,5})/$', login_required(mcm.NoteInfo.as_view()), name='note_info'),
|
||||
url(r'^note/add$', login_required(mcm.NoteAdd.as_view()), name="note_add"),
|
||||
|
||||
# Attachments
|
||||
path('attachment/<int:attachment_id>/', login_required(mcm.Attachment.as_view()), name="attachment"),
|
||||
path('attachment/<str:ref_model>/<int:ref_id>/', login_required(mcm.AddAttachment.as_view()), name='attachment_add'),
|
||||
url(r'^attachment/(?P<attachment_id>[0-9]{1,5})/$', login_required(mcm.Attachment.as_view()), name="attachment"),
|
||||
url(r'attachment/(?P<ref_model>[A-Za-z])/(?P<ref_id>[0-9]{1,5})/$', login_required(mcm.AddAttachment.as_view()), name='attachment_add'),
|
||||
|
||||
# IP
|
||||
path('ip/<int:ip_id>/', login_required(mcm.IP.as_view()), name="ip"),
|
||||
url(r'^ip/(?P<ip_id>[0-9]{1,5})/$', login_required(mcm.IP.as_view()), name="ip"),
|
||||
|
||||
# Report
|
||||
path('report/', login_required(mcm.Report.as_view()), name="report"),
|
||||
url(r'^report/$', login_required(mcm.Report.as_view()), name="report"),
|
||||
|
||||
# Chat
|
||||
path('chat/', permission_required('minecraft_manager.chat')(mcm.Chat.as_view()), name="chat"),
|
||||
url(r'^chat/$', permission_required('minecraft_manager.chat')(mcm.Chat.as_view()), name="chat"),
|
||||
]
|
||||
|
|
4
utils.py
4
utils.py
|
@ -34,12 +34,12 @@ def build_application(application):
|
|||
embed.add_field(name="Application ID", value=application.id)
|
||||
embed.add_field(name="Username", value=application.username.replace("_", "\\_"))
|
||||
embed.add_field(name="Age", value=application.age)
|
||||
embed.add_field(name="Favorite Activity", value=application.player_type)
|
||||
embed.add_field(name="Type of Player", value=application.player_type)
|
||||
embed.add_field(name="Ever been banned", value=application.ever_banned)
|
||||
if application.ever_banned and application.ever_banned_explanation:
|
||||
embed.add_field(name="Reason for being banned", value=application.ever_banned_explanation)
|
||||
if application.reference:
|
||||
embed.add_field(name="Referral", value=application.reference)
|
||||
embed.add_field(name="Reference", value=application.reference)
|
||||
embed.add_field(name="Read the Rules", value=application.read_rules)
|
||||
embed.timestamp = application.date
|
||||
embed.add_field(name="Status", value=application.status)
|
||||
|
|
Loading…
Reference in New Issue