summaryrefslogtreecommitdiff
path: root/chimere/templates/chimere/edit.html
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/templates/chimere/edit.html')
-rw-r--r--chimere/templates/chimere/edit.html31
1 files changed, 28 insertions, 3 deletions
diff --git a/chimere/templates/chimere/edit.html b/chimere/templates/chimere/edit.html
index bdd8b99..447de71 100644
--- a/chimere/templates/chimere/edit.html
+++ b/chimere/templates/chimere/edit.html
@@ -69,10 +69,9 @@
<div class='bottomform'>
{% for field in form %}
{% for property in properties %}
- {% ifequal field.name property %}
+ {% ifequal field.name property.getNamedId %}
<div class="fieldWrapper">
- <label for="id_{{field.name}}">{% trans field.label %}</label>
- {{ field.errors }}
+ <label for="id_{{field.name}}">{% trans field.label %}{% if property.mandatory %} *{% endif %}</label>
{% if field.errors %}<div class='errors'>{{ field.errors }}</div>{% endif %}
{{ field }}
</div>
@@ -83,6 +82,32 @@
{% inline_formset "Multimedia files" formset_multi %}
{% inline_formset "Picture files" formset_picture %}
+ {% if filtered_properties %}
+ <script type='text/javascript'>
+ var cat_filters = new Array();
+ var cat_to_hide = new Array();
+ {% for property in filtered_properties %}
+ cat_to_hide.push('#id_{{property.getNamedId}}');
+ {% for subcat in property.subcategories.all %}
+ if(!cat_filters['{{subcat.id}}']) cat_filters['{{subcat.id}}'] = new Array();
+ cat_filters['{{subcat.id}}'].push('#id_{{property.getNamedId}}');
+ {% endfor %}
+ {% endfor %}
+ $('#id_categories').change(function(){
+ for (idx in cat_to_hide){
+ $(cat_to_hide[idx]).parent().hide();
+ }
+ var vals = $(this).val();
+ for (val_id in vals){
+ var val = vals[val_id];
+ for (ids in cat_filters[val]){
+ $(cat_filters[val][ids]).parent().show();
+ }
+ }
+ });
+ $('#id_categories').change();
+ </script>
+ {% endif %}
</div>
<div class='personalform'>
<h3>{% trans "Personal information"%}</h3>