collapsible inlines
This commit is contained in:
parent
dfd2427460
commit
a880b14173
|
@ -21,6 +21,10 @@
|
||||||
.delete-row {
|
.delete-row {
|
||||||
display:none !important;
|
display:none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inlineHidden {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- uni-form JS library, optional -->
|
<!-- uni-form JS library, optional -->
|
||||||
<script src="/static/uni_form/uni-form.jquery.js" type="text/javascript"></script>
|
<script src="/static/uni_form/uni-form.jquery.js" type="text/javascript"></script>
|
||||||
|
@ -177,13 +181,17 @@ $(function(){
|
||||||
{% crispy form form.helper %}
|
{% crispy form form.helper %}
|
||||||
|
|
||||||
{% for inline in inlines %}
|
{% for inline in inlines %}
|
||||||
|
<div class="inlineWrapper">
|
||||||
<h3> {{inline.title }} </h3>
|
<h3> {{inline.title }} </h3>
|
||||||
{% if inline.help_text %}
|
<div class="inlineHidden">
|
||||||
<div class="formset_help_text"> {{ inline.help_text }}</div>
|
{% if inline.help_text %}
|
||||||
{% endif %}
|
<div class="formset_help_text"> {{ inline.help_text }}</div>
|
||||||
<div class="itf_formset" id="formset_{{inline.prefix}}">
|
{% endif %}
|
||||||
{% crispy inline inline.form.helper %}
|
<div class="itf_formset" id="formset_{{inline.prefix}}">
|
||||||
|
{% crispy inline inline.form.helper %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br />
|
<br />
|
||||||
<input type="submit" value="Submit" />
|
<input type="submit" value="Submit" />
|
||||||
|
@ -193,6 +201,12 @@ $(function(){
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
|
$('.inlineWrapper h3').toggle(function() {
|
||||||
|
$(this).parent().find('.inlineHidden').slideDown();
|
||||||
|
}, function() {
|
||||||
|
$(this).parent().find('.inlineHidden').slideUp();
|
||||||
|
});
|
||||||
|
|
||||||
{% for inline in inlines %}
|
{% for inline in inlines %}
|
||||||
$('#formset_{{inline.prefix}}').formset({
|
$('#formset_{{inline.prefix}}').formset({
|
||||||
prefix: '{{ inline.prefix }}',
|
prefix: '{{ inline.prefix }}',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user