static/js/treelist.js
author Tero Marttila <terom@fixme.fi>
Thu, 20 Jan 2011 23:14:07 +0200
changeset 58 4f4150296cd3
parent 1 06451697083a
permissions -rw-r--r--
controllers: tidy up PageHandler a little
/**
 * 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);