forked from DGNum/gestioCOF
Ajout snippets pour forms des templates
This commit is contained in:
parent
04932dd22a
commit
9e7b6cccf5
|
@ -202,7 +202,7 @@ textarea {
|
||||||
padding:15px;
|
padding:15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-only #id_trigramme {
|
.form-only .account_create #id_trigramme {
|
||||||
display:block;
|
display:block;
|
||||||
width:200px;
|
width:200px;
|
||||||
height:80px;
|
height:80px;
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.create' %}">Créer un compte</a>
|
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.create' %}">Créer un compte</a>
|
||||||
|
{% if perms.kfet.manage_perms %}
|
||||||
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group' %}">Permissions</a>
|
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.group' %}">Permissions</a>
|
||||||
|
{% endif %}
|
||||||
{% if perms.kfet.view_negs %}
|
{% if perms.kfet.view_negs %}
|
||||||
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.negative' %}">Négatifs</a>
|
<a class="btn btn-primary btn-lg" href="{% url 'kfet.account.negative' %}">Négatifs</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -32,12 +32,7 @@
|
||||||
{% include 'kfet/account_create_form.html' %}
|
{% include 'kfet/account_create_form.html' %}
|
||||||
</div>
|
</div>
|
||||||
{% if not perms.kfet.add_account %}
|
{% if not perms.kfet.add_account %}
|
||||||
<div class="form-group">
|
{% include 'kfet/form_authentication_snippet.html' %}
|
||||||
<label for="password" class="col-sm-2 control-label">Authentification</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="password" name="KFETPASSWORD" id="password" class="form-control">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,39 +1,9 @@
|
||||||
{% load widget_tweaks %}
|
{% load widget_tweaks %}
|
||||||
|
|
||||||
{% for field in user_form %}
|
{% include 'kfet/form_snippet.html' with form=user_form %}
|
||||||
<div class="form-group">
|
{% include 'kfet/form_snippet.html' with form=cof_form %}
|
||||||
<label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
|
{% include 'kfet/form_snippet.html' with form=account_form %}
|
||||||
<div class="col-sm-10">
|
|
||||||
{{ field|add_class:'form-control' }}
|
|
||||||
<span class="help-block">{{ field.errors }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for field in cof_form %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
{{ field|add_class:'form-control' }}
|
|
||||||
<span class="help-block">{{ field.errors }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for field in account_form %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
{{ field|add_class:'form-control' }}
|
|
||||||
<span class="help-block">{{ field.errors }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% if user_form %}
|
{% if user_form %}
|
||||||
<div class="form-group">
|
{% include 'kfet/form_submit_snippet.html' with value="Enregistrer" %}
|
||||||
<div class="col-sm-6 col-sm-offset-3 text-center">
|
|
||||||
<input type="submit" value="Enregistrer" class="btn btn-primary btn-lg">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{% extends "kfet/base.html" %}
|
{% extends "kfet/base.html" %}
|
||||||
|
{% load widget_tweaks %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
{{ negative_form.media }}
|
{{ negative_form.media }}
|
||||||
|
@ -22,40 +24,26 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="row">
|
{% include "kfet/base_messages.html" %}
|
||||||
<div class="col-sm-4 col-md-3 col-content-left">
|
|
||||||
<div class="content-left">
|
<div class="row form-only">
|
||||||
{% include 'kfet/left_account.html' %}
|
<div class="col-sm-12 col-md-8 col-md-offset-2">
|
||||||
</div>
|
<div class="content-form">
|
||||||
</div>
|
<form action="{% url 'kfet.account.update' account.trigramme %}" method="post" class="form-horizontal">
|
||||||
<div class="col-sm-8 col-md-9 col-content-right">
|
|
||||||
{% include "kfet/base_messages.html" %}
|
|
||||||
<div class="content-right">
|
|
||||||
<div class="content-right-block">
|
|
||||||
<form action="{% url 'kfet.account.update' account.trigramme %}" method="post">
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ user_form.as_p }}
|
{% include 'kfet/form_snippet.html' with form=user_form %}
|
||||||
{{ cof_form.as_p }}
|
{% include 'kfet/form_snippet.html' with form=cof_form %}
|
||||||
{{ account_form.as_p }}
|
{% include 'kfet/form_snippet.html' with form=account_form %}
|
||||||
{{ group_form.as_p }}
|
{% include 'kfet/form_snippet.html' with form=group_form %}
|
||||||
{{ pwd_form.as_p }}
|
{% include 'kfet/form_snippet.html' with form=pwd_form %}
|
||||||
{{ negative_form.non_field_errors }}
|
{% include 'kfet/form_snippet.html' with form=negative_form %}
|
||||||
{% for field in negative_form %}
|
|
||||||
{{ field.errors }}
|
|
||||||
{{ field.label_tag }}
|
|
||||||
<div style="position:relative">{{ field }}</div>
|
|
||||||
{% if field.help_text %}
|
|
||||||
<p class="help">{{ field.help_text|safe }}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if perms.kfet.is_team %}
|
{% if perms.kfet.is_team %}
|
||||||
<input type="password" name="KFETPASSWORD">
|
{% include 'kfet/form_authentication_snippet.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input type="submit" value="Mettre à jour">
|
{% include 'kfet/form_submit_snippet.html' with value="Mettre à jour" %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
6
kfet/templates/kfet/form_authentication_snippet.html
Normal file
6
kfet/templates/kfet/form_authentication_snippet.html
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password" class="col-sm-2 control-label">Authentification</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="password" name="KFETPASSWORD" id="password" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
9
kfet/templates/kfet/form_field_snippet.html
Normal file
9
kfet/templates/kfet/form_field_snippet.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{% load widget_tweaks %}
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
{{ field|add_class:'form-control' }}
|
||||||
|
<span class="help-block">{{ field.errors }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
3
kfet/templates/kfet/form_snippet.html
Normal file
3
kfet/templates/kfet/form_snippet.html
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{% for field in form %}
|
||||||
|
{% include 'kfet/form_field_snippet.html' with field=field %}
|
||||||
|
{% endfor %}
|
5
kfet/templates/kfet/form_submit_snippet.html
Normal file
5
kfet/templates/kfet/form_submit_snippet.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-6 col-sm-offset-3 text-center">
|
||||||
|
<input type="submit" value="{{ value }}" class="btn btn-primary btn-lg">
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -213,7 +213,8 @@ $(document).ready(function() {
|
||||||
content += '</ul>';
|
content += '</ul>';
|
||||||
}
|
}
|
||||||
if ('negative' in data['errors'])
|
if ('negative' in data['errors'])
|
||||||
content += '<a class="btn btn-primary" href="/k-fet/accounts/'+account_data['trigramme']+'/edit" target="_blank">Autorisation de négatif requise</a>';
|
for (var i=0; i<data['errors']['negative'].length; i++) {
|
||||||
|
content += '<a class="btn btn-primary" href="/k-fet/accounts/'+data['errors']['negative'][i]+'/edit" target="_blank">Autorisation de négatif requise pour '+data['errors']['negative'][i]+'</a>';
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue