# HG changeset patch # User Sverre Rabbelier # Date 1233788808 0 # Node ID b21e40ef8dade0b721c3e90de8dc9d8ef68f7452 # Parent 7fb705534dd1c7f188aa7daad98bf12fb2c3f5c3 Hook up the new jquery plugins in base.html and _as_table_row.html A very important todo here is to make loading these plugins only when needed, as to not waste bandwith. This should be trivial to do later on though, so leaving as-is now. Patch by: "Mario Ferraro" Reviewed by: Sverre Rabbelier diff -r 7fb705534dd1 -r b21e40ef8dad app/soc/templates/soc/base.html --- a/app/soc/templates/soc/base.html Wed Feb 04 23:04:10 2009 +0000 +++ b/app/soc/templates/soc/base.html Wed Feb 04 23:06:48 2009 +0000 @@ -17,6 +17,8 @@ {% block stylesheet %} + + {% endblock %} {% block page_title %} @@ -31,6 +33,10 @@ <script src="/jquery/jquery-bt-0.7.js"></script> <script src="/soc/content/js/menu-081108.js"></script> <script src="/soc/content/js/tips-081027.js"></script> + <script type='text/javascript' src='/jquery/jquery.bgiframe.js'></script> + <script type='text/javascript' src='/jquery/jquery.ajaxQueue.js'></script> + <script type='text/javascript' src='/jquery/jquery.autocomplete.js'></script> + <script type='text/javascript' src='/jquery/jquery-thickbox.js'></script> {% block scripts %}{% endblock %} </head> {% block body_tag %} diff -r 7fb705534dd1 -r b21e40ef8dad app/soc/templates/soc/templatetags/_as_table_row.html --- a/app/soc/templates/soc/templatetags/_as_table_row.html Wed Feb 04 23:04:10 2009 +0000 +++ b/app/soc/templates/soc/templatetags/_as_table_row.html Wed Feb 04 23:06:48 2009 +0000 @@ -31,6 +31,23 @@ </td> {% endblock %} <td> + {% if select_url %} + <script type="text/javascript"> + $.getJSON("{{ select_url }}", + function(data){ + $("#{{ field_id }}").autocomplete(data.data, { + matchContains: true, + formatItem: function(item) { + return item.link_id+" ("+item.name+")"; + }, + formatResult: function(item) { + return item.link_id; + } + }); + } + ); + </script> + {% endif %} {{ field }} </td> @@ -40,19 +57,9 @@ <td></td> {% endif %} - {% if select_url %} - <td><input type="button" onclick="location.href='{{ select_url }}'" value="Select"/></td> - {% else %} - <td></td> - {% endif %} - {% if example_text %} <td class="formfieldexample">{{ example_text|safe }}</td> {% else %} - {% if select_url %} - <td class="warning">(discards unsaved changes)</td> - {% else %} <td></td> - {% endif %} {% endif %} </tr>