Skip to content

Commit

Permalink
convert description from text/plain to text/html when displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
kagesenshi committed Mar 18, 2012
1 parent 1f9c30e commit 2bbbeb9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
6 changes: 6 additions & 0 deletions collective/conference/browser/macros.py
Expand Up @@ -8,6 +8,7 @@
from Products.CMFPlone.browser.interfaces import INavigationTree
from five import grok
from zope.component import getMultiAdapter
from Products.CMFCore.utils import getToolByName

from Products.CMFPlone.browser.navtree import NavtreeQueryBuilder
from plone.app.layout.navigation.interfaces import INavtreeStrategy
Expand Down Expand Up @@ -52,3 +53,8 @@ def content_tabs(self):
'description':t['Description']
} for t in navtree_view.navigationTree()['children']]


def text_to_html(self, text):
pt = getToolByName(self.context, 'portal_transforms')
return pt.convertTo('text/html', text, mimetype='text/plain').getData()

5 changes: 3 additions & 2 deletions collective/conference/browser/templates/conference_view.pt
Expand Up @@ -12,11 +12,12 @@
<div metal:fill-slot="content-title"></div>
<div metal:fill-slot="content-description"></div>
<div metal:fill-slot="content-core">
<div class="row-fluid banner">
<div class="row-fluid banner"
tal:define="text_to_html nocall:here/@@collective-conference-macros/text_to_html">
<div class="span1">&nbsp;</div>
<div class="span6">
<h1 tal:content="context/title"></h1>
<p style="font-size:15px" tal:content="context/description"></p>
<p tal:replace="structure python:text_to_html(context.description)"></p>
<a class="btn btn-primary btn-large"
tal:attributes="href string:${context/absolute_url}/register">Register NOW</a>
<a class="btn btn-primary btn-large"
Expand Down
10 changes: 6 additions & 4 deletions collective/conference/browser/templates/participant_view.pt
Expand Up @@ -15,7 +15,8 @@
<div metal:fill-slot="content-description"></div>

<div metal:fill-slot="content-core">
<section id="profile">
<section id="profile"
tal:define="text_to_html nocall:here/@@collective-conference-macros/text_to_html">
<div class="page-header">
<h3 tal:content="context/title">Name</h3>
</div>
Expand All @@ -34,13 +35,14 @@
</tal:block>
<tal:block condition="context/description">
<dt>Bio:</dt>
<dd><p tal:content="context/description"></p></dd>
<dd><p tal:replace="structure python:text_to_html(context.description)"></p></dd>
</tal:block>
</dl>
</div>
</div>
</section>
<section id="topic" tal:define="sessions context/sessions"
<section id="topic" tal:define="sessions context/sessions;
text_to_html nocall:here/@@collective-conference-macros/text_to_html"
tal:condition="sessions">
<div class="row-fluid">
<div class="page-header">
Expand All @@ -51,7 +53,7 @@
<div tal:repeat="session sessions">
<h4><a tal:attributes="href session/absolute_url" tal:content="session/title"></a></h4>
<div>
<p tal:content="session/description"></p>
<p tal:replace="structure python:text_to_html(session.description)"></p>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions collective/conference/browser/templates/session_listing.pt
Expand Up @@ -25,14 +25,15 @@
</script>

<div class="row-fluid" style="border-top:1px solid #eee; margin-top:20px; padding-top:10px;padding-bottom:10px">
<div class="span12" tal:define="sessions view/items">
<div class="span12" tal:define="sessions view/items;
text_to_html nocall:here/@@collective-conference-macros/text_to_html">
<ul class="thumbnails">
<li class="span3" tal:repeat="session sessions">
<section>
<div class="thumbnail conference-session">
<h2><a tal:attributes="href session/absolute_url"
tal:content="session/title"></a></h2>
<p tal:content="session/description"></p>
<p tal:replace="structure python:text_to_html(session.description)"></p>
<p><a tal:attributes="href session/absolute_url">Read more &raquo;</a></p>
</div>
</section>
Expand Down
5 changes: 3 additions & 2 deletions collective/conference/browser/templates/session_view.pt
Expand Up @@ -15,10 +15,11 @@

<div metal:fill-slot="content-core">

<div class="row-fluid" tal:define="persons context/owners">
<div class="row-fluid" tal:define="persons context/owners;
text_to_html nocall:here/@@collective-conference-macros/text_to_html">
<div class="span9">
<h3>Summmary</h3>
<div><p tal:content="here/description"/></div>
<div><p tal:replace="structure python:text_to_html(context.description)"/></div>
<tal:c condition="persons">
<h3>Presented By</h3>
<metal:photo use-macro="here/@@collective-conference-macros/macros/persongallery"></metal:photo>
Expand Down
5 changes: 3 additions & 2 deletions collective/conference/browser/templates/speaker_listing.pt
Expand Up @@ -18,15 +18,16 @@

<div metal:fill-slot="content-core">
<div class="row-fluid" style="border-top:1px solid #eee; margin-top:20px; padding-top:10px;padding-bottom:10px">
<div class="span12" tal:define="persons view/items">
<div class="span12" tal:define="persons view/items;
text_to_html nocall:here/@@collective-conference-macros/text_to_html">
<div class="row-fluid" style="padding-top:10px;padding-bottom:10px" tal:repeat="person persons">
<div class="span2" style="text-align:center;" tal:define="photoWidth python:90;
photoHeight python:117">
<metal:photo use-macro="here/@@collective-conference-macros/macros/profilephoto"></metal:photo>
</div>
<div class="span7">
<h2 tal:content="person/title"></h2>
<p tal:content="person/description"></p>
<p tal:replace="structure python:text_to_html(person.description)"></p>
</div>
<div class="span3">
<h4>Sessions</h4>
Expand Down

0 comments on commit 2bbbeb9

Please sign in to comment.