[gen] Fixed groups with style 'tabs'; reused the same tabs for representing phases; pages and phases are now outside the portlet, rendered horizontally below the breadcrumb; methods getSupBreadCrumb and getSubBreadCrumb can now be defined on every gen-class to customize what is shown above and below the breadcrumb (=title with a prefix) on view layouts (those methods are similar to getSubTitle and getSupTitle when displaying lists of objects).

This commit is contained in:
Gaetan Delannay 2014-04-29 19:02:06 +02:00
parent cee7b49e3c
commit 7adbc7e4bc
15 changed files with 143 additions and 75 deletions

View file

@ -154,24 +154,14 @@ class ToolWrapper(AbstractWrapper):
currentSearch=req.get('search', None);
currentClass=req.get('className', None);
currentPage=req['PATH_INFO'].rsplit('/',1)[-1];
rootClasses=ztool.getRootClasses();
phases=zobj and zobj.getAppyPhases() or None">
<table class="portletContent"
if="zobj and phases and zobj.mayNavigate()"
var2="singlePhase=phases and (len(phases) == 1);
page=req.get('page', '');
mayEdit=zobj.mayEdit()">
<x for="phase in phases">:phase.pxView</x>
</table>
rootClasses=ztool.getRootClasses()">
<!-- One section for every searchable root class -->
<x for="rootClass in rootClasses" if="ztool.userMaySearch(rootClass)"
var2="className=ztool.getPortalType(rootClass)">
<!-- A separator if required -->
<div class="portletSep" var="nb=loop.rootClass.nb"
if="(nb != 0) or ((nb == 0) and phases)"></div>
<div class="portletSep" if="loop.rootClass.nb != 0"></div>
<!-- Section title (link triggers the default search) -->
<div class="portletContent"
@ -183,7 +173,7 @@ class ToolWrapper(AbstractWrapper):
(queryUrl, className, queryParam)"
class=":(not currentSearch and (currentClass==className) and \
(currentPage=='query')) and \
'portletCurrent' or ''">::_(className + '_plural')</a>
'current' or ''">::_(className + '_plural')</a>
</div>
<!-- Actions -->
@ -220,7 +210,7 @@ class ToolWrapper(AbstractWrapper):
<!-- Advanced search -->
<div var="highlighted=(currentClass == className) and \
(currentPage == 'search')"
class=":highlighted and 'portletSearch portletCurrent' or \
class=":highlighted and 'portletSearch current' or \
'portletSearch'"
align=":dright">
<a var="text=_('search_title')" style="font-size: 88%"
@ -234,6 +224,8 @@ class ToolWrapper(AbstractWrapper):
<x if="search.type == 'group'">:search.px</x>
<x if="search.type != 'group'">:search.pxView</x>
</x>
<!-- Portlet bottom, potentially customized by the app -->
<x>::ztool.portletBottom(rootClass)</x>
</div>
</x>
</x>''')

View file

@ -48,10 +48,13 @@ class AbstractWrapper(object):
</div>''')
pxNavigationStrip = Px('''
<table width="100%" class="navigate">
<table width="100%">
<tr>
<!-- Breadcrumb -->
<td var="breadcrumb=zobj.getBreadCrumb()" class="breadcrumb">
<td var="sup=zobj.getSupBreadCrumb();
breadcrumb=zobj.getBreadCrumb();
sub=zobj.getSubBreadCrumb()" class="breadcrumb">
<x if="sup">::sup</x>
<x for="bc in breadcrumb" var2="nb=loop.bc.nb">
<img if="nb != 0" src=":url('to')"/>
<!-- Display only the title of the current object -->
@ -59,11 +62,15 @@ class AbstractWrapper(object):
<!-- Display a link for parent objects -->
<a if="nb != len(breadcrumb)-1" href=":bc.url">:bc.title</a>
</x>
<x if="sub">::sub</x>
</td>
<!-- Object navigation -->
<td align=":dright">:obj.pxNavigateSiblings</td>
</tr>
</table>''')
</table>
<!-- Object phases and pages -->
<x var="phases=zobj.getAppyPhases()"
if="phases and zobj.mayNavigate()">:phases[0].pxAllPhases</x>''')
# The template PX for all pages.
pxTemplate = Px('''
@ -267,19 +274,22 @@ class AbstractWrapper(object):
</table>
</td>
</tr>
<!-- The navigation strip -->
<tr height="26px" if="zobj and showPortlet and (layoutType != 'edit')">
<td>:obj.pxNavigationStrip</td>
</tr>
<tr valign="top">
<td>
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<!-- The portlet -->
<td if="showPortlet" class="portlet">:tool.pxPortlet</td>
<!-- Page content -->
<td class="content">:content</td>
<td class="content">
<table cellpadding="0" cellspacing="0" width="100%">
<!-- Navigation strip -->
<tr if="zobj and (layoutType != 'edit')"
height="26px"><td>:obj.pxNavigationStrip</td>
</tr>
<!-- Page content -->
<tr><td>:content</td></tr>
</table>
</td>
</tr>
</table>
</td>