reuse common droppable js code in advanced search
This commit is contained in:
parent
1b0c6e8193
commit
0cecbc5f44
|
@ -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() {
|
||||
|
|
Reference in New Issue