{% extends "soc/base.html" %}
{% comment %}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
{% load forms_helpers %}

{% block header_title %}
{{ page_name }}
 {% if entity %}
   <a href="/{{ entity_type_url|lower }}/show/{{ entity.key.id_or_name }}"
>{% if entity.name %}{{ entity.name }} {% endif %}(public view)</a>
 {% endif %}
{% endblock %}

{% block body %}
<p>
<p>
{% block instructions %}
Please use this form to edit the {{ entity_type }}.
{% endblock %}
</p>

{% if error_message %}
  <div class="error">{{ error_message|safe }}</div>
{% endif %}

<form method="POST">
  <table>
    {% block form_table %}
      {% as_table form %}
    {% endblock %}
  </table>
  <table>
  <tr>
   <td colspan="4">&nbsp;</td>
  </tr>
  <tr>
    {% block submit_buttons %}
    {% block save_button %}
    {% if entity %}
   <td> 
    <input style="font-weight: bold" type="submit" value="Save Changes"/></span>
   </td>
    {% else %}
       <td> 
    <input style="font-weight: bold" type="submit" value="Submit"/></span>
   </td>
   {% endif %}
   {% endblock %}
   <td>
     {% if cancel_redirect %}
     <input type="button" 
       {% if entity %}
       onclick="location.href='{{ cancel_redirect }}'" 
       {% else %}
       onClick="javascript: history.go(-1)">
       {% endif %}
     value="Cancel"/>
     {% else %}
     <input type="button" value="Back to Previous Page" onClick="javascript:history.go(-1)">
     {% endif %}
   </td>
   {% if entity %}
   {% block delete_button %}
   <td>

   <input type="button" class="button" value="Delete"
    onclick="if(confirm('Are you sure you want to delete this {{ entity_type }}?')) {
                location.href='/{{ entity_type_url|lower }}/delete/{{ entity_suffix }}';
                }"/>

   </td>
   {% endblock %}
{% if export_link %}
   <td>
    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/export/{{ entity_suffix }}'" value="Export"/>
   </td>
{% endif %}
   {% endif %}
   {% endblock %}
  </tr>
 </table>
</form>
</p>
{% endblock %}
