[gen] Simplified management and rendering of phases.
This commit is contained in:
parent
823ada17da
commit
68ae08b75a
|
@ -795,9 +795,9 @@ class BaseMixin:
|
||||||
if not res[i]['pages']:
|
if not res[i]['pages']:
|
||||||
del phases[res[i]['name']]
|
del phases[res[i]['name']]
|
||||||
del res[i]
|
del res[i]
|
||||||
# Then, compute status of phases
|
# Compute next/previous phases of every phase
|
||||||
for ph in phases.itervalues():
|
for ph in phases.itervalues():
|
||||||
ph.computeStatus(res)
|
ph.computeNextPrevious(res)
|
||||||
ph.totalNbOfPhases = len(res)
|
ph.totalNbOfPhases = len(res)
|
||||||
# Restrict the result to the current phase if required
|
# Restrict the result to the current phase if required
|
||||||
if currentOnly:
|
if currentOnly:
|
||||||
|
|
|
@ -80,12 +80,10 @@ img { border: 0; vertical-align: middle}
|
||||||
.portletTitle { font-weight: bold; font-size: 110%; margin-bottom: 4px;}
|
.portletTitle { font-weight: bold; font-size: 110%; margin-bottom: 4px;}
|
||||||
.portletCurrent { font-weight: bold; }
|
.portletCurrent { font-weight: bold; }
|
||||||
.portletSep { border-top: 1px solid #5F7983; margin-top: 2px;}
|
.portletSep { border-top: 1px solid #5F7983; margin-top: 2px;}
|
||||||
.portletPage { font-style: italic; }
|
.portletPage { font-style: italic }
|
||||||
.portletGroup { font-variant: small-caps; font-weight: bold; font-style: normal;
|
.portletGroup { font-variant: small-caps; font-weight: bold; font-size: 105%;
|
||||||
margin-top: 0.1em }
|
margin: 0.1em 0 0.3em ; border-bottom: 1px dashed grey}
|
||||||
.portletSearch { font-size: 90%; font-style: italic }
|
.portletSearch { font-size: 90%; font-style: italic }
|
||||||
.phase { border-style: dashed; border-width: thin; padding: 4px 0.6em 5px 1em;}
|
|
||||||
.phaseSelected { background-color: #F4F5F6; }
|
|
||||||
.content { padding: 14px 14px 9px 15px; background-color: #f1f1f1 }
|
.content { padding: 14px 14px 9px 15px; background-color: #f1f1f1 }
|
||||||
.grey { display: none; position: absolute; left: 0px; top: 0px;
|
.grey { display: none; position: absolute; left: 0px; top: 0px;
|
||||||
background:grey; opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5;
|
background:grey; opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 211 B |
|
@ -325,8 +325,8 @@
|
||||||
</tal:comment>
|
</tal:comment>
|
||||||
<metal:message define-macro="message" tal:define="messages tool/consumeMessages" tal:condition="messages">
|
<metal:message define-macro="message" tal:define="messages tool/consumeMessages" tal:condition="messages">
|
||||||
<div class="message">
|
<div class="message">
|
||||||
<span tal:replace="structure messages"></span>
|
|
||||||
<img tal:attributes="src python: '%s/ui/close.png' % appUrl"
|
<img tal:attributes="src python: '%s/ui/close.png' % appUrl"
|
||||||
align="right" style="cursor:pointer" onClick="this.parentNode.style.display='none'"/>
|
align="right" style="cursor:pointer" onClick="this.parentNode.style.display='none'"/>
|
||||||
|
<span tal:replace="structure messages"></span>
|
||||||
</div>
|
</div>
|
||||||
</metal:message>
|
</metal:message>
|
||||||
|
|
|
@ -119,10 +119,7 @@
|
||||||
<tal:phase repeat="phase phases">
|
<tal:phase repeat="phase phases">
|
||||||
<tal:comment replace="nothing">The box containing phase-related information</tal:comment>
|
<tal:comment replace="nothing">The box containing phase-related information</tal:comment>
|
||||||
<tr tal:define="singlePage python: len(phase['pages']) == 1">
|
<tr tal:define="singlePage python: len(phase['pages']) == 1">
|
||||||
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name']);
|
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name'])">
|
||||||
status phase/phaseStatus;
|
|
||||||
phaseCss python: (status == 'Current') and ' phaseSelected' or '';"
|
|
||||||
tal:attributes="class python: not singlePhase and 'phase%s' % phaseCss or ''">
|
|
||||||
<tal:comment replace="nothing">The title of the phase</tal:comment>
|
<tal:comment replace="nothing">The title of the phase</tal:comment>
|
||||||
<div class="portletGroup" tal:condition="python: not singlePhase and not singlePage"
|
<div class="portletGroup" tal:condition="python: not singlePhase and not singlePage"
|
||||||
tal:content="structure python: _(label)">
|
tal:content="structure python: _(label)">
|
||||||
|
@ -149,9 +146,5 @@
|
||||||
</tal:page>
|
</tal:page>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tal:comment replace="nothing">The down arrow pointing to the next phase (if any)</tal:comment>
|
|
||||||
<tr tal:condition="python: phase['name'] != phases[-1]['name']">
|
|
||||||
<td> <img tal:attributes="src string: $appUrl/ui/nextPhase.png"/></td>
|
|
||||||
</tr>
|
|
||||||
</tal:phase>
|
</tal:phase>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tal:comment replace="nothing">The message strip</tal:comment>
|
<tal:comment replace="nothing">The message strip</tal:comment>
|
||||||
<tr>
|
<tr valign="top">
|
||||||
<td>
|
<td>
|
||||||
<div style="position: relative">
|
<div style="position: relative">
|
||||||
<metal:msg use-macro="app/ui/page/macros/message"/>
|
<metal:msg use-macro="app/ui/page/macros/message"/>
|
||||||
|
|
14
gen/utils.py
14
gen/utils.py
|
@ -121,7 +121,6 @@ class PhaseDescr(Descr):
|
||||||
def __init__(self, name, obj):
|
def __init__(self, name, obj):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.obj = obj
|
self.obj = obj
|
||||||
self.phaseStatus = None
|
|
||||||
# The list of names of pages in this phase
|
# The list of names of pages in this phase
|
||||||
self.pages = []
|
self.pages = []
|
||||||
# The list of hidden pages in this phase
|
# The list of hidden pages in this phase
|
||||||
|
@ -164,17 +163,9 @@ class PhaseDescr(Descr):
|
||||||
else:
|
else:
|
||||||
self.hiddenPages.append(appyType.page.name)
|
self.hiddenPages.append(appyType.page.name)
|
||||||
|
|
||||||
def computeStatus(self, allPhases):
|
def computeNextPrevious(self, allPhases):
|
||||||
'''Compute status of this phase, which depends on the page currently
|
'''This method also fills fields "previousPhase" and "nextPhase"
|
||||||
shown. This method also fills fields "previousPhase" and "nextPhase"
|
|
||||||
if relevant, based on list of p_allPhases.'''
|
if relevant, based on list of p_allPhases.'''
|
||||||
res = 'Current'
|
|
||||||
# Compute status based on current page
|
|
||||||
page = self.obj.REQUEST.get('page', 'main')
|
|
||||||
if page in self.pages:
|
|
||||||
res = 'Current'
|
|
||||||
else:
|
|
||||||
res = 'Deselected'
|
|
||||||
# Identify previous and next phases
|
# Identify previous and next phases
|
||||||
for phaseInfo in allPhases:
|
for phaseInfo in allPhases:
|
||||||
if phaseInfo['name'] == self.name:
|
if phaseInfo['name'] == self.name:
|
||||||
|
@ -183,7 +174,6 @@ class PhaseDescr(Descr):
|
||||||
self.previousPhase = allPhases[i-1]
|
self.previousPhase = allPhases[i-1]
|
||||||
if i < (len(allPhases)-1):
|
if i < (len(allPhases)-1):
|
||||||
self.nextPhase = allPhases[i+1]
|
self.nextPhase = allPhases[i+1]
|
||||||
self.phaseStatus = res
|
|
||||||
|
|
||||||
class SearchDescr(Descr):
|
class SearchDescr(Descr):
|
||||||
'''Describes a Search.'''
|
'''Describes a Search.'''
|
||||||
|
|
Loading…
Reference in a new issue