diff options
Diffstat (limited to 'chimere/templates/chimere/edit.html')
-rw-r--r-- | chimere/templates/chimere/edit.html | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chimere/templates/chimere/edit.html b/chimere/templates/chimere/edit.html index 5170798..e3507a0 100644 --- a/chimere/templates/chimere/edit.html +++ b/chimere/templates/chimere/edit.html @@ -83,6 +83,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 %} <p><input type='submit' onclick='saveExtent();' value="{% trans 'Propose'%}"/></p> </div> </form> |