[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']:
|
||||
del phases[res[i]['name']]
|
||||
del res[i]
|
||||
# Then, compute status of phases
|
||||
# Compute next/previous phases of every phase
|
||||
for ph in phases.itervalues():
|
||||
ph.computeStatus(res)
|
||||
ph.computeNextPrevious(res)
|
||||
ph.totalNbOfPhases = len(res)
|
||||
# Restrict the result to the current phase if required
|
||||
if currentOnly:
|
||||
|
|
|
@ -80,12 +80,10 @@ img { border: 0; vertical-align: middle}
|
|||
.portletTitle { font-weight: bold; font-size: 110%; margin-bottom: 4px;}
|
||||
.portletCurrent { font-weight: bold; }
|
||||
.portletSep { border-top: 1px solid #5F7983; margin-top: 2px;}
|
||||
.portletPage { font-style: italic; }
|
||||
.portletGroup { font-variant: small-caps; font-weight: bold; font-style: normal;
|
||||
margin-top: 0.1em }
|
||||
.portletPage { font-style: italic }
|
||||
.portletGroup { font-variant: small-caps; font-weight: bold; font-size: 105%;
|
||||
margin: 0.1em 0 0.3em ; border-bottom: 1px dashed grey}
|
||||
.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 }
|
||||
.grey { display: none; position: absolute; left: 0px; top: 0px;
|
||||
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>
|
||||
<metal:message define-macro="message" tal:define="messages tool/consumeMessages" tal:condition="messages">
|
||||
<div class="message">
|
||||
<span tal:replace="structure messages"></span>
|
||||
<img tal:attributes="src python: '%s/ui/close.png' % appUrl"
|
||||
align="right" style="cursor:pointer" onClick="this.parentNode.style.display='none'"/>
|
||||
<span tal:replace="structure messages"></span>
|
||||
</div>
|
||||
</metal:message>
|
||||
|
|
|
@ -119,10 +119,7 @@
|
|||
<tal:phase repeat="phase phases">
|
||||
<tal:comment replace="nothing">The box containing phase-related information</tal:comment>
|
||||
<tr tal:define="singlePage python: len(phase['pages']) == 1">
|
||||
<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 ''">
|
||||
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name'])">
|
||||
<tal:comment replace="nothing">The title of the phase</tal:comment>
|
||||
<div class="portletGroup" tal:condition="python: not singlePhase and not singlePage"
|
||||
tal:content="structure python: _(label)">
|
||||
|
@ -149,9 +146,5 @@
|
|||
</tal:page>
|
||||
</td>
|
||||
</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>
|
||||
</table>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The message strip</tal:comment>
|
||||
<tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<div style="position: relative">
|
||||
<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):
|
||||
self.name = name
|
||||
self.obj = obj
|
||||
self.phaseStatus = None
|
||||
# The list of names of pages in this phase
|
||||
self.pages = []
|
||||
# The list of hidden pages in this phase
|
||||
|
@ -164,17 +163,9 @@ class PhaseDescr(Descr):
|
|||
else:
|
||||
self.hiddenPages.append(appyType.page.name)
|
||||
|
||||
def computeStatus(self, allPhases):
|
||||
'''Compute status of this phase, which depends on the page currently
|
||||
shown. This method also fills fields "previousPhase" and "nextPhase"
|
||||
def computeNextPrevious(self, allPhases):
|
||||
'''This method also fills fields "previousPhase" and "nextPhase"
|
||||
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
|
||||
for phaseInfo in allPhases:
|
||||
if phaseInfo['name'] == self.name:
|
||||
|
@ -183,7 +174,6 @@ class PhaseDescr(Descr):
|
|||
self.previousPhase = allPhases[i-1]
|
||||
if i < (len(allPhases)-1):
|
||||
self.nextPhase = allPhases[i+1]
|
||||
self.phaseStatus = res
|
||||
|
||||
class SearchDescr(Descr):
|
||||
'''Describes a Search.'''
|
||||
|
|
Loading…
Reference in a new issue