app/soc/templates/soc/templatetags/_as_table_row.html
author Sverre Rabbelier <srabbelier@gmail.com>
Wed, 11 Feb 2009 23:49:44 +0000
changeset 1270 a48a592919b0
parent 1215 b21e40ef8dad
child 1302 54e736a805b5
permissions -rw-r--r--
Fields are always safe, as we generate them ourselves This will be used by a future widget. 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>
1215
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    34
  {% if select_url %}
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    35
    <script type="text/javascript">
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    36
      $.getJSON("{{ select_url }}",
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    37
        function(data){
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    38
          $("#{{ field_id }}").autocomplete(data.data, {
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    39
            matchContains: true,
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    40
            formatItem: function(item) {
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    41
              return item.link_id+" ("+item.name+")";
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    42
            },
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    43
            formatResult: function(item) {
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    44
              return item.link_id;
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    45
            }
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    46
          });
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    47
        }
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    48
      );
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    49
    </script>
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    50
  {% endif %}
1270
a48a592919b0 Fields are always safe, as we generate them ourselves
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1215
diff changeset
    51
    {{ field|safe }}
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    52
  </td>
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    54
  {% if required %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    55
  <td class="formfieldrequired">(required)</td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    56
  {% else %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    57
  <td></td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    58
  {% endif %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    59
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    60
  {% if example_text %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    61
    <td class="formfieldexample">{{ example_text|safe }}</td>
941
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
    62
  {% else %}
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
    63
      <td></td>
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
    64
  {% endif %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65
</tr>