Add sakura and update Django

Signed-off-by: jolheiser <john.olheiser@gmail.com>
pull/19/head
jolheiser 2022-02-14 21:58:35 -06:00
parent fa2701cc4c
commit b3bfed2e4f
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
10 changed files with 302 additions and 40 deletions

View File

@ -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 ugettext_lazy as _
from django.utils.translation import gettext 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

View File

@ -1,5 +1,5 @@
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext as _
from minecraft_manager.api.models import Token

12
external/urls.py vendored
View File

@ -1,10 +1,10 @@
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.urls import path
import minecraft_manager.external.views as external
urlpatterns = [
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"),
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"),
]

View File

@ -71,7 +71,7 @@ class Application(models.Model):
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)
read_rules = models.CharField("Have you read the rules?", max_length=10)
accepted = models.NullBooleanField()
accepted = models.BooleanField(null=True)
date = models.DateTimeField(auto_now_add=True, blank=True, null=True)
objects = models.Manager()

View File

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

View File

@ -0,0 +1,249 @@
/* 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

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

View File

@ -10,6 +10,7 @@
<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>

View File

@ -0,0 +1,10 @@
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.conf.urls import url
from django.urls import path
from django.views.generic import RedirectView
from django.contrib.auth.decorators import login_required, permission_required
import minecraft_manager.views as mcm
urlpatterns = [
url(r'^$', RedirectView.as_view(pattern_name='overview')),
path('', RedirectView.as_view(pattern_name='overview')),
# Dashboard
url(r'^overview/$', login_required(mcm.Overview.as_view()), name="overview"),
url(r'^ban/$', login_required(mcm.Ban.as_view()), name="ban"),
path('overview/', login_required(mcm.Overview.as_view()), name="overview"),
path('ban/', login_required(mcm.Ban.as_view()), name="ban"),
# Alerts
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"),
path('alert/', login_required(mcm.Alert.as_view()), name="alert"),
path('alert/<int:alert_id>/', login_required(mcm.AlertInfo.as_view()), name="alert_info"),
# Applications
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"),
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"),
# Players
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"),
path('player/', login_required(mcm.Player.as_view()), name="player"),
path('player/<int:player_id>/', login_required(mcm.PlayerInfo.as_view()), name="player_info"),
# Tickets
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"),
path('ticket/', login_required(mcm.Ticket.as_view()), name="ticket"),
path('ticket/<int:ticket_id>/', login_required(mcm.TicketInfo.as_view()), name="ticket_info"),
# Notes
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"),
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"),
# Attachments
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'),
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'),
# IP
url(r'^ip/(?P<ip_id>[0-9]{1,5})/$', login_required(mcm.IP.as_view()), name="ip"),
path('ip/<int:ip_id>/', login_required(mcm.IP.as_view()), name="ip"),
# Report
url(r'^report/$', login_required(mcm.Report.as_view()), name="report"),
path('report/', login_required(mcm.Report.as_view()), name="report"),
# Chat
url(r'^chat/$', permission_required('minecraft_manager.chat')(mcm.Chat.as_view()), name="chat"),
path('chat/', permission_required('minecraft_manager.chat')(mcm.Chat.as_view()), name="chat"),
]