static/js/treelist.js
author Tero Marttila <terom@fixme.fi>
Mon, 10 Jan 2011 17:51:08 +0200
changeset 53 06dad873204d
parent 1 06451697083a
permissions -rw-r--r--
items: use DeleteItemForm for ItemView as well
/**
 * Dynamically expandable tree-form lists
 */

/* Document startup */
function treelist_init () 
{
    $$('.treelist li').each(function (item_li) {
        item_handle = item_li.down('div.item');

        item_handle.on('click', function (event, element) {
            // only target clicks directly in div, not in element inside it
            if (!element.match('div.item'))
                return;

            if (item_li.hasClassName('more'))
                item_li.toggleClassName('open');
        });
    });
}


Event.on(window, 'load', treelist_init);