tickets frontend
parent
de4b3490e6
commit
404944572b
|
@ -1,5 +1,6 @@
|
||||||
from random import shuffle
|
from random import shuffle
|
||||||
|
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
from django.forms import ChoiceField
|
from django.forms import ChoiceField
|
||||||
|
|
||||||
CAPTCHA_CHOICES = [('two', 'zorp borp'),
|
CAPTCHA_CHOICES = [('two', 'zorp borp'),
|
||||||
|
|
|
@ -1,5 +1,48 @@
|
||||||
from django.forms import Form
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.forms import Form, CharField, EmailField, Textarea, ChoiceField
|
||||||
|
|
||||||
|
from common.forms import CaptchaField
|
||||||
|
|
||||||
|
ISSUE_TYPE_CHOICES = (
|
||||||
|
('logging_in', 'help logging in'),
|
||||||
|
('concern_site', 'concern about the site'),
|
||||||
|
('concern_user', 'concern about another user'),
|
||||||
|
('package', 'install a package'),
|
||||||
|
('question', 'just a question',),
|
||||||
|
('other', 'something else'),
|
||||||
|
)
|
||||||
|
|
||||||
|
def validate_issue_text(text):
|
||||||
|
if len(text) == 0:
|
||||||
|
raise ValidationError('please describe yr issue')
|
||||||
|
if len(text) > 500:
|
||||||
|
raise ValidationError('too long')
|
||||||
|
|
||||||
|
|
||||||
class TicketForm(Form):
|
class TicketForm(Form):
|
||||||
pass
|
name = CharField(label='name',
|
||||||
|
help_text='your tilde.town username if you have one, otherwise just something to address you as'
|
||||||
|
)
|
||||||
|
email = EmailField(
|
||||||
|
help_text='only used to message you about this ticket and nothing else.',
|
||||||
|
label='e-mail',
|
||||||
|
)
|
||||||
|
issue_type = ChoiceField(
|
||||||
|
choices=ISSUE_TYPE_CHOICES,
|
||||||
|
label='type of issue',
|
||||||
|
help_text='the type of issue that best describes your problem'
|
||||||
|
)
|
||||||
|
issue_text = CharField(
|
||||||
|
widget=Textarea,
|
||||||
|
label="what's up?",
|
||||||
|
help_text='describe your issue (in 500 characters or less)',
|
||||||
|
validators=(validate_issue_text,),
|
||||||
|
)
|
||||||
|
captcha = CaptchaField()
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
result = super().clean()
|
||||||
|
if self.errors:
|
||||||
|
raise ValidationError('oops, looks like there were some problems below.')
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
|
@ -1 +1,73 @@
|
||||||
lololol
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>tilde.town help desk</title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
background-color: #E0B0FF;
|
||||||
|
}
|
||||||
|
#tickets th {
|
||||||
|
text-align:left;
|
||||||
|
}
|
||||||
|
#tickets .helptext {
|
||||||
|
font-style:oblique;
|
||||||
|
}
|
||||||
|
#tickets {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border: 1px solid #ff1ac6;
|
||||||
|
}
|
||||||
|
#tickets th,td {
|
||||||
|
border: 1px solid #ff1ac6;
|
||||||
|
padding:1em;
|
||||||
|
}
|
||||||
|
#tickets input[type=submit] {
|
||||||
|
font-size:200%;
|
||||||
|
}
|
||||||
|
#tickets ul.errorlist {
|
||||||
|
list-style: none;
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left:0;
|
||||||
|
}
|
||||||
|
#tickets ul.errorlist li:before {
|
||||||
|
content: "~! ";
|
||||||
|
}
|
||||||
|
#tickets ul.errorlist li {
|
||||||
|
background-color:black;
|
||||||
|
color:white;
|
||||||
|
border: .5em dashed red;
|
||||||
|
font-family:arial;
|
||||||
|
padding:2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>tilde.town help desk</h1>
|
||||||
|
<p>
|
||||||
|
hi!
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
this form exists to make it easier for the tilde.town admin to help
|
||||||
|
people out with system issues like logging in, package installation,
|
||||||
|
and general questions.
|
||||||
|
</p>
|
||||||
|
<p> in using this system, recall that there is just the one admin (<a
|
||||||
|
href="https://tilde.town/~vilmibm">~vilmibm</a>) and it might take
|
||||||
|
3-4 days to get a response. Usually you'll hear back within a day,
|
||||||
|
though!
|
||||||
|
</p>
|
||||||
|
{% if error_message %}
|
||||||
|
<p><strong>{{ error_message }}</strong></p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form id="tickets" action="{% url 'help:tickets' %}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="submit" value="send off ticket <3">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
|
|
||||||
<form id="signup" action="{% url 'users:signup' %}" method="post">
|
<form id="signup" action="{% url 'users:signup' %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<!-- TODO captcha of some kind -->
|
|
||||||
<table id="signup">
|
<table id="signup">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
|
|
Loading…
Reference in New Issue