summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@0d.be>2011-12-05 09:46:16 (GMT)
committerFrédéric Péters <fpeters@0d.be>2011-12-05 09:46:16 (GMT)
commit0cecbc5f44069875ceea6ffa49f2926bdeb5161a (patch)
tree508b3bf93cff72fc70f733080f14b39b0c5a6a3d
parent1b0c6e819358318133cca854f9e5bb1083bcf5a3 (diff)
downloadtabellio.searchform-0cecbc5f44069875ceea6ffa49f2926bdeb5161a.zip
tabellio.searchform-0cecbc5f44069875ceea6ffa49f2926bdeb5161a.tar.gz
tabellio.searchform-0cecbc5f44069875ceea6ffa49f2926bdeb5161a.tar.bz2
reuse common droppable js code in advanced search
-rw-r--r--tabellio/searchform/advsearch-pfb.pt32
1 files changed, 1 insertions, 31 deletions
diff --git a/tabellio/searchform/advsearch-pfb.pt b/tabellio/searchform/advsearch-pfb.pt
index 9ba22b4..53966d0 100644
--- a/tabellio/searchform/advsearch-pfb.pt
+++ b/tabellio/searchform/advsearch-pfb.pt
@@ -47,36 +47,9 @@
<script type="text/javascript" tal:content="string: var PORTAL_URL='${view/portal_url}';"/>
<script metal:use-macro="view/js_macros/macros/labelboxes"></script>
+<script metal:use-macro="view/js_macros/macros/droppablecheckboxes"></script>
<script type="text/javascript">
-function sync_from_checkboxes(elem, dummyinput)
-{
- t = '';
- $(elem).find('span.option').each(function(idx, el) {
- if ($(el).find('input').attr('checked')) {
- if (t.length > 0) {
- t = t + ', ';
- }
- t = t + $(el).find('label span').text();
- }
- });
- $(dummyinput).attr('value', t);
-}
-
-function setup_appearance(index, elem)
-{
- var dummyinput = $('<input type="text" readonly="readonly"/>');
- sync_from_checkboxes(elem, dummyinput);
- dummyinput.click(function() {
- $(elem).find('div.droppedcheckboxes').toggle();
- });
- $(elem).find('.fieldErrorBox').after(dummyinput);
- $(elem).find('span.option').wrapAll('<div class="droppedcheckboxes">').click(function() {
- sync_from_checkboxes(elem, dummyinput);
- });
- $(elem).find('div.droppedcheckboxes').hide();
-}
-
function setup_sort_on(index, elem)
{
$(elem).find('label.horizontal').click(function() {
@@ -88,9 +61,6 @@ function setup_sort_on(index, elem)
(function($) {
$().ready(function() {
- $('#formfield-document-widgets-l_doctypes').each(setup_appearance);
- $('#formfield-document-widgets-l_topics').each(setup_appearance);
- $('#formfield-document-widgets-l_polgroups').each(setup_appearance);
$('#formfield-document-widgets-sort_on').hide();
$('select.date-field').each(function() {
$(this).parent().contents().filter(function() {