#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;
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
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:
${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"
<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>