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 and ... #60

Merged
merged 1 commit into from
Nov 11, 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
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ New:

Fixes:

- *add item here*
- Cleanup and rework: contenttype-icons and showing thumbnails
for images/leadimages in listings
https://github.com/plone/Products.CMFPlone/issues/1226
[fgrcon]


3.0.13 (2015-10-27)
Expand All @@ -30,6 +33,7 @@ Fixes:
[Gagaro]



3.0.12 (2015-09-20)
-------------------

Expand Down
3 changes: 3 additions & 0 deletions plone/app/content/browser/contents/templates/rename.pt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<div class="itemstoremove" i18n:domain="plone">
<% _.each(items, function(item, index) { %>
<div class="item">
<% if(item.getIcon ){ %><img src="<%= item.getURL %>/@@images/image/icon"><% } %>
<div class="form-group">

<input name="UID_<%= index %>" type="hidden" value="<%- item.UID %>" />
<label i18n:translate="label_title">Title</label>
<input class="form-control" name="newtitle_<%= index %>" value="<%= item.Title %>" />
<label i18n:translate="label_short_name">Short name</label>
<input class="form-control" name="newid_<%= index %>" value="<%= item.id %>" />

</div>
</div>
<% }) %>
Expand Down
15 changes: 9 additions & 6 deletions plone/app/content/browser/reviewlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def items(self):

url = obj.absolute_url()
path = '/'.join(obj.getPhysicalPath())
icon = plone_layout.getIcon(obj)

type_class = 'contenttype-' + plone_utils.normalizeString(
obj.portal_type)

Expand All @@ -82,9 +80,15 @@ def items(self):
url_href_title = u'%s: %s' % (translate(type_title_msgid,
context=self.request),
safe_unicode(obj.Description()))

modified = plone_view.toLocalizedTime(
obj.ModificationDate(), long_format=1)
getMember = getToolByName(obj, 'portal_membership').getMemberById
creator_id = obj.Creator()
creator = getMember(creator_id)
if creator:
creator_name = creator.getProperty('fullname', '') or creator_id
else:
creator_name = creator_id
modified = creator_name + ' - ' + plone_view.toLocalizedTime(
obj.ModificationDate(), long_format=1)
is_structural_folder = obj.restrictedTraverse(
'@@plone').isStructuralFolder()

Expand All @@ -109,7 +113,6 @@ def items(self):
obj_type=obj.Type,
size=obj.getObjSize(),
modified=modified,
icon=icon.html_tag(),
type_class=type_class,
wf_state=review_state,
state_title=portal_workflow.getTitleForStateOnType(
Expand Down
10 changes: 6 additions & 4 deletions plone/app/content/browser/templates/content_status_history.pt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
getRelativeContentURL nocall:url_tool/getRelativeContentURL;
normalizeString nocall:plone_view/normalizeString;
wtool portal/portal_workflow;
getIcon nocall:plone_layout/getIcon;
">
<tal:items tal:repeat="item batch">
<tr tal:define="oddrow repeat/item/odd;
Expand All @@ -126,7 +125,6 @@
item_type item/portal_type;
item_size item/getObjSize;
item_modified item/ModificationDate;
item_icon python:getIcon(item);
item_type_class python:'contenttype-' + normalizeString(item_type);
item_wf_state item/review_state|python: wtool.getInfoFor(item, 'review_state', '');
item_state_title python:wtool.getTitleForStateOnType(item_wf_state, item_type);
Expand All @@ -136,7 +134,8 @@
item_rel_url python:hasGetUrl and item.getURL(relative=1) or getRelativeContentURL(item);
browserDefaultResult context/browserDefault;
isBrowserDefault python:len(browserDefaultResult[1]) == 1 and item.id == context.browserDefault()[1][0];
item_folderish item/is_folderish|nothing"
item_folderish item/is_folderish|nothing;
item_has_image python:item.getIcon"
tal:attributes="class python:oddrow and 'draggable even' or 'draggable odd';
id string:folder-contents-item-${item_id};" >

Expand All @@ -158,7 +157,10 @@
</td>
<td tal:define="url python:item_use_view and item_url+'/view' or
(item_folderish and item_url+'/folder_contents'or item_url+'/');">
<img tal:replace="structure item_icon/html_tag" />
<img class="image-tile"
tal:define="getIcon string:$item_url/@@images/image/tile'"
tal:condition="item_has_image"
tal:attributes="src string:$getIcon">
<a href="#" tal:attributes="href url;
title string:$item_type: $item_description;
class string:$item_wf_state_class $item_type_class;">
Expand Down
5 changes: 4 additions & 1 deletion plone/app/content/browser/vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from AccessControl import getSecurityManager
from plone.app.layout.navigation.interfaces import INavigationRoot
from plone.app.layout.navigation.root import getNavigationRoot
from Products.CMFPlone.utils import normalizeString
from Products.Five import BrowserView
from logging import getLogger
from plone.app.content.utils import json_dumps
Expand All @@ -19,6 +20,7 @@
from zope.security.interfaces import IPermission
import inspect
import itertools
import os

logger = getLogger(__name__)

Expand All @@ -42,7 +44,8 @@ def _parseJSON(s):


_unsafe_metadata = ['Creator', 'listCreators', 'author_name', 'commentors']
_safe_callable_metadata = ['getURL', 'getPath']
_safe_callable_metadata = ['getURL', 'getPath','review_state',
'getIcon', 'is_folderish']


class VocabLookupException(Exception):
Expand Down