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

View File

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