Skip to content

Commit

Permalink
make thumb size in folder contents listing adjustable/supressable
Browse files Browse the repository at this point in the history
  (uses site control panel settings: thumb_size_tables ...)
  plone/Products.CMFPlone#1734
  • Loading branch information
fgrcon committed Sep 21, 2016
1 parent 7e72ab7 commit 088d083
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Breaking changes:
- *add item here*

New features:
- make thumbsize in folder contents listing adjustable/supressable
(uses site control panel settings: thumb_size_tables ...)
https://github.com/plone/Products.CMFPlone/issues/1734 [fgrcon]

- *add item here*

Expand Down
13 changes: 13 additions & 0 deletions plone/app/content/browser/contents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from plone.app.content.utils import json_dumps
from plone.app.content.utils import json_loads
from plone.protect.postonly import check as checkpost
from plone.registry.interfaces import IRegistry
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.interfaces.controlpanel import ISiteSchema
from Products.CMFPlone import PloneMessageFactory as _
from Products.CMFPlone import utils
from Products.Five import BrowserView
Expand Down Expand Up @@ -242,6 +244,16 @@ def get_columns(self):
columns[column] = translate(_(column), context=self.request)
return columns

def get_thumbSize(self):
registry = getUtility(IRegistry)
settings = registry.forInterface(
ISiteSchema, prefix="plone", check=False)
if settings.no_thumbs_tables:
# thumbs to be supressed
return 'none'
thumb_size_table = settings.thumb_size_table
return thumb_size_table

def get_options(self):
site = get_top_site_from_url(self.context, self.request)
base_url = site.absolute_url()
Expand Down Expand Up @@ -281,6 +293,7 @@ def get_options(self):
'initialFolder': IUUID(self.context, None),
'useTus': TUS_ENABLED
},
'thumbSize' : self.get_thumbSize(),
}
return options

Expand Down

0 comments on commit 088d083

Please sign in to comment.