Added Student create/edit/apply template for use with the new Student Model.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Tue, 15 Sep 2009 21:05:23 +0200
changeset 2924 6a096316f5c2
parent 2923 2d0b36ef4330
child 2925 d1de20978875
Added Student create/edit/apply template for use with the new Student Model. Reviewed by: to-be-reviewed
app/soc/templates/soc/student/edit.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/student/edit.html	Tue Sep 15 21:05:23 2009 +0200
@@ -0,0 +1,59 @@
+{% extends "soc/role/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.
+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 %}
+{% block scripts %}
+{{ block.super }}
+<script type="text/javascript">
+  $(document).ready( function() {
+    function swap_fields(school_type) {
+      if (school_type == "University") { 
+    	  $("tr:contains('Grade cannot be left blank')").hide();
+        $("label[for=id_grade]").hide();
+        $("#id_grade").hide();
+        $("tr:contains('Major cannot be left blank'):parent").show();
+        $("tr:contains('Degree must be selected from the given options')").show();
+        $("label[for=id_major]").show();
+        $("#id_major").show();
+        $("label[for=id_degree]").show();
+        $("#id_degree").show();
+	    } else if (school_type == "High School") {
+	    	$("tr:contains('Grade cannot be left blank')").show();
+	      $("label[for=id_grade]").show();
+        $("#id_grade").show();
+        $("tr:contains('Major cannot be left blank')").hide();
+        $("tr:contains('Degree must be selected from the given options')").hide();
+        $("label[for=id_major]").hide();
+        $("#id_major").hide();
+        $("label[for=id_degree]").hide();
+        $("#id_degree").hide();
+	    }
+	    else { 
+	    	$("td.formfielderror:contains('Grade cannot be left blank')").hide();
+	      $("label[for=id_major]").hide();
+	      $("#id_major").hide();
+	      $("td.formfielderror:contains('Major cannot be left blank')").hide();
+	      $("td.formfielderror:contains('Degree must be selected from the given options')").hide();
+  	    $("label[for=id_degree]").hide();
+	      $("#id_degree").hide();
+	      $("label[for=id_grade]").hide();
+	      $("#id_grade").hide();
+	    }
+    }
+    swap_fields($("#id_school_type").val());
+    $("#id_school_type").change(function() {
+      swap_fields($(this).val());
+    });
+  });
+</script>
+{% endblock %}