[open-ils-commits] r763 - in servres/trunk/conifer: static templates (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jan 21 22:21:00 EST 2010


Author: gfawcett
Date: 2010-01-21 22:20:58 -0500 (Thu, 21 Jan 2010)
New Revision: 763

Modified:
   servres/trunk/conifer/static/edit_course.js
   servres/trunk/conifer/templates/edit_course.xhtml
   servres/trunk/conifer/templates/master.xhtml
Log:
fixed title-lookup during edit-course

The buggy version had a bad hard-coded prefix in the lookup-title
URL. I've added a ROOT variable in JavaScript, set to the URL prefix
(the SCRIPT_NAME) of the Syrup instance; and now we use this to
correctly find the lookup-title service.

Modified: servres/trunk/conifer/static/edit_course.js
===================================================================
--- servres/trunk/conifer/static/edit_course.js	2010-01-22 02:48:02 UTC (rev 762)
+++ servres/trunk/conifer/static/edit_course.js	2010-01-22 03:20:58 UTC (rev 763)
@@ -1,12 +1,9 @@
-/*
-this seems to be causing a disable when we don't want it
-*/
 function do_init() {
-    if ($('#id_code')[0].tagName == 'SELECT') {
+    if ($('#id_code').attr('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()},
+	    $.getJSON(ROOT + '/course/new/ajax_title', {course_code: $(this).val()},
 		      function(resp) {
 			  $('#id_title').val(resp.title)
 			  $('#id_title')[0].disabled=false;

Modified: servres/trunk/conifer/templates/edit_course.xhtml
===================================================================
--- servres/trunk/conifer/templates/edit_course.xhtml	2010-01-22 02:48:02 UTC (rev 762)
+++ servres/trunk/conifer/templates/edit_course.xhtml	2010-01-22 03:20:58 UTC (rev 763)
@@ -11,13 +11,7 @@
 <xi:include href="components/course.xhtml"/>
 <head>
   <title>${title}</title>
-  <!--
-  Disabling this title lookup for now, something goes amiss in the browser interaction
-  and the title field is disabled when it shouldn't be - art
-  -->
-  <!--
   <script type="text/javascript" src="${ROOT}/static/edit_course.js"/>
-  -->
 </head>
 <body>
   <div py:if="instance.id">${course_banner(instance)}</div>

Modified: servres/trunk/conifer/templates/master.xhtml
===================================================================
--- servres/trunk/conifer/templates/master.xhtml	2010-01-22 02:48:02 UTC (rev 762)
+++ servres/trunk/conifer/templates/master.xhtml	2010-01-22 03:20:58 UTC (rev 763)
@@ -12,6 +12,10 @@
 	  py:with="t=list(select('title/text()'))">
       <title>${app_name}<py:if test="t">: ${t}</py:if></title>
     <link rel="stylesheet" type="text/css" href="${ROOT}/static/main.css"/>
+    <!-- !We set the webapp ROOT (script name) here, for use in static javascript libraries. -->
+    <script type="text/javascript">
+      var ROOT = '${ROOT}';
+    </script>
     <!--
     using the trunk version of jquery to get around some IE 8 problems
     -->



More information about the open-ils-commits mailing list