Replace BeautyTips tooltips with purr info box for all form fields with help text.
[Melange.git] / app / soc / templates / soc / templatetags / _as_table_row.html
blob9a2a3d9338b88c93bf4977c17fcf535197a3ad1d
1 {% comment %}
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
6 http://www.apache.org/licenses/LICENSE-2.0
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13 {% endcomment %}
15 {% if errors %}
16 <tr>
17 {% block error_td %}
18 <td>&nbsp;</td>
19 <td colspan="3" class="formfielderror">
20 {% endblock error_td %}
21 {% for error in errors %}
22 <span class="formfielderrorlabel">{{ error }}</span> <br />
23 {% endfor %}
24 </td>
25 </tr>
26 {% endif %}
28 {% block label_row %}{% endblock %}
30 <tr>
31 {% block label_column %}
32 <td class="{{ field_class_type }}">
33 {{ label }}
34 </td>
35 {% endblock %}
36 <td class="formfieldvalue">
37 {% if select_url %}
38 <script type="text/javascript">
39 $.getJSON("{{ select_url|safe }}",
40 function(data){
41 $("#{{ field_id }}").autocomplete(data.data, {
42 matchContains: true,
43 formatItem: function(item) {
44 return item.link_id+" ("+item.name+")";
46 formatResult: function(item) {
47 return item.link_id;
49 });
52 </script>
53 {% endif %}
54 {% if help_text %}
55 <script type="text/javascript">
56 $(document).ready( function() {
57 var tooltip = "<div class='tooltip'><div class='tooltip-body'><img src='/soc/content/images/purrInfo.png' alt='' /><h3>Info</h3><p>{{ help_text }}</p></div><div class='tooltip-bottom'></div></div>";
58 var tooltip_object=null;
59 $("#{{ field_id }}").focus(function() {
60 tooltip_object = $(tooltip).purr({usingTransparentPNG: true});
61 });
62 $("#{{ field_id }}").blur(function() {
63 if (tooltip_object!==null) {
64 tooltip_object.remove();
66 });
67 });
68 </script>
69 {% endif %}
70 {{ field|safe }}
71 </td>
73 {% if required %}
74 <td class="formfieldrequired">(required)</td>
75 {% else %}
76 <td></td>
77 {% endif %}
79 {% if example_text %}
80 <td class="formfieldexample">{{ example_text|safe }}</td>
81 {% else %}
82 <td></td>
83 {% endif %}
84 </tr>