Changes the list template to use an instruction_text property that sets the text above the list. This makes the create_invite template unneeded. The instruction_text comes in handy when defining special lists.
Patch by: Lennard de Rijk
--- a/app/soc/templates/soc/models/create_invite.html Thu Nov 20 21:06:21 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-{% extends "soc/models/list.html" %}
-{% comment %}
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
-
-{% block instructions %}
-Please use this form to invite someone to become a {{ entity_type }}.
-{% endblock %}
--- a/app/soc/templates/soc/models/list.html Thu Nov 20 21:06:21 2008 +0000
+++ b/app/soc/templates/soc/models/list.html Thu Nov 20 21:08:07 2008 +0000
@@ -17,7 +17,11 @@
<p>
<p>
{% block instructions %}
+{% if instruction_text %}
+{{ instruction_text }}
+{% else %}
List of {{ entity_type_plural }} in Google Open Source Programs.
+{% endif %}
{% endblock %}
</p>
{% include list_main %}
--- a/app/soc/views/models/base.py Thu Nov 20 21:06:21 2008 +0000
+++ b/app/soc/views/models/base.py Thu Nov 20 21:08:07 2008 +0000
@@ -355,6 +355,9 @@
context['entity_type_plural'] = params['name_plural']
context['redirect_action'] = params['list_redirect_action']
+ if 'instruction_text' in params:
+ context['instruction_text'] = params['instruction_text']
+
template = params['list_template']
return helper.responses.respond(request, template, context)
--- a/app/soc/views/models/role.py Thu Nov 20 21:06:21 2008 +0000
+++ b/app/soc/views/models/role.py Thu Nov 20 21:08:07 2008 +0000
@@ -66,6 +66,8 @@
All views that only Role entities have are defined in this subclass.
"""
+
+ DEF_INVITE_INSTRUCTION_TEXT = ugettext_lazy('Please use this form to invite someone to become a %(name)s.')
def __init__(self, original_params=None):
"""
@@ -85,13 +87,14 @@
new_params = {}
- new_params['list_template'] = 'soc/models/create_invite.html'
+ new_params['list_template'] = 'soc/models/list.html'
new_params['list_redirect_action'] = '/request/create/%s/%s' % (
self._params['url_name'], kwargs['link_id'])
new_params['list_redirect_entity'] = self._params['name']
new_params['name'] = self._params['name']
new_params['name_short'] = self._params['name_short']
new_params['name_plural'] = self._params['name_plural']
+ new_params['instruction_text'] = self.DEF_INVITE_INSTRUCTION_TEXT % self._params
params = dicts.merge(params, new_params)