diff options
Diffstat (limited to 'chimere/templates/chimere/edit.html')
-rw-r--r-- | chimere/templates/chimere/edit.html | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/chimere/templates/chimere/edit.html b/chimere/templates/chimere/edit.html index f9706d3..8322c50 100644 --- a/chimere/templates/chimere/edit.html +++ b/chimere/templates/chimere/edit.html @@ -1,9 +1,9 @@ {% extends "chimere/base.html" %} {% load i18n chimere_tags adminmedia inline_formset%} {% block extra_head %} - {{ form.media }} + {{ extra_head }} {{ block.super }} - {% head_chimere %} + {% head_chimere False %} {% if dated %} <!--script type="text/javascript" src="{{extra_url}}media/js/core.js"></script--> <script type="text/javascript" src="{{ STATIC_URL }}chimere/js/utils.js"></script> @@ -13,17 +13,20 @@ {% endif %} {% endblock %} +{% block body_class %}class='edit'{% endblock %} + {% block content %} {{ block.super }} - {% if submited %}{% submited %}{% endif %} + {% if submited %}{% include "chimere/blocks/submited.html" %}{% endif %} {% if error_message %}<fieldset class='edit errorlist'> <legend>{% trans "Error" %}</legend> <p>{{ error_message }}</p> - {% endif %}</fieldset> - {% if is_modification and is_superuser %}<div class='warning'><p>{% trans "You are logged as an administrator. Your modifications will be taking into account immediately." %}</p></div>{% endif %} + </fieldset>{% endif %} + {% if is_modification and can_write %}<div class='warning'><p>{% trans "You have write rights for this map. Your modifications will be taking into account immediately." %}</p></div>{% endif %} <fieldset class='edit'> <legend>{% if is_modification %}{% trans "Modify a point of interest" %}{% else %}{% trans "Add a point of interest" %}{% endif %}</legend> <form enctype="multipart/form-data" method='post' action='.'> + <p class='submit'><input type='submit' onclick='saveExtent();displayProgress();' value="{% if can_write%}{% trans 'Add/modify'%}{%else%}{% trans 'Propose'%}{%endif%}"/></p> {% csrf_token %} <div class='rightWrapper'> <div class='rightform'> @@ -31,6 +34,7 @@ <label for="id_point">{% trans "Point"%} *</label> {%if form.point.errors %}<ul class="errorlist"><li>{% trans "Select a location for this new site" %}</li></ul>{%endif%} {{point_widget}} + {{nominatim_widget}} </div> </div> </div> @@ -53,13 +57,13 @@ <p class="help">{{ form.description.help_text }}</p> </div> {% if dated %} - <div class="fieldWrapper"> + <div class="fieldWrapper dated_field"> <label for="id_start_date">{% trans "Start date" %}</label> {{ form.start_date.errors }} {{ form.start_date }} <p class="help">{{ form.start_date.help_text }}</p> </div> - <div class="fieldWrapper"> + <div class="fieldWrapper dated_field"> <label for="id_end_date">{% trans "End date" %}</label> {{ form.end_date.errors }} {{ form.end_date }} @@ -94,7 +98,7 @@ cat_filters['{{subcat.id}}'].push('#id_{{property.getNamedId}}'); {% endfor %} {% endfor %} - $('#id_categories').change(function(){ + function checkFilteredProperties(){ for (idx in cat_to_hide){ $(cat_to_hide[idx]).parent().hide(); } @@ -105,11 +109,13 @@ $(cat_filters[val][ids]).parent().show(); } } - }); + } + $('#id_categories').change(checkFilteredProperties); $('#id_categories').change(); </script> {% endif %} </div> + {% if not is_authenticated %} <div class='personalform'> <h3>{% trans "Personal information"%}</h3> <div class='warning'> @@ -130,28 +136,48 @@ {% if form.submiter_comment.errors %}<div class='errors'>{{ form.submiter_comment.errors }}</div>{% endif %} {{ form.submiter_comment }} </div> - </div> + </div>{% endif %} <div id='upload_in_progress'> <p>{% trans "Upload in progress. Please wait..." %}</p> <p><img alt='Ajax loader' src='{{STATIC_URL}}chimere/img/ajax-loader.gif'/></p> </div> <script text='text/javascript'> - $( "#upload_in_progress" ).dialog({ - modal: true, - resizable:false, - height:110, - autoOpen:false, - dialogClass:'alert-box' - } - ); + $( "#upload_in_progress" ).dialog({ + modal: true, + resizable:false, + height:110, + autoOpen:false, + dialogClass:'alert-box' + } + ); $(".ui-dialog-titlebar").hide(); function displayProgress(){ $("#upload_in_progress").dialog('open'); return true; } + {% if dated %} + var dated_cats = new Array(); + {% for cat in sub_categories %}{% for subcat in cat.1 %}{% if subcat.dated %}dated_cats.push('{{subcat.pk}}');{% endif %}{% endfor %}{% endfor %} + function checkDatedFields(){ + {% if filtered_properties %}checkFilteredProperties();{% endif %} + var values = $('#id_categories').val(); + displayed = false; + if (values){ + for (idx=0;idx < values.length;idx++){ + if (dated_cats.indexOf(values[idx]) != -1 ) displayed = true; + } + } + if (displayed){ + $('.dated_field').show(); + } else { + $('.dated_field').hide(); + } + } + $('#id_categories').change(checkDatedFields); + $('#id_categories').change(); + {% endif %} </script> - <p><input type='submit' onclick='saveExtent();displayProgress();' value="{% trans 'Propose'%}"/></p> + <p class='submit'><input type='submit' onclick='saveExtent();displayProgress();' value="{% if can_write%}{% trans 'Add/modify'%}{%else%}{% trans 'Propose'%}{%endif%}"/></p> </form> </fieldset> - </div> {% endblock %} |