limit portlets to 10 elements by default (#4742)

This commit is contained in:
Frédéric Péters 2014-04-28 09:13:03 +02:00
parent feaa906f26
commit 3667095529
2 changed files with 30 additions and 25 deletions

View File

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: pfwbged.collection\n"
"POT-Creation-Date: 2014-03-14 09:38+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"POT-Creation-Date: 2014-04-28 07:24+0000\n"
"PO-Revision-Date: 2014-04-28 09:24+0200\n"
"Last-Translator: Frederic Peters <fpeters@entrouvert.com>\n"
"Language-Team: French\n"
"MIME-Version: 1.0\n"
@ -14,43 +14,43 @@ msgstr ""
"Preferred-Encodings: utf-8 latin1\n"
"Domain: pfwbged.collection\n"
#: ../portlet.py:164
#: ../portlet.py:167
msgid "Add Collection Portlet"
msgstr "Ajouter un portlet de collection"
#: ../searchview.py:312
#: ../searchview.py:323
msgid "Creation Date"
msgstr "Date de création"
#: ../portlet.py:177
#: ../portlet.py:180
msgid "Edit Collection Portlet"
msgstr "Modifier le portlet de collection"
#: ../portlet.py:37
#: ../portlet.py:39
msgid "Find the collection which provides the items to list"
msgstr "Chercher la collection qui fournit les éléments à énumérer; un élément de son titre par exemple."
#: ../searchview.py:170
#: ../searchview.py:174
msgid "Internal Number"
msgstr "Référence interne"
#: ../portlet.py:44
#: ../portlet.py:46
msgid "Limit"
msgstr "Limite"
#: ../portlet.py:31
#: ../portlet.py:33
msgid "Portlet header"
msgstr "Titre"
#: ../searchview.py:332
#: ../searchview.py:343
msgid "Position"
msgstr "Position"
#: ../searchview.py:174
#: ../searchview.py:178
msgid "Recipient(s)"
msgstr "Destinataire(s)"
#: ../searchview.py:66
#: ../searchview.py:67
#: ../templates/collection.pt:29
msgid "Save"
msgstr "Enregistrer"
@ -59,32 +59,34 @@ msgstr "Enregistrer"
msgid "Search Parameters"
msgstr "Paramètres de la recherche"
#: ../searchview.py:172
#: ../searchview.py:176
msgid "Sender"
msgstr "Expéditeur"
#: ../portlet.py:45
msgid "Specify the maximum number of items to show in the portlet. Leave this blank to show all items."
msgstr "Spécifier le nombre maximum d'éléments à afficher dans ce portlet. Laisser ce champs vide pour afficher tous les éléments."
#: ../portlet.py:47
msgid "Specify the maximum number of items to show in the portlet. Leave this blank to show the default numer of items."
msgstr ""
"Spécifier le nombre maximum d'éléments à afficher dans ce portlet. "
"Laisser ce champs vide pour afficher le nombre par défaut d'éléments."
#: ../portlet.py:36
#: ../portlet.py:38
msgid "Target collection"
msgstr "Collection à utiliser"
#: ../portlet.py:165
#: ../portlet.py:168
msgid "This portlet displays a listing of items from a Collection."
msgstr "Ce portlet affiche les éléments d'une collection."
#: ../collection.py:50
#: ../searchview.py:56
#: ../searchview.py:57
msgid "Title"
msgstr "Titre"
#: ../portlet.py:32
#: ../portlet.py:34
msgid "Title of the rendered portlet"
msgstr "Titre du portlet"
#: ../searchview.py:348
#: ../searchview.py:359
msgid "Unfile"
msgstr "Retirer du dossier"

View File

@ -23,6 +23,8 @@ from searchview import QueryBuilder, get_appropriate_table_class
from pfwbged.collection import _
DEFAULT_LIMIT = 10
class ICollectionPortlet(IPortletDataProvider):
"""A portlet which renders the results of a collection object.
"""
@ -43,7 +45,8 @@ class ICollectionPortlet(IPortletDataProvider):
limit = schema.Int(
title=_(u"Limit"),
description=_(u"Specify the maximum number of items to show in the "
u"portlet. Leave this blank to show all items."),
u"portlet. Leave this blank to show the default numer of items."),
default=DEFAULT_LIMIT,
required=False)
@ -58,12 +61,12 @@ class Assignment(base.Assignment):
header = u""
target_collection = None
limit = None
limit = DEFAULT_LIMIT
random = False
show_more = True
show_dates = False
def __init__(self, header=u"", target_collection=None, limit=None,
def __init__(self, header=u"", target_collection=None, limit=DEFAULT_LIMIT,
random=False, show_more=True, show_dates=False):
self.header = header
self.target_collection = target_collection
@ -119,7 +122,7 @@ class Renderer(base.Renderer):
results = query_builder(self.collection().query,
sort_on=self.collection().sort_on,
sort_order=sort_order,
limit=self.data.limit)
limit=self.data.limit or DEFAULT_LIMIT)
return results
@memoize