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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 25 21:01:26 EDT 2009


Author: gfawcett
Date: 2009-03-25 21:01:24 -0400 (Wed, 25 Mar 2009)
New Revision: 225

Modified:
   servres/trunk/conifer/static/main.css
   servres/trunk/conifer/syrup/views.py
   servres/trunk/conifer/templates/components/course.xhtml
   servres/trunk/conifer/templates/item_relocate.xhtml
Log:
better relocate interface (tree of folders, rather than a wrong-sorted SELECT)

Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2009-03-26 01:01:21 UTC (rev 224)
+++ servres/trunk/conifer/static/main.css	2009-03-26 01:01:24 UTC (rev 225)
@@ -41,6 +41,8 @@
 #header a.loginbutton { background-color: #a44; padding: 8 16; }
 #header a:hover { background-color: #fb7; color: black; text-decoration: none; }
 
+tbody td, tbody th { vertical-align: top; }
+
 #footer {  
     margin: 12;
     padding-bottom: 12;
@@ -243,4 +245,8 @@
 li.sort_item { margin-top: 20px !important;
 	     border: gray 1px dotted; width: 400; }
 
-li.sort_item:hover { background-color: #eee; }
\ No newline at end of file
+li.sort_item:hover { background-color: #eee; }
+
+ul.heading_tree li  { list-style: none; }
+ul.heading_tree { margin: 0; padding-left: 0; }
+ul.heading_tree ul { margin: 0; padding-left: 25; }
\ No newline at end of file

Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-03-26 01:01:21 UTC (rev 224)
+++ servres/trunk/conifer/syrup/views.py	2009-03-26 01:01:24 UTC (rev 225)
@@ -1160,7 +1160,7 @@
     if request.method != 'POST':
         return g.render('item_relocate.xhtml', **locals())
     else:
-        newheading = int(request.POST['newheading'])
+        newheading = int(request.POST['heading'])
         if newheading == 0:
             new_parent = None
         else:

Modified: servres/trunk/conifer/templates/components/course.xhtml
===================================================================
--- servres/trunk/conifer/templates/components/course.xhtml	2009-03-26 01:01:21 UTC (rev 224)
+++ servres/trunk/conifer/templates/components/course.xhtml	2009-03-26 01:01:24 UTC (rev 225)
@@ -46,6 +46,18 @@
       ${show_tree(subs, edit)}
     </li>
   </ul>
+
+  <ul py:def="heading_tree(tree, stop_at=None)" class="heading_tree">
+    <li><input type="radio" name="heading" value="0" id="heading_0"/><label for="heading_0">Top Level</label></li>
+    ${_heading_tree(tree, stop_at)}
+  </ul>
+
+  <ul py:def="_heading_tree(tree, stop_at=None)">
+    <li py:for="item, subs in tree" py:if="item.item_type=='HEADING' and item != stop_at">
+      <input type="radio" name="heading" value="${item.id}" id="heading_${item.id}"/><label for="heading_${item.id}">${item}</label>
+      ${_heading_tree(subs, stop_at)}
+      </li>
+  </ul>
   
   <div py:def="nested_title(item)"
        py:if="item"

Modified: servres/trunk/conifer/templates/item_relocate.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_relocate.xhtml	2009-03-26 01:01:21 UTC (rev 224)
+++ servres/trunk/conifer/templates/item_relocate.xhtml	2009-03-26 01:01:24 UTC (rev 225)
@@ -19,14 +19,13 @@
       <table>
 	<tbody style="text-align: left;">
 	  <tr><th>Item title:</th><td>${item.title}</td></tr>
-	  <tr><th>Current heading:</th><td>${item.parent_heading and item.parent_heading.title or 'Top Level'}</td></tr>
+	  <tr><th>Current heading:
+	  </th><td>${item.parent_heading and item.parent_heading.title or 'Top Level'}
+	  <div class="gap"/></td></tr>
 	  <tr><th>New heading:</th>
 	  <td>
-	    <select name="newheading">
-	      <option value="0">Top Level (no heading)</option>
-	      <option py:for="h in [h for h in course.headings() if not h == item]"
-		      value="${h.id}">${h.title}</option>
-	    </select>
+	    ${heading_tree(course.item_tree(), stop_at=item)}
+	    <div class="gap"/>
 	  </td>
 	  </tr>
 	  <tr>



More information about the open-ils-commits mailing list