Mercurial > hg > MPIWGThesaurus
changeset 32:911defd02ff8
working on levelTemplate
author | casties |
---|---|
date | Wed, 12 Jun 2013 15:06:04 +0200 |
parents | 8bb5fef365b5 |
children | 65132c9c5c09 |
files | MPIWGThesaurus.py zpt/levelFormatted.zpt |
diffstat | 2 files changed, 45 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGThesaurus.py Mon Jun 10 17:38:33 2013 +0200 +++ b/MPIWGThesaurus.py Wed Jun 12 15:06:04 2013 +0200 @@ -646,13 +646,11 @@ return entry.title def getEntriesFormatted(self,entries,formatType): - errorString="<H1>template with name <em>levelFormatted</em> does not exist in the thesaurus folder!" if not hasattr(self,'levelFormatted'): - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','levelFormatted.zpt')).__of__(self) + pt=PageTemplateFile('zpt/levelFormatted', globals()).__of__(self) return pt(level1_entries=entries,type=formatType) - - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','levelFormatted.zpt')).__of__(self) + pt = getattr(self,'levelFormatted') return pt(level1_entries=entries,type=formatType)
--- a/zpt/levelFormatted.zpt Mon Jun 10 17:38:33 2013 +0200 +++ b/zpt/levelFormatted.zpt Wed Jun 12 15:06:04 2013 +0200 @@ -1,78 +1,59 @@ -<!-- exmample for level template --> - -<tal:x tal:repeat="level1 - python:options['level1_entries']"> - - <ul class="foldable"> - <li class="type fold_head level_1 showApproach"><img class="fold_open" - tal:attributes="src python:root.absolute_url()+'/www/images/foldout_open.png'" alt="" /> <img class="fold_closed" - tal:attributes="src python:root.absolute_url()+'/www/images/foldout_closed.png'" alt=""> <span - tal:content="python:here.getTitle(level1) +'('+ str(len(here.getProjectsWithTag(options['type'],here.getTitle(level1)))) +')' ">Lorem</span> +<!-- level template --> +<tal:x tal:repeat="level1 python:options['level1_entries']"> + <ul class="foldable" + tal:define="level1entries python:here.getProjectsWithTag(options['type'],here.getTitle(level1))" + tal:condition="level1entries"> + <li class="type fold_head level_1 showApproach"> + <h3><img class="fold_open" + tal:attributes="src python:root.absolute_url()+'/www/images/foldout_open.png'" alt="" /><img class="fold_closed" + tal:attributes="src python:root.absolute_url()+'/www/images/foldout_closed.png'" alt=""> + <span tal:content="python:here.getTitle(level1) +' ('+ str(len(level1entries)) +')' ">Lorem</span> + </h3> </li> <li class="li_project fold_body projectsWindow"> <table class="items"> - <tr class="line" tal:repeat="proj python:here.getProjectsWithTag(options['type'],here.getTitle(level1))"> + <tr class="line" tal:repeat="proj level1entries"> <td> <a tal:attributes="href python:proj[0]"><img class="thumb" tal:define="imgUrl python:proj[3]" - tal:condition="imgUrl" tal:attributes="src imgUrl" src="" alt="" /></a> + tal:condition="imgUrl" tal:attributes="src imgUrl" alt="" /></a> </td> <td> - <a tal:condition="python:proj!=None" tal:attributes="href python:proj[0]"><span - tal:replace="python:proj[1]">my proj</span></a> <tal:x define="person python:proj[2]"> - <span class="person_projects" tal:content="person" /> - </tal:x> + <a tal:condition="proj" tal:attributes="href python:proj[0]" tal:content="python:proj[1]">my proj</a>; + <span class="person_projects" tal:define="person python:proj[2]" tal:content="person" /> </td> </tr> </table> </li> - <tal:y condition="python:len(here.getEntries(level1))>0"> - <tal:x tal:repeat="level2 - python:here.getEntries(level1)"> - - <tal:x - define="subitems - python:here.getProjectsWithTag(options['type'],here.getTitle(level1)+'_'+here.getTitle(level2))" - condition="python:len(subitems)>0"> - - - - <li class="level_2 indent fold_body"> + <tal:x tal:define="level2entries python:here.getEntries(level1)" tal:repeat="proj level2entries"> + <tal:x tal:define="subitems python:here.getProjectsWithTag(options['type'],here.getTitle(level1)+'_'+here.getTitle(proj))" + tal:condition="subitems"> + <li class="level_2 indent fold_body"> + <div class="foldable2"> + <div class="fold_head2"> + <img class="fold_open" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_open.png'" alt="" /><img + class="fold_closed" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_closed.png'" alt=""> + <span class="showApproach" tal:content="python:here.getTitle(proj)+' ('+str(len(subitems))+')'">Lor</span> + </div> + <div class="level2 fold_body2 indent li_project projectsWindow"> + <table class="items"> + <tr class="line" tal:repeat="proj python:subitems"> + <tal:x> + <td><a tal:attributes="href python:proj[0]"><img class="thumb" tal:define="imgUrl python:proj[3]" + tal:condition="imgUrl" tal:attributes="src imgUrl" src="" alt="" /></a></td> + <td><a tal:condition="python:proj!=None" tal:attributes="href python:proj[0]"><span + tal:replace="python:proj[1]">my proj</span></a> <tal:x define="person python:proj[2]"> + <span class="person_projects" tal:content="person" /> + </tal:x></td> + </tal:x> + </tr> + </table> + </div> + </div> + </li> + </tal:x> + </tal:x> - <div class="foldable2"> - <div class="fold_head2"> - <img class="fold_open" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_open.png'" alt="" /> <img - class="fold_closed" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_closed.png'" alt=""> - <span class="showApproach" tal:content="python:here.getTitle(level2) +' - ('+str(len(subitems))+')'">Lor</span> - </div> - <div class="level2 fold_body2 indent li_project projectsWindow"> - <table class="items "> - <tr class="line" tal:repeat="proj python:subitems"> - <tal:x> - - <td><a tal:attributes="href python:proj[0]"><img class="thumb" tal:define="imgUrl python:proj[3]" - tal:condition="imgUrl" tal:attributes="src imgUrl" src="" alt="" /></a></td> - <td><a tal:condition="python:proj!=None" tal:attributes="href - python:proj[0]"><span - tal:replace="python:proj[1]">my proj</span></a> <tal:x define="person python:proj[2]"> - <span class="person_projects" tal:content="person" /> - </tal:x></td> - </tal:x> - </tr> - </table> - </div> - - </div> - </li> - - - - - </tal:x> - </tal:x> - - </tal:y> </ul> </tal:x>