# HG changeset patch # User Sverre Rabbelier # Date 1235301466 0 # Node ID ec06d3ee73e4628edb1413c15cc6a9a0fc88e4c3 # Parent 9fd31955cc49d8b4b968260c1ade1cdd468a53f8 Make it possible to display a message when there are no lists Patch by: Sverre Rabbelier diff -r 9fd31955cc49 -r ec06d3ee73e4 app/soc/logic/lists.py --- a/app/soc/logic/lists.py Sun Feb 22 10:55:24 2009 +0000 +++ b/app/soc/logic/lists.py Sun Feb 22 11:17:46 2009 +0000 @@ -108,6 +108,12 @@ return self.get('row') + def empty(self): + """Returns true iff there are no lists + """ + + return not self._lists + def lists(self): """Returns a list of numbers the size of the amount of lists. diff -r 9fd31955cc49 -r ec06d3ee73e4 app/soc/templates/soc/models/list.html --- a/app/soc/templates/soc/models/list.html Sun Feb 22 10:55:24 2009 +0000 +++ b/app/soc/templates/soc/models/list.html Sun Feb 22 11:17:46 2009 +0000 @@ -14,10 +14,12 @@ {% endcomment %} {% load forms_helpers %} {% block body %} +{% if list.empty %} +{{ no_lists_msg }} +{% endif %} {% for _ in list.lists %}

{% include list.nextList %}

{% endfor %} - {% endblock %} diff -r 9fd31955cc49 -r ec06d3ee73e4 app/soc/views/helper/params.py --- a/app/soc/views/helper/params.py Sun Feb 22 10:55:24 2009 +0000 +++ b/app/soc/views/helper/params.py Sun Feb 22 11:17:46 2009 +0000 @@ -235,6 +235,7 @@ } new_params['list_description'] = DEF_LIST_DESCRIPTION_FMT % params + new_params['no_lists_msg'] = "" new_params['save_message'] = [ugettext('%(name)s saved.' % params)] new_params['submit_msg_param_name'] = DEF_SUBMIT_MSG_PARAM_NAME new_params['edit_params'] = { diff -r 9fd31955cc49 -r ec06d3ee73e4 app/soc/views/models/base.py --- a/app/soc/views/models/base.py Sun Feb 22 10:55:24 2009 +0000 +++ b/app/soc/views/models/base.py Sun Feb 22 11:17:46 2009 +0000 @@ -507,6 +507,7 @@ context['entity_type'] = params['name'] context['entity_type_plural'] = params['name_plural'] + context['no_lists_msg'] = params['no_lists_msg'] template = params['list_template']