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

PR: Cleanup and rework: contenttype-icons ... #1227

Merged
merged 1 commit into from
Nov 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ New:

Fixes:

- remove deprecated icons ...
https://github.com/plone/Products.CMFPlone/issues/1226
[fgrcon]

- Fixed white space pep8 warnings.
[maurits]

Expand Down
7 changes: 0 additions & 7 deletions Products/CMFPlone/browser/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,6 @@ def displayContentsTab():
page of a folder, and checks if the user has relevant permissions.
"""

def getIcon(item):
"""Returns an object which implements the IContentIcon interface and
provides the informations necessary to render an icon.
The item parameter needs to be adaptable to IContentIcon.
Icons can be disabled globally or just for anonymous users with
the icon_visibility property in site_properties."""

def cropText(text, length, ellipsis):
""" Crop text on a word boundary """

Expand Down
1 change: 0 additions & 1 deletion Products/CMFPlone/browser/navtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def decoratorFactory(self, node):
newNode['absolute_url'] = itemUrl
newNode['getURL'] = itemUrl
newNode['path'] = item.getPath()
newNode['item_icon'] = layout_view.getIcon(item)
newNode['Creator'] = getattr(item, 'Creator', None)
newNode['creation_date'] = getattr(item, 'CreationDate', None)
newNode['portal_type'] = portalType
Expand Down
21 changes: 10 additions & 11 deletions Products/CMFPlone/browser/templates/sitemap-item.pt
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<tal:item define="node options/node;
item_url node/getURL;
item_remote_url node/getRemoteUrl;
use_remote_url node/useRemoteUrl | nothing;
item_icon nocall:node/item_icon;
is_current node/currentItem;
item_class string:state-${node/normalized_review_state} contenttype-${node/normalized_portal_type};
item_class python:is_current and item_class + ' navTreeCurrentItem' or item_class">
<tal:item define="node options/node;
item_url node/getURL;
item_remote_url node/getRemoteUrl;
use_remote_url node/useRemoteUrl | nothing;
is_current node/currentItem;
item_state_class string:state-${node/normalized_review_state};
item_type_class string:contenttype-${node/normalized_portal_type};
item_class python:is_current and item_state_class + ' navTreeCurrentItem' or item_state_class">

<a tal:attributes="href python:use_remote_url and item_remote_url or item_url;
title node/Description;
class string:$item_class">
<img tal:replace="structure item_icon/html_tag" />
class string:$item_class $item_type_class">
<span tal:content="node/Title">Selected Item Title</span>
</a>

</tal:item>
</tal:item>
4 changes: 1 addition & 3 deletions Products/CMFPlone/skins/plone_content/folder_listing.pt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
item_type item/portal_type;
item_type_title item/Type;
item_modified item/ModificationDate;
item_created item/CreationDate;
item_icon python:layout_view.getIcon(item);
item_created item/CreationDate;
item_type_class python:'contenttype-' + normalizeString(item_type);
item_wf_state item/review_state|python: context.portal_workflow.getInfoFor(item, 'review_state', '');
item_wf_state_class python:'state-' + normalizeString(item_wf_state);
Expand All @@ -67,7 +66,6 @@
tal:attributes="class python:test(item_type == 'Event', 'vevent', '')">

<span class="summary">
<img tal:replace="structure item_icon/html_tag" />
<a href="#"
tal:attributes="href python:test(item_type in use_view_action, item_url+'/view', item_url);
class string:$item_type_class $item_wf_state_class url"
Expand Down
23 changes: 11 additions & 12 deletions Products/CMFPlone/skins/plone_templates/recently_modified.pt
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@
<tal:results tal:repeat="result batch">

<li tal:define="description result/Description">
<header tal:define="item_icon python:plone_view.getIcon(result);
item_wf_state result/review_state;
item_wf_state_class python:'state-' + normalizeString(item_wf_state);">
<span tal:attributes="class python:'contenttype-' + normalizeString(result.portal_type)">
<img tal:replace="structure item_icon/html_tag" />
<a href="/view"
tal:content="result/pretty_title_or_id"
tal:attributes="href result/getURL;
class string:$item_wf_state_class">
Title
<header tal:define="item_wf_state result/review_state;
item_wf_state_class python:'state-' + normalizeString(item_wf_state);
item_type_class python:'contenttype-' + normalizeString(result.portal_type)">
<a tal:attributes="href result/getURL">
<img class = "image-tile"
tal:condition="python:result.getIcon"
tal:attributes="src python:result.getURL()+'/@@images/image/tile'">
<span tal:content="result/pretty_title_or_id"
tal:attributes="class string:$item_type_class $item_wf_state_class" >
Title</span>
</a>
</span>

<span class="discreet" i18n:translate="text_creator_date" tal:condition="show_about">
by
Expand Down Expand Up @@ -87,4 +86,4 @@
</metal:main>
</body>

</html>
</html>
27 changes: 15 additions & 12 deletions Products/CMFPlone/skins/plone_templates/recently_published.pt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
Batch python:modules['Products.CMFPlone'].Batch;
DateTime python:modules['DateTime'].DateTime;
b_start python:request.get('b_start',0);
toLocalizedTime nocall:context/@@plone/toLocalizedTime;">
toLocalizedTime nocall:context/@@plone/toLocalizedTime;
normalize nocall:context/@@plone/normalizeString;">

<h1 class="documentFirstHeading"
i18n:translate="heading_recently_published">
Expand All @@ -37,15 +38,17 @@
<tal:results tal:repeat="result batch">

<article>
<header>
<img src="" alt="" style="border: 0"
tal:attributes="src result/getIcon;
alt result/Type" />

<a href="/view"
tal:content="result/pretty_title_or_id"
tal:attributes="href result/getURL">
Title
<header
tal:define="item_class python:'contenttype-' + normalize(result.portal_type);
item_wf_state result/review_state;
item_wf_state_class python:'state-' + normalize(item_wf_state);">
<a tal:attributes="href result/getURL">
<img class = "image-tile"
tal:condition="python:result.getIcon"
tal:attributes="src python:result.getURL()+'/@@images/image/tile'">
<span tal:content="result/pretty_title_or_id"
tal:attributes="class string:$item_class $item_wf_state_class">
Title</span>
</a>

<span class="discreet" i18n:translate="text_creator_date" tal:condition="show_about">
Expand All @@ -62,7 +65,7 @@
</span>
</header>

<p class="link">
<p class="discreet">
<a href="/view"
tal:content="result/Description"
tal:attributes="href result/getURL">
Expand All @@ -89,4 +92,4 @@
</metal:main>
</body>

</html>
</html>
6 changes: 0 additions & 6 deletions Products/CMFPlone/tests/testCatalogTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,12 +1083,6 @@ def test_provided(self):
self.assertTrue(IIndexableObjectWrapper.providedBy(w))
self.assertTrue(IContentish.providedBy(w))

def test_getIcon(self):
doc = self.doc
iconname = doc.getIcon(relative_to_portal=1)
wrapped = IndexableObjectWrapper(doc, self.portal.portal_catalog)
self.assertEqual(wrapped.getIcon, iconname)

def test_getObjSize(self):
from Products.CMFPlone.CatalogTool import getObjSize
get_size = getObjSize.callable
Expand Down