Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plone 5 (tests OK) #20

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ after_success:
addons:
firefox: "latest"
install:
- sed -ie "s#travis-4.3#travis-$PLONE_VERSION#" travis.cfg
- pip install coveralls
- make bin/test
env:
global:
secure: aeJaNydBzTcyBwbbluHDvs8vmryEpwaSFYD+SvTlD2e341Ilye+vxKR2/fT56OYLONEvFXkc5K1maw4caJqaxAfjlfO80Id3FsIO3f/AM/zTl3SERHd//y8CaaokL9vaxqNRjUHRMrpJZQpTFKW8V7HMnK88ulQF8nuM1gaQU/Q=
matrix:
- PLONE_VERSION=4.3
- PLONE_VERSION=5.1
language: python
before_script:
- export DISPLAY=:99.0
Expand Down
48 changes: 27 additions & 21 deletions src/collective/jekyll/browser/collection_view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
batch topicContents;">
<table class="listing"
summary="Content listing"
tal:define="vocab python:here.listMetaDataFields(False);
use_view_action site_properties/typesUseViewActionInListings|python:();"
tal:define="use_view_action site_properties/typesUseViewActionInListings|python:();"
i18n:attributes="summary summary_content_listing;">
<thead>
<tr>
Expand All @@ -27,8 +26,8 @@
tal:attributes="title type/help; href type/url" />
<span tal:condition="python:view.getSymptomName() == type.name">&#x25bc;</span>
</th>
<th tal:repeat="field here/getCustomViewFields"
tal:content="python:vocab.getValue(field, field)"
<th tal:repeat="field here/selectedViewFields"
tal:content="python:field[1]"
i18n:translate=""/>
</tr>
</thead>
Expand All @@ -44,38 +43,45 @@
tal:replace="structure symptom/@@status" />
</td>
</tal:symptoms>
<tal:fields repeat="field here/getCustomViewFields"
<tal:fields repeat="field here/customViewFields"
define="normalizeString nocall:context/@@plone/normalizeString;
toLocalizedTime nocall: context/@@plone/toLocalizedTime;
url obj/getURL;
obj_type obj/portal_type;
obj_type_class python:'contenttype-' + normalizeString(obj_type);
obj_description obj/Description;
obj_typeinfo python: here.portal_types.getTypeInfo(obj_type);
obj_icon python:plone_view.getIcon(obj);
obj_has_image python:obj.getIcon;
obj_wf_state obj/review_state|python: wtool.getInfoFor(obj, 'review_state', '');
obj_wf_state_class python:'state-' + normalizeString(obj_wf_state);
obj_url python:url+'/view' if obj_type in use_view_action else url;
title_or_id obj/pretty_title_or_id">
<tal:block define="value python: getattr(obj, field, None)">
<td tal:condition="python: field != 'Title'"
tal:content="python:here.formatCatalogMetadata(value)"
<td tal:condition="python: field != 'Title' and field not in ['ModificationDate',
'CreationDate', 'EffectiveDate',
'ExpirationDate', ]"
tal:content="value"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer logic to be kept in view classes. Would it be possible to move this tal:condition test to a method on a view class ?

i18n:translate=""/>
<td tal:condition="python:field in ['ModificationDate',
'CreationDate', 'EffectiveDate',
'ExpirationDate', ]">
<span tal:replace="python:toLocalizedTime(value,long_format=1)">
August 16, 2001 at 23:35:59
</span>
</td>
<td tal:condition="python: field == 'Title'">
<a href="#" tal:attributes="href obj_url;
title obj_description;">
<img src="#"
height="16"
width="16"
tal:condition="obj_icon/url"
tal:attributes="src obj_icon/url;
alt obj_icon/description;
title obj_icon/title;
width obj_icon/width;
height obj_icon/height;"/>
<a href="#"
tal:condition="obj_has_image"
tal:attributes="href obj_url;
title obj_description;">
<img class="thumb-icon"
tal:define="getIcon python:obj.getURL() +'/@@images/image/icon'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python: in the template is often a smell. I would compute the image URL in the view class.

tal:attributes="src string:$getIcon;alt obj/Description">
</a>
<a href="#"
tal:condition="python: obj.portal_type != 'Link'"
tal:attributes="href obj_url;
class string:${obj_wf_state_class};
class string:${obj_type_class} ${obj_wf_state_class} url;
title obj_description;"
tal:content="title_or_id">
Item Title
Expand All @@ -84,7 +90,7 @@
<a href="#"
tal:condition="python: obj.portal_type == 'Link'"
tal:attributes="href obj/getRemoteUrl;
class string:${obj_wf_state_class} link-plain;
class string:${obj_type_class} ${obj_wf_state_class} link-plain;
title obj_description;"
class="link-plain"
tal:content="title_or_id" />
Expand Down
2 changes: 1 addition & 1 deletion src/collective/jekyll/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/>

<browser:page
for="plone.app.collection.interfaces.ICollection"
for="plone.app.contenttypes.interfaces.ICollection"
name="diagnosis_view"
class=".diagnosis.DiagnosisCollectionView"
template="collection_view.pt"
Expand Down
2 changes: 1 addition & 1 deletion src/collective/jekyll/browser/diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def items(self):
return results

def _getResults(self):
return self.context.getQuery(brains=True)
return list(self.context.results(brains=True))

def getSymptomName(self):
name = self.request.get('symptom_name', None)
Expand Down
14 changes: 7 additions & 7 deletions src/collective/jekyll/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -66,37 +66,37 @@
factory=".symptoms.TitleFormatSymptom" />

<subscriber
for="Products.Archetypes.interfaces.IExtensibleMetadata"
for="plone.dexterity.interfaces.IDexterityContent"
provides=".interfaces.ISymptom"
factory=".symptoms.DescriptionLengthSymptom" />

<subscriber
for="Products.Archetypes.interfaces.IExtensibleMetadata"
for="plone.dexterity.interfaces.IDexterityContent"
provides=".interfaces.ISymptom"
factory=".symptoms.DescriptionFormatSymptom" />

<subscriber
for="Products.ATContentTypes.interfaces.IATDocument"
for="plone.app.contenttypes.behaviors.richtext.IRichText"
provides=".interfaces.ISymptom"
factory=".symptoms.BodyTextPresentSymptom" />

<subscriber
for="Products.ATContentTypes.interfaces.IATDocument"
for="plone.app.contenttypes.behaviors.richtext.IRichText"
provides=".interfaces.ISymptom"
factory=".symptoms.SpacesInBodySymptom" />

<subscriber
for="Products.ATContentTypes.interfaces.IATDocument"
for="plone.app.contenttypes.behaviors.richtext.IRichText"
provides=".interfaces.ISymptom"
factory=".symptoms.LinksInBodySymptom" />

<subscriber
for="Products.ATContentTypes.interfaces.IATNewsItem"
for="plone.app.contenttypes.interfaces.INewsItem"
provides=".interfaces.ISymptom"
factory=".symptoms.ImagePresentSymptom" />

<subscriber
for="Products.ATContentTypes.interfaces.IATNewsItem"
for="plone.app.contenttypes.interfaces.INewsItem"
provides=".interfaces.ISymptom"
factory=".symptoms.ImageSizeSymptom" />

Expand Down
Loading