Compare commits

..

1 Commits
master ... roll

Author SHA1 Message Date
jolheiser 24fd3d6e45
Some small fixes
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2022-02-14 22:21:02 -06:00
12 changed files with 46 additions and 308 deletions

View File

@ -3,7 +3,7 @@ from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User 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.models import Application, Note, Ticket, TicketNote, Player, IP, UserSettings, Alert, Attachment
from minecraft_manager.api.admin import register as api_register from minecraft_manager.api.admin import register as api_register

View File

@ -1,5 +1,5 @@
from django.contrib import admin 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 from minecraft_manager.api.models import Token

12
external/urls.py vendored
View File

@ -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 import minecraft_manager.external.views as external
urlpatterns = [ urlpatterns = [
path('apply/', external.Apply.as_view(), name="external-apply"), url(r'^apply/$', external.Apply.as_view(), name="external-apply"),
path('ticket/', external.Ticket.as_view(), name="external-ticket"), url(r'^ticket/$', external.Ticket.as_view(), name="external-ticket"),
path('stats/', external.Stats.as_view(), name="external-stats"), url(r'^stats/$', external.Stats.as_view(), name="external-stats"),
path('stats/player/', external.StatsPlayer.as_view(), name="external-stats-player"), url(r'^stats/player/$', external.StatsPlayer.as_view(), name="external-stats-player"),
] ]

View File

@ -66,12 +66,12 @@ class UserSettings(models.Model):
class Application(models.Model): class Application(models.Model):
username = models.CharField("Minecraft Username", max_length=20, unique=True) username = models.CharField("Minecraft Username", max_length=20, unique=True)
age = models.PositiveSmallIntegerField() 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 = 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) 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) 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) date = models.DateTimeField(auto_now_add=True, blank=True, null=True)
objects = models.Manager() objects = models.Manager()

View File

@ -3,19 +3,22 @@
min-height:100%; min-height:100%;
height:auto!important; height:auto!important;
position:fixed; position:fixed;
top:0; top:0px;
left:0; left:0px;
overflow:hidden; overflow:hidden;
border:0; border:0px;
z-index:-9; z-index:-9;
float:left; float:left;
} }
#form { #form {
background: rgba(0, 0, 0, .75); background: rgba(255, 255, 255, .9);
margin: auto;
display: block; display: block;
width: 75%; width: 35%;
padding: 1em 5em; padding-top: 1em;
padding-bottom: 1em;
padding-left: 5em;
border-radius: 1em; border-radius: 1em;
top: 50%; top: 50%;
left: 50%; left: 50%;
@ -62,10 +65,6 @@
color: black; color: black;
} }
.sub {
margin-left: 1em;
}
.rule { .rule {
margin-bottom: .5em; margin-bottom: .5em;
} }

View File

@ -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;
}

View File

@ -9,7 +9,7 @@
<!-- <p>Username: {{ application.username }}</p> --> <!-- <p>Username: {{ application.username }}</p> -->
<p>Age: {{ application.age }}</p> <p>Age: {{ application.age }}</p>
<p>Application Date: {{ application.date }}</p> <p>Application Date: {{ application.date }}</p>
<p>Favorite Activity:</p> <p>Type Of Player:</p>
<p class="well">{{ application.player_type }}</p> <p class="well">{{ application.player_type }}</p>
{% if application.accepted is not null %} {% if application.accepted is not null %}
<p>Status: {{ application.status }}</p> <p>Status: {{ application.status }}</p>
@ -26,7 +26,7 @@
<p>Explanation: {{ application.ever_banned_explanation }}</p> <p>Explanation: {{ application.ever_banned_explanation }}</p>
{% endif %} {% endif %}
{% if application.reference %} {% if application.reference %}
<p>Referral: {{ application.reference }}</p> <p>Reference: {{ application.reference }}</p>
{% endif %} {% endif %}
<p>Read The Rules: {{ application.read_rules }}</p> <p>Read The Rules: {{ application.read_rules }}</p>
</div> </div>

View File

@ -1,5 +1,4 @@
{% extends 'minecraft_manager/external/base.html' %} {% extends 'minecraft_manager/external/base.html' %}
{% load str_utils %}
{% block title %}Application Form{% endblock %} {% block title %}Application Form{% endblock %}
@ -8,7 +7,7 @@
{% block form_top %} {% block form_top %}
<h3>Rules</h3> <h3>Rules</h3>
{% for rule in rules %} {% for rule in rules %}
<div class="{% if rule|has_prefix:'*' %}sub {% endif %}rule">{{ rule }}</div> <div class="rule">{{ rule }}</div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

View File

@ -10,7 +10,6 @@
<script src='https://www.google.com/recaptcha/api.js'></script> <script src='https://www.google.com/recaptcha/api.js'></script>
{% endif %} {% endif %}
<link rel="stylesheet" href="{% static 'minecraft_manager/css/external.css' %}"> <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"> <link rel="stylesheet" href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
</head> </head>
<body> <body>

View File

@ -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
View File

@ -1,47 +1,47 @@
from django.urls import path from django.conf.urls import url
from django.views.generic import RedirectView from django.views.generic import RedirectView
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
import minecraft_manager.views as mcm import minecraft_manager.views as mcm
urlpatterns = [ urlpatterns = [
path('', RedirectView.as_view(pattern_name='overview')), url(r'^$', RedirectView.as_view(pattern_name='overview')),
# Dashboard # Dashboard
path('overview/', login_required(mcm.Overview.as_view()), name="overview"), url(r'^overview/$', login_required(mcm.Overview.as_view()), name="overview"),
path('ban/', login_required(mcm.Ban.as_view()), name="ban"), url(r'^ban/$', login_required(mcm.Ban.as_view()), name="ban"),
# Alerts # Alerts
path('alert/', login_required(mcm.Alert.as_view()), name="alert"), url(r'^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/(?P<alert_id>[0-9]{1,5})/$', login_required(mcm.AlertInfo.as_view()), name="alert_info"),
# Applications # Applications
path('application/', login_required(mcm.Application.as_view()), name="application"), url(r'^application/$', login_required(mcm.Application.as_view()), name="application"),
path('reference/', login_required(mcm.Reference.as_view()), name="reference"), url(r'^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/(?P<application_id>[0-9]{1,5})/$', login_required(mcm.ApplicationInfo.as_view()), name="application_info"),
# Players # Players
path('player/', login_required(mcm.Player.as_view()), name="player"), url(r'^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/(?P<player_id>[0-9]{1,5})/$', login_required(mcm.PlayerInfo.as_view()), name="player_info"),
# Tickets # Tickets
path('ticket/', login_required(mcm.Ticket.as_view()), name="ticket"), url(r'^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/(?P<ticket_id>[0-9]{1,5})/$', login_required(mcm.TicketInfo.as_view()), name="ticket_info"),
# Notes # Notes
path('note/', login_required(mcm.Note.as_view()), name="note"), url(r'^note/$', login_required(mcm.Note.as_view()), name="note"),
path('note/<int:note_id>/', login_required(mcm.NoteInfo.as_view()), name='note_info'), url(r'^note/(?P<note_id>[0-9]{1,5})/$', login_required(mcm.NoteInfo.as_view()), name='note_info'),
path('note/add', login_required(mcm.NoteAdd.as_view()), name="note_add"), url(r'^note/add$', login_required(mcm.NoteAdd.as_view()), name="note_add"),
# Attachments # Attachments
path('attachment/<int:attachment_id>/', login_required(mcm.Attachment.as_view()), name="attachment"), url(r'^attachment/(?P<attachment_id>[0-9]{1,5})/$', 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<ref_model>[A-Za-z])/(?P<ref_id>[0-9]{1,5})/$', login_required(mcm.AddAttachment.as_view()), name='attachment_add'),
# IP # 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 # Report
path('report/', login_required(mcm.Report.as_view()), name="report"), url(r'^report/$', login_required(mcm.Report.as_view()), name="report"),
# Chat # 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"),
] ]

View File

@ -34,12 +34,12 @@ def build_application(application):
embed.add_field(name="Application ID", value=application.id) embed.add_field(name="Application ID", value=application.id)
embed.add_field(name="Username", value=application.username.replace("_", "\\_")) embed.add_field(name="Username", value=application.username.replace("_", "\\_"))
embed.add_field(name="Age", value=application.age) 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) embed.add_field(name="Ever been banned", value=application.ever_banned)
if application.ever_banned and application.ever_banned_explanation: if application.ever_banned and application.ever_banned_explanation:
embed.add_field(name="Reason for being banned", value=application.ever_banned_explanation) embed.add_field(name="Reason for being banned", value=application.ever_banned_explanation)
if application.reference: 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.add_field(name="Read the Rules", value=application.read_rules)
embed.timestamp = application.date embed.timestamp = application.date
embed.add_field(name="Status", value=application.status) embed.add_field(name="Status", value=application.status)