appypod-rattail/gen/ui/navigate.pt

118 lines
7 KiB
Plaintext
Raw Normal View History

<div metal:define-macro="appyNavigate" tal:condition="python: totalNumber &gt; batchSize" tal:attributes="align dright">
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">
Buttons for navigating among a list of elements (next, back, first, last, etc).
</tal:comment>
2011-09-18 08:00:05 -05:00
<table class="listNavigate"
2010-04-30 05:06:49 -05:00
tal:define="mustSortAndFilter python: ajaxHookId == 'queryResult';
sortKey sortKey|python:'';
sortOrder sortOrder|python:'';
filterKey filterKey|python:'';
sortAndFilter python: test(mustSortAndFilter, ',\'%s\',\'%s\',\'%s\'' % (sortKey, sortOrder, filterKey), '')">
2011-09-18 08:00:05 -05:00
<tr valign="middle">
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Go to the first page</tal:comment>
2011-09-18 08:00:05 -05:00
<td tal:condition="python: (startNumber != 0) and (startNumber != batchSize)"><img style="cursor:pointer"
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowLeftDouble.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_first');
2010-04-30 05:06:49 -05:00
onClick python: navBaseCall.replace('**v**', '0'+sortAndFilter)"/></td>
<tal:comment replace="nothing">Go to the previous page</tal:comment>
2011-09-18 08:00:05 -05:00
<td tal:define="sNumber python: startNumber - batchSize"
tal:condition="python: startNumber != 0"><img style="cursor:pointer"
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowLeftSimple.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_previous');
2011-09-18 08:00:05 -05:00
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Explain which elements are currently shown</tal:comment>
2011-09-18 08:00:05 -05:00
<td class="discreet">&nbsp;
2010-04-30 05:06:49 -05:00
<span tal:replace="python: startNumber+1"/>
2011-11-25 11:01:20 -06:00
<img tal:attributes="src string: $appUrl/ui/to.png"/>
2010-04-30 05:06:49 -05:00
<span tal:replace="python: startNumber+len(objs)"/>&nbsp;<b>//</b>
<span tal:replace="python: totalNumber"/>&nbsp;&nbsp;
</td>
<tal:comment replace="nothing">Go to the next page</tal:comment>
2011-09-18 08:00:05 -05:00
<td tal:define="sNumber python: startNumber + batchSize"
tal:condition="python: sNumber &lt; totalNumber"><img style="cursor:pointer"
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowRightSimple.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_next');
2011-09-18 08:00:05 -05:00
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Go to the last page</tal:comment>
2011-09-18 08:00:05 -05:00
<td tal:define="lastPageIsIncomplete python: totalNumber % batchSize;
2010-04-30 05:06:49 -05:00
nbOfCompletePages python: totalNumber/batchSize;
nbOfCountedPages python: test(lastPageIsIncomplete, nbOfCompletePages, nbOfCompletePages-1);
sNumber python: (nbOfCountedPages*batchSize)"
2011-09-18 08:00:05 -05:00
tal:condition="python: (startNumber != sNumber) and (startNumber != sNumber-batchSize)"><img style="cursor:pointer"
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowRightDouble.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_last');
2011-09-18 08:00:05 -05:00
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
2010-04-30 05:06:49 -05:00
</tr>
</table>
</div>
<div metal:define-macro="objectNavigate" tal:condition="request/nav|nothing">
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">
Buttons for going to next/previous elements if this one is among bunch of referenced or searched objects.
currentNumber starts with 1.
</tal:comment>
2011-09-18 08:00:05 -05:00
<table class="objectNavigate"
2010-04-30 05:06:49 -05:00
tal:define="navInfo tool/getNavigationInfo;
currentNumber navInfo/currentNumber;
totalNumber navInfo/totalNumber;
firstUrl navInfo/firstUrl;
previousUrl navInfo/previousUrl;
nextUrl navInfo/nextUrl;
lastUrl navInfo/lastUrl;
sourceUrl navInfo/sourceUrl;
backText navInfo/backText">
2011-09-18 08:00:05 -05:00
<tr valign="middle">
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Go to the source URL (search or referred object)</tal:comment>
<td tal:condition="sourceUrl"><a tal:attributes="href sourceUrl"><img
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/gotoSource.png;
2012-06-03 11:34:56 -05:00
title python: backText + ' : ' + _('goto_source')"/></a></td>
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Go to the first page</tal:comment>
<td tal:condition="firstUrl"><a tal:attributes="href firstUrl"><img
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowLeftDouble.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_first')"/></a></td>
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Go to the previous page</tal:comment>
<td tal:condition="previousUrl"><a tal:attributes="href previousUrl"><img
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowLeftSimple.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_previous')"/></a></td>
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Explain which element is currently shown</tal:comment>
2011-09-18 08:00:05 -05:00
<td class="discreet">&nbsp;
2010-04-30 05:06:49 -05:00
<span tal:replace="python: currentNumber"/>&nbsp;<b>//</b>
<span tal:replace="python: totalNumber"/>&nbsp;&nbsp;
</td>
<tal:comment replace="nothing">Go to the next page</tal:comment>
<td tal:condition="python: nextUrl"><a tal:attributes="href nextUrl"><img
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowRightSimple.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_next')"/></a></td>
2010-04-30 05:06:49 -05:00
<tal:comment replace="nothing">Go to the last page</tal:comment>
<td tal:condition="lastUrl"><a tal:attributes="href lastUrl"><img
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/arrowRightDouble.png;
2012-06-03 11:34:56 -05:00
title python: _('goto_last')"/></a></td>
2010-04-30 05:06:49 -05:00
</tr>
</table>
</div>
<tal:comment replace="nothing">
This macro displays up/down arrows in a table header column for sorting a given column.
It requires variables "sortable", 'filterable' and 'fieldName'.
</tal:comment>
<metal:sortAndFilter define-macro="sortAndFilter" tal:define="fieldName widget/name">
2010-04-30 05:06:49 -05:00
<tal:sort condition="sortable">
2011-11-25 11:01:20 -06:00
<img tal:attributes="src string: $appUrl/ui/sortDown.gif;
2010-04-30 05:06:49 -05:00
onClick python: navBaseCall.replace('**v**', '0,\'%s\',\'asc\',\'%s\'' % (fieldName, filterKey))"
tal:condition="python: (sortKey != fieldName) or (sortOrder == 'desc')"
style="cursor:pointer"/>
2011-11-25 11:01:20 -06:00
<img tal:attributes="src string: $appUrl/ui/sortUp.gif;
2010-04-30 05:06:49 -05:00
onClick python: navBaseCall.replace('**v**', '0,\'%s\',\'desc\',\'%s\'' % (fieldName, filterKey))"
tal:condition="python: (sortKey != fieldName) or (sortOrder == 'asc')"
style="cursor:pointer"/>
</tal:sort>
<tal:filter condition="filterable">
<input type="text" size="7"
tal:attributes="id python: '%s_%s' % (ajaxHookId, fieldName);
value python: test(filterKey == fieldName, filterValue, '')"/>
2011-11-25 11:01:20 -06:00
<img tal:attributes="src string: $appUrl/ui/funnel.png;
2010-04-30 05:06:49 -05:00
onClick python: navBaseCall.replace('**v**', '0,\'%s\',\'%s\',\'%s\'' % (sortKey, sortOrder, fieldName))"
style="cursor:pointer"/>
</tal:filter>
</metal:sortAndFilter>