Ticket #9165 (new Feature Request)

Opened 3 years ago

Last modified 2 years ago

News, events, and collection portlets that render when empty

Reported by: miguelitosm Owned by:
Priority: minor Milestone: Ongoing
Component: Templates/CSS Keywords: portlets
Cc: hoss

Description

We have content providers that would like there events portlets to display on their homepage, with a message such as 'No events scheduled this week', instead of disappearing entirely.

Adding a empty_display check box, and empty_message text field to Event, News and Collection portlets would allow them to render and appear with a custom message when there are no items to display. The the display when empty option would be to allow users to chose if they want portlets to render even when empty. And the empty message option to enter a custom message or a default 'No items found' message.

The empty_display would be used in the Renderer to define whether the portlet is available. The empty_message would only be used by the portlets template.

Works with preexisting portlets.

Attachments

collection.pt.txt Download (605 bytes) - added by miguelitosm 3 years ago.
suggested changes to collection portlet template
collection.py.txt Download (2.4 KB) - added by miguelitosm 3 years ago.
suggested changes to collection portlet class
events.pt.txt Download (654 bytes) - added by miguelitosm 3 years ago.
suggested changes to events portlet template
events.py.txt Download (1.8 KB) - added by miguelitosm 3 years ago.
suggested changes to events portlet class
news.pt.txt Download (702 bytes) - added by miguelitosm 3 years ago.
suggested changes to news portlet template
news.py.txt Download (1.9 KB) - added by miguelitosm 3 years ago.
suggested changes to news portlet class

Change History

Changed 3 years ago by miguelitosm

suggested changes to collection portlet template

Changed 3 years ago by miguelitosm

suggested changes to collection portlet class

Changed 3 years ago by miguelitosm

suggested changes to events portlet template

Changed 3 years ago by miguelitosm

suggested changes to events portlet class

Changed 3 years ago by miguelitosm

suggested changes to news portlet template

Changed 3 years ago by miguelitosm

suggested changes to news portlet class

comment:1 Changed 3 years ago by kleist

  • Type changed from Bug to Feature Request
  • Component changed from Unknown to Templates/CSS

comment:2 Changed 3 years ago by vincentfretin

Hi, For i18n, you should use a msgid and a default, so instead of:

_(u"If enabled, the portlet will appear, even if no news items exist.")

use:

_("description_empty_display", default=u"If enabled, the portlet will appear, even if no news items exist.")

Please internationalize yours templates, instead of:

<tal:noresults tal:condition="not:view/results">

<span tal:content="view/data/empty_message|string:No items found.">

No Results Display Message

</span>

</tal:noresults>

You should do something like this:

<tal:noresults tal:condition="not:view/results">

<span tal:content="view/data/empty_message|default" i18n:translate="text_no_items_found">

No items found.

</span>

</tal:noresults>

Please see http://dev.plone.org/plone/wiki/TranslationGuidelines for i18n msgid prefix.

comment:3 Changed 3 years ago by hannosch

  • Milestone changed from 3.x to Ongoing

comment:4 Changed 2 years ago by hoss

  • Cc hoss added
Note: See TracTickets for help on using tickets.