better relocate interface (tree of folders, rather than a wrong-sorted SELECT)
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 26 Mar 2009 01:01:24 +0000 (01:01 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 26 Mar 2009 01:01:24 +0000 (01:01 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@225 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/static/main.css
conifer/syrup/views.py
conifer/templates/components/course.xhtml
conifer/templates/item_relocate.xhtml

index 9b7204f..c1b0038 100644 (file)
@@ -41,6 +41,8 @@ min-height: 300;
 #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 @@ p.todo, div.todo { background-color: #fdd; padding: 6; margin: 12; border-left:
 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
index ac3162f..03b2cff 100644 (file)
@@ -1160,7 +1160,7 @@ def item_relocate(request, course_id, item_id):
     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:
index f71a2c5..353a486 100644 (file)
@@ -46,6 +46,18 @@ searchtext = _('search this course...')
       ${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"
index 49301ce..4cfc64f 100644 (file)
@@ -19,14 +19,13 @@ title = 'Move item under a different heading'
       <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>