app/soc/templates/soc/templatetags/_as_table_row.html
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 12 Mar 2009 23:04:53 +0000
changeset 1819 1e34fa8c5da0
parent 1369 0be1f471413c
child 2295 8566fb2b8012
permissions -rw-r--r--
Make the error message align with the input field 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>
1819
1e34fa8c5da0 Make the error message align with the input field
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1369
diff changeset
    17
  {% block error_td %}
1e34fa8c5da0 Make the error message align with the input field
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1369
diff changeset
    18
  <td>&nbsp;</td>
1e34fa8c5da0 Make the error message align with the input field
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1369
diff changeset
    19
  <td colspan="3" class="formfielderror">
1e34fa8c5da0 Make the error message align with the input field
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1369
diff changeset
    20
  {% endblock error_td %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  {% for error in errors %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
    <span class="formfielderrorlabel">{{ error }}</span> <br />
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
  {% endfor %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
  </td>
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
</tr>
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
{% endif %}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
785
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    28
{% block label_row %}{% endblock %}
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    29
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
<tr title="{{ help_text }}">
785
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    31
  {% block label_column %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
  <td class="{{ field_class_type }}">
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
    {{ label }}
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
  </td>
785
c740d0129cce Added a twoline_edit.html page
Sverre Rabbelier <srabbelier@gmail.com>
parents: 741
diff changeset
    35
  {% endblock %}
1369
0be1f471413c Make the web forms look a little nicer.
Tim Ansell <mithro@gmail.com>
parents: 1302
diff changeset
    36
  <td class="formfieldvalue">
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
    37
  {% 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
    38
    <script type="text/javascript">
1302
54e736a805b5 We generate the select url ourselves, so it's safe
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1270
diff changeset
    39
      $.getJSON("{{ select_url|safe }}",
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
    40
        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
    41
          $("#{{ 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
    42
            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
    43
            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
    44
              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
    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
            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
    47
              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
    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
          });
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
        }
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    51
      );
b21e40ef8dad Hook up the new jquery plugins in base.html and _as_table_row.html
Sverre Rabbelier <srabbelier@gmail.com>
parents: 956
diff changeset
    52
    </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
    53
  {% endif %}
1270
a48a592919b0 Fields are always safe, as we generate them ourselves
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1215
diff changeset
    54
    {{ field|safe }}
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    55
  </td>
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    57
  {% if required %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    58
  <td class="formfieldrequired">(required)</td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    59
  {% else %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    60
  <td></td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    61
  {% endif %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    62
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    63
  {% if example_text %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
    64
    <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
    65
  {% else %}
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
    66
      <td></td>
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
    67
  {% endif %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    68
</tr>