renamed add_new_course* files to edit_course*
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 8 Mar 2009 20:06:26 +0000 (20:06 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 8 Mar 2009 20:06:26 +0000 (20:06 +0000)
they were really add/edit forms after all.

git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@153 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/static/add_new_course.js [deleted file]
conifer/static/edit_course.js [new file with mode: 0644]
conifer/syrup/views.py
conifer/templates/add_new_course.xhtml [deleted file]
conifer/templates/edit_course.xhtml [new file with mode: 0644]

diff --git a/conifer/static/add_new_course.js b/conifer/static/add_new_course.js
deleted file mode 100644 (file)
index 40ffd99..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-function do_init() {
-    if ($('#id_code')[0].tagName == 'SELECT') {
-       // code is a SELECT, so we add a callback to lookup titles.
-       $('#id_code').change(function() {
-           $('#id_title')[0].disabled=true;
-           $.getJSON('/syrup/course/new/ajax_title', {course_code: $(this).val()},
-                     function(resp) {
-                         $('#id_title').val(resp.title)
-                         $('#id_title')[0].disabled=false;
-
-                     });
-       });
-    }
-}
-
-$(do_init);
diff --git a/conifer/static/edit_course.js b/conifer/static/edit_course.js
new file mode 100644 (file)
index 0000000..40ffd99
--- /dev/null
@@ -0,0 +1,16 @@
+function do_init() {
+    if ($('#id_code')[0].tagName == 'SELECT') {
+       // code is a SELECT, so we add a callback to lookup titles.
+       $('#id_code').change(function() {
+           $('#id_title')[0].disabled=true;
+           $.getJSON('/syrup/course/new/ajax_title', {course_code: $(this).val()},
+                     function(resp) {
+                         $('#id_title').val(resp.title)
+                         $('#id_title')[0].disabled=false;
+
+                     });
+       });
+    }
+}
+
+$(do_init);
index 1223e14..c59ac15 100644 (file)
@@ -195,11 +195,11 @@ def add_or_edit_course(request, instance=None):
     example = models.course_codes.course_code_example
     if request.method != 'POST':
         form = NewCourseForm(instance=instance)
-        return g.render('add_new_course.xhtml', **locals())
+        return g.render('edit_course.xhtml', **locals())
     else:
         form = NewCourseForm(request.POST, instance=instance)
         if not form.is_valid():
-            return g.render('add_new_course.xhtml', **locals())
+            return g.render('edit_course.xhtml', **locals())
         else:
             form.save()
             course = form.instance
diff --git a/conifer/templates/add_new_course.xhtml b/conifer/templates/add_new_course.xhtml
deleted file mode 100644 (file)
index fd11b23..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?python
-if instance.id:
-    title = _('Edit course details')
-else:
-    title = _('Add a new course site')
-?>
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xi="http://www.w3.org/2001/XInclude"
-      xmlns:py="http://genshi.edgewall.org/">
-<xi:include href="master.xhtml"/>
-<xi:include href="components/course.xhtml"/>
-<head>
-  <title>${title}</title>
-  <script type="text/javascript" src="/static/add_new_course.js"/>
-</head>
-<body>
-  <div py:if="instance.id">${course_banner(instance)}</div>
-  <h1>${title}</h1>
-  <p py:if="instance.id"><a href="permission/">Edit course permissions</a> &bull; <a href="${instance.course_url()}">Return to course page</a></p>
-  <form action="." method="POST">
-    <tr py:def="field_row(field, example=None)">
-      <th>${field.label}</th>
-      <td>
-       <ul py:if="field.errors" class="errorlist">
-         <li py:for="err in field.errors">${err}</li>
-       </ul>
-       ${Markup(field)}
-      </td>
-      <td class="example" py:if="example">e.g., ${example}</td>
-    </tr>
-    <h2>General description</h2>
-    <table class="formtable">
-    ${field_row(form.code, example)}
-    ${field_row(form.title)}
-    ${field_row(form.term)}
-    ${field_row(form.department)}
-    <!-- <tr><th>Department</th><td>${Markup(form.department)} ${errorlist(form.department)}</td></tr> -->
-  </table>
-  <p><input type="submit" value="Continue"/></p>
-  </form>
-  <div class="gap"/>
-  <div py:if="instance.id">
-    <h2>Delete this course</h2>
-    <form action="delete/" method="POST">
-      <p><input type="checkbox" name="confirm_delete" id="confirm_delete"/>
-      <label for="confirm_delete">Yes, I want to delete this course site and all of its contents.</label>
-      </p>
-      <p><input type="submit" value="Delete this course"/></p>
-    </form>
-  </div>
-</body>
-</html>
diff --git a/conifer/templates/edit_course.xhtml b/conifer/templates/edit_course.xhtml
new file mode 100644 (file)
index 0000000..1e8a308
--- /dev/null
@@ -0,0 +1,52 @@
+<?python
+if instance.id:
+    title = _('Edit course details')
+else:
+    title = _('Add a new course site')
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="master.xhtml"/>
+<xi:include href="components/course.xhtml"/>
+<head>
+  <title>${title}</title>
+  <script type="text/javascript" src="/static/edit_course.js"/>
+</head>
+<body>
+  <div py:if="instance.id">${course_banner(instance)}</div>
+  <h1>${title}</h1>
+  <p py:if="instance.id"><a href="permission/">Edit course permissions</a> &bull; <a href="${instance.course_url()}">Return to course page</a></p>
+  <form action="." method="POST">
+    <tr py:def="field_row(field, example=None)">
+      <th>${field.label}</th>
+      <td>
+       <ul py:if="field.errors" class="errorlist">
+         <li py:for="err in field.errors">${err}</li>
+       </ul>
+       ${Markup(field)}
+      </td>
+      <td class="example" py:if="example">e.g., ${example}</td>
+    </tr>
+    <h2>General description</h2>
+    <table class="formtable">
+    ${field_row(form.code, example)}
+    ${field_row(form.title)}
+    ${field_row(form.term)}
+    ${field_row(form.department)}
+    <!-- <tr><th>Department</th><td>${Markup(form.department)} ${errorlist(form.department)}</td></tr> -->
+  </table>
+  <p><input type="submit" value="Continue"/></p>
+  </form>
+  <div class="gap"/>
+  <div py:if="instance.id">
+    <h2>Delete this course</h2>
+    <form action="delete/" method="POST">
+      <p><input type="checkbox" name="confirm_delete" id="confirm_delete"/>
+      <label for="confirm_delete">Yes, I want to delete this course site and all of its contents.</label>
+      </p>
+      <p><input type="submit" value="Delete this course"/></p>
+    </form>
+  </div>
+</body>
+</html>