[ref] Better rendering of ref menus.

This commit is contained in:
Gaetan Delannay 2014-05-29 13:32:19 +02:00
parent b3a72ade24
commit 2eee217b05
2 changed files with 9 additions and 6 deletions

View file

@ -311,8 +311,10 @@ class Ref(Field):
# PX that displays referred objects as menus. # PX that displays referred objects as menus.
pxViewMenus = Px(''' pxViewMenus = Px('''
<table if="objects"><tr valign="bottom"> <div if="objects"
<td for="menu in field.getLinkedObjectsByMenu(obj, objects)"> for="menu in field.getLinkedObjectsByMenu(obj, objects)"
var2="dtc='display: table-cell'"
style=":not loop.menu.last and ('%s;padding-right:7px') % dtc or dtc">
<!-- A single object in the menu: show a clickable icon to get it --> <!-- A single object in the menu: show a clickable icon to get it -->
<a if="len(menu.objects) == 1" var2="tied=menu.objects[0]" <a if="len(menu.objects) == 1" var2="tied=menu.objects[0]"
@ -331,15 +333,15 @@ class Ref(Field):
<!-- Display the number of objects in the menu (if more than one) --> <!-- Display the number of objects in the menu (if more than one) -->
<x if="len(menu.objects) &gt; 1">:len(menu.objects)</x> <x if="len(menu.objects) &gt; 1">:len(menu.objects)</x>
<!-- The dropdown menu containing annexes --> <!-- The dropdown menu containing annexes -->
<div id=":dropdownId" class="dropdown"> <div id=":dropdownId" class="dropdown" style="width:150px">
<div for="tied in menu.objects" <div for="tied in menu.objects"
class=":not loop.tied.first and 'refMenuItem' or ''"
var2="tiedUrl=field.getMenuUrl(zobj, tied)"> var2="tiedUrl=field.getMenuUrl(zobj, tied)">
<a href=":tiedUrl">:tied.title</a> <a href=":tiedUrl">:tied.title</a>
</div> </div>
</div> </div>
</div> </div>
</td> </div>''')
</tr></table>''')
# Simplified widget showing minimal info about tied objects. # Simplified widget showing minimal info about tied objects.
pxViewMinimal = Px(''' pxViewMinimal = Px('''

View file

@ -98,7 +98,7 @@ td.search { padding-top: 8px }
border: 1px solid grey; box-shadow: 2px 2px 2px #888888} border: 1px solid grey; box-shadow: 2px 2px 2px #888888}
.dropdown { display:none; position: absolute; border: 1px solid #cccccc; .dropdown { display:none; position: absolute; border: 1px solid #cccccc;
background-color: white; padding: 3px 4px 0; font-size: 8pt; background-color: white; padding: 3px 4px 0; font-size: 8pt;
font-weight: normal; z-index: 2 } font-weight: normal; text-align: left; z-index: 2 }
.dropdownMenu { cursor: pointer; font-size: 93%; position: relative } .dropdownMenu { cursor: pointer; font-size: 93%; position: relative }
.dropdown a:hover { text-decoration: underline } .dropdown a:hover { text-decoration: underline }
.list { margin-bottom: 3px } .list { margin-bottom: 3px }
@ -126,6 +126,7 @@ td.search { padding-top: 8px }
.even { background-color: #f9f9f9 } .even { background-color: #f9f9f9 }
.odd { background-color: #f4f4f4 } .odd { background-color: #f4f4f4 }
.odd2 { background-color: #f2f2f2 } .odd2 { background-color: #f2f2f2 }
.refMenuItem { border-top: grey 1px dashed; margin: 3px 0; padding-top: 3px }
.summary { margin-bottom: 5px; background-color: #f9f9f9; .summary { margin-bottom: 5px; background-color: #f9f9f9;
border: 2px solid #f9f9f9 } border: 2px solid #f9f9f9 }
.by { padding: 5px; color: grey; font-size: 97% } .by { padding: 5px; color: grey; font-size: 97% }