app/templates/projrev/proposal/submit.html
changeset 23 91cf6872d853
parent 22 0321f984fb16
child 24 7257b66a6766
--- a/app/templates/projrev/proposal/submit.html	Sun Aug 09 22:52:45 2009 +0530
+++ b/app/templates/projrev/proposal/submit.html	Sun Aug 09 23:24:48 2009 +0530
@@ -3,10 +3,15 @@
 {{ block.super }}
 <script language="JavaScript" type="text/javascript" src="/site-content/js/jquery.chainedSelects.js"></script>
 <script language="JavaScript" type="text/javascript">
-$(function()
-{
-  $('#id_state').chainSelect('#id_district','/proposal/submit/get_dfors');
-});
+  $(function()
+  {
+    $('#id_state').chainSelect('#id_district','/proposal/submit/get_dfors');
+  });
+  $(document).ready(function() {
+	  $.get('/proposal/submit/get_dfors', function() {
+      $('#id_district').html('<option value="">---------</option>');
+	  });
+  });
 </script>
 {% endblock scripts %}
 {% block content %}
@@ -27,8 +32,57 @@
 		<p>
     {% for field in form %}
       <p>
+      {% if field.help_text %}
+        <script type="text/javascript">
+          $(document).ready( function() {
+            var tooltip = [
+            "<div class='tooltip'>",
+            "  <div class='tooltip-body'>",
+            "    <img src='/site-content/images/purrInfo.png' alt='' />",
+            "    <h3>Info</h3>",
+            "    <p>",
+            "      {% autoescape off %}",
+            "        {{ help_text|linebreaksbr|escapejs }}",
+            "      {% endautoescape %}",
+            "    </p>",
+            "  </div>",
+            "  <div class='tooltip-bottom'></div>",
+            "</div>"
+          ].join("");
+          var tooltip_object=null;
+          var documented = $("#{{ field_id }}");
+          var not_fieldset = documented.attr('tagName') !== 'FIELDSET';
+          if (not_fieldset) {
+            documented.focus(function() {
+              if (tooltip_object==null) {
+                tooltip_object = $(tooltip).purr({usingTransparentPNG: true,removeTimer: 10000});
+              }
+            });
+            documented.blur(function() {
+              if (tooltip_object!==null) {
+                tooltip_object.remove();
+                tooltip_object=null;
+              }
+            });
+          }
+          else {
+            documented.find("input").hover(function() {
+              if (tooltip_object==null) {
+                tooltip_object = $(tooltip).purr({usingTransparentPNG: true,removeTimer: 10000});
+              }
+            },
+            function() {
+              if (tooltip_object!==null) {
+                tooltip_object.remove();
+                tooltip_object=null;
+              }
+            });
+          }
+        });
+        </script>
+      {% endif %}
       {{ field.errors }}
-      {{ field.label_tag }}{% if field.field.required %}<span class="special_class">(*)</span>{% endif %}:{{ field }}
+      {{ field.label_tag }}:{{ field }}{% if field.field.required %}<span class="special_class">&nbsp;&nbsp;(required)</span>{% endif %}
       </p>
     {% endfor %}