Refactor various django templates to reuse other templates where possible
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 15 Feb 2009 20:27:56 +0000
changeset 1359 582661519e5d
parent 1358 6be502a1bcc6
child 1360 f62c462037b6
Refactor various django templates to reuse other templates where possible Patch by: Sverre Rabbelier
app/soc/templates/soc/base.html
app/soc/templates/soc/models/edit.html
app/soc/templates/soc/org_app/review_overview.html
app/soc/templates/soc/request/create.html
app/soc/templates/soc/role/edit.html
app/soc/templates/soc/timeline/edit.html
--- a/app/soc/templates/soc/base.html	Sun Feb 15 20:27:09 2009 +0000
+++ b/app/soc/templates/soc/base.html	Sun Feb 15 20:27:56 2009 +0000
@@ -92,7 +92,7 @@
 	{% endif %}
 	{% if is_debug %}
 	<form id="flush_form" action="/_ah/admin/memcache" method="post" style="display: inline;">
-      <input type="submit" class="button" name="action:flush" value="Flush Cache" onclick="return confirm('Are you sure you want to flush all keys from the cache?');"/>
+      <input type="submit" class="button" name="action:flush" value="Flush Cache"/>
     </form> | 
 	<a class="novisit" target="_blank" href="/_ah/admin">Admin</a> | 
 	{% endif %}
--- a/app/soc/templates/soc/models/edit.html	Sun Feb 15 20:27:09 2009 +0000
+++ b/app/soc/templates/soc/models/edit.html	Sun Feb 15 20:27:56 2009 +0000
@@ -29,6 +29,11 @@
 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 %}
@@ -41,9 +46,11 @@
   </tr>
   <tr>
     {% block submit_buttons %}
+    {% block save_button %}
    <td> 
     <input style="font-weight: bold" type="submit" value="Save Changes"/></span>
    </td>
+   {% endblock %}
    <td>
    {% if edit_cancel_redirect %}
    <input type="button" onclick="location.href='{{ edit_cancel_redirect }}'" value="Cancel"/>
--- a/app/soc/templates/soc/org_app/review_overview.html	Sun Feb 15 20:27:09 2009 +0000
+++ b/app/soc/templates/soc/org_app/review_overview.html	Sun Feb 15 20:27:56 2009 +0000
@@ -14,7 +14,13 @@
 {% endcomment %}
 
 {% block body %}
-<span id="acceptance_text">If you want to accept all pre-accepted organizations please <button id="button_accept" onclick="javascript:acceptOrgInit();">click here</button></span><span class="progressBar" style="display:none;" id="applications_progress_bar"></span><span id="description_progressbar"></span><span id="description_done"></span>
+<span id="acceptance_text">
+  If you want to accept all pre-accepted organizations please 
+  <button id="button_accept" onclick="javascript:acceptOrgInit();">click here</button>
+</span>
+<span class="progressBar" style="display:none;" id="applications_progress_bar"></span>
+<span id="description_progressbar"></span><span id="description_done"></span>
+
 {{ block.super}}
 
 {% endblock %}
--- a/app/soc/templates/soc/request/create.html	Sun Feb 15 20:27:09 2009 +0000
+++ b/app/soc/templates/soc/request/create.html	Sun Feb 15 20:27:56 2009 +0000
@@ -1,4 +1,4 @@
-{% extends "soc/base.html" %}
+{% extends "soc/models/edit.html" %}
 {% comment %}
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -12,44 +12,13 @@
 See the License for the specific language governing permissions and
 limitations under the License.
 {% endcomment %}
-{% load forms_helpers %}
 
-{% block header_title %}
-{{ page_name }}
+{% block instructions %}
+{{ instruction_message }}
 {% endblock %}
 
-{% block body %}
-<p>
-<p>
-{% block instructions %}
-{{instruction_message}}
-{% endblock %}
-{% if error_message %}
- <div class="error">
- {{error_message|safe}}
- </div>
-{% endif %}
-</p>
-<form method="POST">
-  <table>
-    {% block form_table %}
-      {% as_table form %}
-    {% endblock form_table %}
-  </table>
-  <table>
-  <tr>
-   <td colspan="4">&nbsp;</td>
-  </tr>
-  <tr>
-    {% block submit_buttons %}
+{% block save_button %}
    <td> 
     <input style="font-weight: bold" type="submit" value="Submit"/></span>
    </td>
-   <td>
-   <input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)">
-   </td>
- </table>
-</form>
-</p>
-{% endblock submit_buttons %}
-{% endblock body %}
+{% endblock %}
--- a/app/soc/templates/soc/role/edit.html	Sun Feb 15 20:27:09 2009 +0000
+++ b/app/soc/templates/soc/role/edit.html	Sun Feb 15 20:27:56 2009 +0000
@@ -1,4 +1,4 @@
-{% extends "soc/base.html" %}
+{% extends "soc/models/edit.html" %}
 {% comment %}
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -21,16 +21,7 @@
 	<script type="text/javascript" src="/soc/content/js/map-090201.js"></script>
 {% endif %}
 {% endblock %}
-{% block header_title %}
-{{ page_name }}
- {% if entity %}
-   <!-- TODO(srabbelier) use a generic entity name as link -->
-   <a href="/{{ entity_type_url|lower }}/show/{{ entity_suffix }}"
->{% if entity.name %}{{ entity.name }} {% endif %}(public view)</a>
- {% endif %}
-{% endblock %}
 
-{% block body %}
 {% block body_tag %}
   {% if gmaps_api_key %}
     <body onLoad="role_profile_gmap.map_load()" onunload="GUnload()">
@@ -38,20 +29,16 @@
     {{ block.super }}
   {% endif %}
 {% endblock %}
-<p>
-<p>
+
 {% block instructions %}
-Please use this form to edit the {{ entity_type }}.
+{{ block.super }}
 {% if not gmaps_api_key %}
 <br /><span class="error">Google Maps API key not present. Please login as administrator and insert your key in Site Settings, Google Maps field.</span>
 {% endif %}
 {% endblock %}
-</p>
-<form method="POST">
-  <table>
-    {% block form_table %}
-      {% as_table form %}
-    {% endblock %}
+
+{% block form_table %}
+{{ block.super }}
     {% if gmaps_api_key %}
     <tr title="your location">
       <td class="formfieldlabel">
@@ -65,27 +52,4 @@
       <td></td>
     </tr>
     {% endif %}
-  </table>
-  <table>
-  <tr>
-   <td colspan="4">&nbsp;</td>
-  </tr>
-  <tr>
-    {% block submit_buttons %}
-   <td> 
-    <input style="font-weight: bold" type="submit" value="Save Changes"/></span>
-   </td>
-   <td>
-    <input type="button" onclick="location.href='/'" value="Cancel"/>
-   </td>
-   {% if entity %}
-   <td>
-    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/delete/{{ entity_suffix }}'" value="Delete"/>
-   </td>
-   {% endif %}
-   {% endblock %}
-  </tr>
- </table>
-</form>
-</p>
 {% endblock %}
--- a/app/soc/templates/soc/timeline/edit.html	Sun Feb 15 20:27:09 2009 +0000
+++ b/app/soc/templates/soc/timeline/edit.html	Sun Feb 15 20:27:56 2009 +0000
@@ -16,11 +16,5 @@
 {% block instructions %}
 {{ block.super }} Note that all times are in UTC.
 {% endblock %}
-{% block submit_buttons %}
-<td> 
- <input style="font-weight: bold" type="submit" value="Save Changes"/></span>
-</td>
-<td>
- <input type="button" onclick="location.href='/'" value="Cancel"/>
-</td>
-{% endblock %}
\ No newline at end of file
+
+{% block delete_button %}{% endblock %}