Skip to content

Instantly share code, notes, and snippets.

@jjdelc
Created May 22, 2011 08:56
Show Gist options
  • Select an option

  • Save jjdelc/985283 to your computer and use it in GitHub Desktop.

Select an option

Save jjdelc/985283 to your computer and use it in GitHub Desktop.

Revisions

  1. jjdelc created this gist May 22, 2011.
    25 changes: 25 additions & 0 deletions list_filter_collapse.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    ;(function($){
    ListFilterCollapsePrototype = {
    bindToggle: function(){
    var that = this;
    this.$filterEl.click(function(){
    that.$filterList.slideToggle();
    });
    },
    init: function(filterEl) {
    this.$filterEl = $(filterEl).css('cursor', 'pointer');
    this.$filterList = this.$filterEl.next('ul').hide();
    this.bindToggle();
    }
    }
    function ListFilterCollapse(filterEl) {
    this.init(filterEl);
    }
    ListFilterCollapse.prototype = ListFilterCollapsePrototype;

    $(document).ready(function(){
    $('#changelist-filter').children('h3').each(function(){
    var collapser = new ListFilterCollapse(this);
    });
    });
    })(django.jQuery);