app/soc/templates/soc/templatetags/_as_table_row.html
author Mario Ferraro <fadinlight@gmail.com>
Wed, 15 Jul 2009 17:11:17 +0200
changeset 2661 03fcd4812eaa
parent 2575 e319fd52cbc4
permissions -rw-r--r--
Fixed line length.
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
2295
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
    30
<tr>
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 %}
2295
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
    54
  {% if help_text %}
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
    55
  <script type="text/javascript">
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
    56
  $(document).ready( function() {
2661
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    57
    var tooltip = [
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    58
      "<div class='tooltip'>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    59
      "  <div class='tooltip-body'>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    60
      "    <img src='/soc/content/images/purrInfo.png' alt='' />",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    61
      "    <h3>Info</h3>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    62
      "    <p>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    63
      "      {% autoescape off %}",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    64
      "        {{ help_text|linebreaksbr|escapejs }}",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    65
      "      {% endautoescape %}",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    66
      "    </p>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    67
      "  </div>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    68
      "  <div class='tooltip-bottom'></div>",
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    69
      "</div>"
03fcd4812eaa Fixed line length.
Mario Ferraro <fadinlight@gmail.com>
parents: 2575
diff changeset
    70
    ].join("");
2295
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
    71
    var tooltip_object=null;
2419
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    72
    var documented = $("#{{ field_id }}");
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    73
    var not_fieldset = documented.attr('tagName') !== 'FIELDSET';
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    74
    if (not_fieldset) {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    75
      documented.focus(function() {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    76
        if (tooltip_object==null) {
2575
e319fd52cbc4 Extended tooltip timeout to 10 seconds for all fields.
Mario Ferraro <fadinlight@gmail.com>
parents: 2561
diff changeset
    77
          tooltip_object = $(tooltip).purr({usingTransparentPNG: true,removeTimer: 10000});
2419
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    78
        }
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    79
      });
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    80
      documented.blur(function() {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    81
        if (tooltip_object!==null) {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    82
          tooltip_object.remove();
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    83
          tooltip_object=null;
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    84
        }
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    85
      });
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    86
    }
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    87
    else {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    88
      documented.find("input").hover(function() {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    89
        if (tooltip_object==null) {
2575
e319fd52cbc4 Extended tooltip timeout to 10 seconds for all fields.
Mario Ferraro <fadinlight@gmail.com>
parents: 2561
diff changeset
    90
          tooltip_object = $(tooltip).purr({usingTransparentPNG: true,removeTimer: 10000});
2419
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    91
        }
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    92
      },
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    93
      function() {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    94
        if (tooltip_object!==null) {
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    95
          tooltip_object.remove();
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    96
          tooltip_object=null;
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    97
        }
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    98
      });
82ce842da661 Patch that touches 'upstream' templates, for use in surveys.
Daniel Diniz <ajaksu@gmail.com>
parents: 2300
diff changeset
    99
    }
2295
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
   100
  });
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
   101
  </script>
8566fb2b8012 Replace BeautyTips tooltips with purr info box for all form fields with help text.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1819
diff changeset
   102
  {% endif %}
1270
a48a592919b0 Fields are always safe, as we generate them ourselves
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1215
diff changeset
   103
    {{ field|safe }}
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   104
  </td>
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   105
924
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   106
  {% if required %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   107
  <td class="formfieldrequired">(required)</td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   108
  {% else %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   109
  <td></td>
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   110
  {% endif %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   111
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   112
  {% if example_text %}
34f944dc4502 Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents: 861
diff changeset
   113
    <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
   114
  {% else %}
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
   115
      <td></td>
6eac584ce14c Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents: 935
diff changeset
   116
  {% endif %}
741
2dc2c65c5f76 Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   117
</tr>