author | Pawel Solyga <Pawel.Solyga@gmail.com> |
Mon, 04 May 2009 19:23:44 +0200 | |
changeset 2295 | 8566fb2b8012 |
parent 1819 | 1e34fa8c5da0 |
child 2300 | b9fd1e20d413 |
permissions | -rw-r--r-- |
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> </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() { |
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
|
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>"; |
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
|
58 |
var tooltip_object=null; |
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
|
59 |
$("#{{ field_id }}").focus(function() { |
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
|
60 |
tooltip_object = $(tooltip).purr({usingTransparentPNG: true}); |
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
|
61 |
}); |
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
|
62 |
$("#{{ field_id }}").blur(function() { |
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
|
63 |
if (tooltip_object!==null) { |
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
|
64 |
tooltip_object.remove(); |
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
|
65 |
} |
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
|
66 |
}); |
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
|
67 |
}); |
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
|
68 |
</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
|
69 |
{% endif %} |
1270
a48a592919b0
Fields are always safe, as we generate them ourselves
Sverre Rabbelier <srabbelier@gmail.com>
parents:
1215
diff
changeset
|
70 |
{{ field|safe }} |
924
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
71 |
</td> |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
72 |
|
924
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
73 |
{% if required %} |
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
74 |
<td class="formfieldrequired">(required)</td> |
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
75 |
{% else %} |
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
76 |
<td></td> |
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
77 |
{% endif %} |
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
78 |
|
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
79 |
{% if example_text %} |
34f944dc4502
Generate proper html instead of having nested <td> tags
Sverre Rabbelier <srabbelier@gmail.com>
parents:
861
diff
changeset
|
80 |
<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
|
81 |
{% else %} |
6eac584ce14c
Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents:
935
diff
changeset
|
82 |
<td></td> |
6eac584ce14c
Add a warning about discarding unsaved changes
Sverre Rabbelier <srabbelier@gmail.com>
parents:
935
diff
changeset
|
83 |
{% endif %} |
741
2dc2c65c5f76
Converted as_table to be a template tag
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff
changeset
|
84 |
</tr> |