Commit 44c74d10 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Adding of help texts on several webapp fields



I added the argument `help_text` directly in the form class in order to
use it in the template.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 8f01d79f
......@@ -2,6 +2,8 @@ from allauth.account.forms import SignupForm
from django import forms
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from django.utils.safestring import mark_safe
from taggit.forms import TagField
import config
......@@ -162,7 +164,7 @@ class WebappForm(forms.ModelForm):
# Basic
name = forms.CharField(label="Application name", label_suffix="")
contact = forms.EmailField(label="Email contact", label_suffix="", required=False)
contact = forms.EmailField(label="Email contact", label_suffix="", required=False, help_text="Enter a valid email only if someone else will be the user's contact.")
description = forms.CharField(widget=forms.Textarea, label="Description", label_suffix="")
private = forms.TypedChoiceField(
coerce=lambda x: x == 'True',
......@@ -170,6 +172,7 @@ class WebappForm(forms.ModelForm):
initial=True,
label="Private mode",
label_suffix='',
help_text='Select the "private" option if you want to restrict the visibility to yourself.',
widget=forms.RadioSelect)
# Advanced
......@@ -183,8 +186,10 @@ class WebappForm(forms.ModelForm):
job_queue = forms.ModelChoiceField(
queryset=JobQueue.objects.all().distinct().order_by("timeout"),
label='Default job queue',
help_text=mark_safe('You can refer to the <a href="https://allgo.gitlabpages.inria.fr/doc/deploy.html#queue-type">queue type documentation</a> for further explanation.'),
label_suffix='')
entrypoint = forms.CharField(label="Entrypoint", label_suffix="",
help_text=mark_safe('You can refer to the <a href="https://allgo.gitlabpages.inria.fr/doc/entrypoint.html">entry point documentation</a> for further explanation.'),
initial="/home/allgo/entrypoint")
def __init__(self, *args, **kwargs):
......
......@@ -41,7 +41,8 @@
<div class="col">
<div class="form-group">
{{ form.contact.label_tag }}
{{ form.contact | attr:"placeholder:If different from you" | add_class:"form-control" }}
{{ form.contact | attr:"placeholder:john.smith@example.net" | add_class:"form-control" }}
<small class="form-text text-muted">{{ form.contact.help_text }}</small>
</div>
</div>
</div>
......@@ -49,18 +50,25 @@
<div class="form-group">
{{ form.description.label_tag }}
{{ form.description | attr:"placeholder:Consider it as the app README file" | add_class:"form-control" }}
<small id="descriptionHelp" class="form-text text-muted"><a href="https://daringfireball.net/projects/markdown/syntax" title="Markdown syntax">Mardown syntax</a> is used for formatting.</small>
<small class="form-text text-muted"><a href="https://daringfireball.net/projects/markdown/syntax" title="Markdown syntax">Mardown syntax</a> is used for formatting.</small>
</div>
<div class="form-group">
{{ form.private.label_tag }}
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for private_field in form.private %}
<label class="btn btn-secondary active">
<input type="{{ private_field.data.type }}" id="{{ private_field.id_for_label }}" value="{{ private_field.data.value }}" name="{{ private_field.data.name }}" {% if private_field.data.selected %}checked{% endif %}>{{ private_field.choice_label }}
</label>
<label class="btn btn-secondary">
<input
type="{{ private_field.data.type }}"
id="{{ private_field.id_for_label }}"
value="{{ private_field.data.value }}"
name="{{ private_field.data.name }}"
{% if private_field.data.selected %}checked{% endif %}>
{{ private_field.choice_label }}
</label>
{% endfor %}
</div>
<small class="form-text text-muted">{{ form.private.help_text }}</small>
</div>
</div>
......@@ -100,6 +108,7 @@
>{{ choice | fancy_job_queue }}</option>
{% endfor %}
</select>
<small class="form-text text-muted">{{ form.job_queue.help_text }}</small>
</div>
<div class="form-group col-md-6">
......@@ -107,6 +116,7 @@
<div class="input-group">
{{ form.entrypoint | add_class:"form-control" }}
</div>
<small class="form-text text-muted">{{ form.entrypoint.help_text }}</small>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment