Add advanced settings area

This commit is contained in:
R. Miles McCain 2020-04-24 14:06:59 -04:00
parent 39ef4c9645
commit e693406114
No known key found for this signature in database
GPG Key ID: 24F9B6A2588C5408
4 changed files with 15 additions and 4 deletions

View File

@ -8,7 +8,7 @@ from allauth.account.admin import EmailAddress
class ServiceForm(forms.ModelForm): class ServiceForm(forms.ModelForm):
class Meta: class Meta:
model = Service model = Service
fields = ["name", "link", "respect_dnt", "collaborators"] fields = ["name", "link", "respect_dnt", "origins", "collaborators"]
widgets = { widgets = {
"name": forms.TextInput(), "name": forms.TextInput(),
"origins": forms.TextInput(), "origins": forms.TextInput(),
@ -29,7 +29,6 @@ class ServiceForm(forms.ModelForm):
collaborators = forms.CharField(help_text="Which users should have read-only access to this service? (Comma separated list of emails.)", required=False) collaborators = forms.CharField(help_text="Which users should have read-only access to this service? (Comma separated list of emails.)", required=False)
def clean_collaborators(self): def clean_collaborators(self):
collaborators = [] collaborators = []
for collaborator_email in self.cleaned_data["collaborators"].split(","): for collaborator_email in self.cleaned_data["collaborators"].split(","):

View File

@ -0,0 +1,12 @@
{% load a17t_tags %}
{{form.name|a17t}}
{{form.link|a17t}}
{{form.collaborators|a17t}}
<details class="p-4 border rounded">
<summary class="cursor-pointer text-sm">Advanced settings</summary>
<hr class="sep h-4">
{{form.respect_dnt|a17t}}
{{form.origins|a17t}}
</details>

View File

@ -10,7 +10,7 @@
<form class="card ~neutral !low p-0 max-w-xl" method="POST"> <form class="card ~neutral !low p-0 max-w-xl" method="POST">
{% csrf_token %} {% csrf_token %}
<div class="p-4"> <div class="p-4">
{{form|a17t}} {% include 'dashboard/includes/service_form.html' %}
</div> </div>
<div class="section ~urge !normal p-4"> <div class="section ~urge !normal p-4">
<button type="submit" class="button ~urge !high">Create</button> <button type="submit" class="button ~urge !high">Create</button>

View File

@ -23,7 +23,7 @@
<form class="card ~neutral !low p-0" method="POST"> <form class="card ~neutral !low p-0" method="POST">
{% csrf_token %} {% csrf_token %}
<div class="p-4"> <div class="p-4">
{{form|a17t}} {% include 'dashboard/includes/service_form.html' %}
</div> </div>
<div class="section ~neutral !normal p-4 flex justify-between"> <div class="section ~neutral !normal p-4 flex justify-between">
<div> <div>