app/soc/templates/soc/templatetags/_as_table_row.html
author Sverre Rabbelier <srabbelier@gmail.com>
Fri, 23 Jan 2009 21:20:33 +0000
changeset 935 09f47e08f805
parent 926 390c8a98cdd0
child 941 6eac584ce14c
permissions -rw-r--r--
Adust the as_table tag to render a pick link if appropriate The templates are adjusted to pass on a 'reference' value, which is the url_name of the view from which the entity should be picked. The as_table (and related) function(s) construct and then pass on this argument and enable takes_contex so that we have access to the context of the enclosing template. We only extract ReferenceProperties that end with '_link_id' since that is how all RP's are currently named. It is not possible to create a field with the same name as the RP, as GAE will try to interpret it's contents as the key of an entity before even calling any function we can override. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
{% comment %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
Licensed under the Apache License, Version 2.0 (the "License");
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
you may not use this file except in compliance with the License.
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
You may obtain a copy of the License at
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
  http://www.apache.org/licenses/LICENSE-2.0
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
Unless required by applicable law or agreed to in writing, software
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
distributed under the License is distributed on an "AS IS" BASIS,
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
See the License for the specific language governing permissions and
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
limitations under the License.
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
{% endcomment %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
{% if errors %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
<tr>
861
f7b5838094d0 Give error messages more room in the existing form field "as_table" templates.
Todd Larsen <tlarsen@google.com>
parents: 849
diff changeset
    17
  <td colspan="4" class="formfielderror">
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
  {% for error in errors %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
    <span class="formfielderrorlabel">{{ error }}</span> <br />
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
  {% endfor %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  </td>
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
</tr>
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
{% endif %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
785
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    25
{% block label_row %}{% endblock %}
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    26
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
<tr title="{{ help_text }}">
785
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    28
  {% block label_column %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
  <td class="{{ field_class_type }}">
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
    {{ label }}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
  </td>
785
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    32
  {% endblock %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
  <td>
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
    {{ field }}
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    35
  </td>
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    37
  {% if required %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    38
  <td class="formfieldrequired">(required)</td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    39
  {% else %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    40
  <td></td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    41
  {% endif %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    42
935
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    43
  {% if select_url %}
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    44
  <td><a href="{{ select_url }}">select</a></td>
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    45
  {% comment %} no else branch, as example_text will take care of the last <td></td> {% endcomment %}
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    46
  {% endif %}
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    47
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    48
  {% if example_text %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    49
    <td class="formfieldexample">{{ example_text|safe }}</td>
935
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    50
  {% else %} {% if not select_url %}
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    51
    <td></td>
935
09f47e08f805 Adust the as_table tag to render a pick link if appropriate
Sverre Rabbelier <srabbelier@gmail.com>
parents: 926
diff changeset
    52
  {% endif %} {% endif %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
</tr>