Skip to content

Commit

Permalink
Add sortable listing tile
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Sep 2, 2017
1 parent 622e795 commit 92515fa
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ Development


.. image:: https://coveralls.io/repos/github/collective/collective.sortedlisting/badge.svg?branch=master
:target: https://coveralls.io/github/collective/collective.sortedlisting?branch=master
:target: https://coveralls.io/github/collective/collective.sortedlisting?branch=master


Build mockup (only Plone 5.1b4 and below)

$ bin/plone-compile-resources -s Plone -b plone
$ bin/plone-compile-resources -s Plone -b plone-logged-in
$ bin/plone-compile-resources -s Plone -b plone
$ bin/plone-compile-resources -s Plone -b plone-logged-in

Build resources

$ bin/plone-compile-resources -s Plone -b sortablequerystring
$ bin/plone-compile-resources -s Plone -b sortablequerystring

Contribute
----------
Expand Down
12 changes: 5 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,17 @@
zip_safe=False,
install_requires=[
'plone.api',
'Products.GenericSetup>=1.8.2',
'setuptools',
'z3c.jbot',
'plone.app.contenttypes',
'plone.app.dexterity',
'plone.app.querystring',
'plone.app.z3cform',
'setuptools',
],
extras_require={
'test': [
'plone.app.mosaic',
'plone.app.testing',
# Plone KGS does not use this version, because it would break
# Remove if your package shall be part of coredev.
# plone_coredev tests as of 2016-04-01.
'plone.testing>=5.0.0',
'plone.app.contenttypes',
'plone.app.robotframework[debug]',
],
},
Expand Down
22 changes: 17 additions & 5 deletions src/collective/sortedlisting/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="collective.sortedlisting">

<i18n:registerTranslations directory="locales" />
Expand Down Expand Up @@ -34,7 +34,7 @@
factory=".setuphandlers.HiddenProfiles"
name="collective.sortedlisting-hiddenprofiles" />

<plone:behavior
<plone:behavior
name="collective.sortedlisting.sortablecollection"
title="Sorted Collection"
description="Adds collection behavior with sorting support"
Expand All @@ -44,8 +44,19 @@
marker="plone.app.contenttypes.behaviors.collection.ISyndicatableCollection"
/>

<!-- configure zcml:condition="installed plone.app.mosaic">
<include package="plone.app.standardtiles" />
<configure zcml:condition="installed plone.app.mosaic">

<include package="plone.app.mosaic" />

<genericsetup:registerProfile
name="mosaic"
title="collective.sortedlisting (mosaic)"
directory="profiles/mosaic"
description="Installs the mosaic part of the collective.sortedlisting add-on."
provides="Products.GenericSetup.interfaces.EXTENSION"
post_handler=".setuphandlers.post_install_mosaic"
/>

<plone:tile
name="collective.sortablequerystring.contentlisting"
title="Sortable Content listing"
Expand All @@ -56,6 +67,7 @@
schema=".tile.ISortableContentListingTile"
for="*"
/>
</configure -->

</configure>

</configure>
27 changes: 27 additions & 0 deletions src/collective/sortedlisting/profiles/mosaic/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<registry>
<record name="plone.app.tiles">
<field type="plone.registry.field.List">
<title>Tiles</title>
<value_type type="plone.registry.field.TextLine" />
</field>
<value purge="false">
<element>collective.sortablequerystring.contentlisting</element>
</value>
</record>

<records prefix="plone.app.mosaic.app_tiles.collective.sortablequerystring_contentlisting"
interface="plone.app.mosaic.interfaces.ITile">
<value key="name">collective.sortablequerystring.contentlisting</value>
<value key="label">Sortable Content listing</value>
<value key="category">advanced</value>
<value key="tile_type">app</value>
<value key="default_value"></value>
<value key="read_only">false</value>
<value key="settings">true</value>
<value key="favorite">false</value>
<value key="rich_text">false</value>
<value key="weight">20</value>
</records>

</registry>
17 changes: 17 additions & 0 deletions src/collective/sortedlisting/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
from Products.CMFPlone.interfaces import INonInstallable
from zope.interface import implementer

import pkg_resources


try:
pkg_resources.get_distribution('plone.app.mosaic')
HAS_MOSAIC = True
except pkg_resources.DistributionNotFound: # pragma: no cover
HAS_MOSAIC = False


@implementer(INonInstallable)
class HiddenProfiles(object):
Expand All @@ -16,6 +25,14 @@ def getNonInstallableProfiles(self):
def post_install(context):
"""Post install script"""
# Do something at the end of the installation of this package.
if HAS_MOSAIC:
context.runAllImportStepsFromProfile(
'profile-collective.sortedlisting:mosaic')


def post_install_mosaic(context):
"""Post install script"""
# Do something at the end of the installation of this package.


def uninstall(context):
Expand Down

0 comments on commit 92515fa

Please sign in to comment.