Sha256: 09e837cb71c34da1b6916ea31cfc4c67840d16a91195a0dedc4c228648e2cf00

Contents?: true

Size: 1.7 KB

Versions: 7

Compression:

Stored size: 1.7 KB

Contents

Whoops = {
  setupFilters: function() {
    function checkboxBehavior(afterChecked) {
      if (afterChecked === undefined) {
        afterChecked = function(){}
      }
      
      return function(i, list){
        var all = $($(list).find("input").get(0));
        var allowedValues = $(list).find("input").slice(1);
        var form = $(this).parents("form");
        
        all.change(function(event){
          if ($(this).attr("checked")) {
            allowedValues.attr("checked", false);
            afterChecked(form);
          } else {
            $(this).attr("checked", true);
          }
        })

        $(allowedValues).change(function(event){
          if ($(this).attr("checked")) {
            all.attr("checked", false);
          }
          afterChecked(form);
        })
      }
    }

    $("#new_whoops_filter ul").each(checkboxBehavior(function(form){form.submit()}));
    $("#new-notification-rule .filters ul").each(checkboxBehavior());
    
    $("#reset").click(function(){
      window.location = window.location.pathname
      return false
    })
  },
  
  setupEventLinks: function() {
    $("#instances a").click(function(){
      $(".selected").removeClass("selected")
      $(this).parents("li").addClass("selected")
      $.get(this.href,function(data){
        $("#event-details").html(data)
      }, 'html')
      return false;
    })
  },
  
  setupInfo: function() {
    $(".info-revealer").click(function() {
      $(".info").toggle(300)
    })
  },
  
  setup: function() {
    this.setupFilters();
    this.setupEventLinks();
    this.setupInfo();
  }
}

$(function(){
  Whoops.setup();
})

jQuery.ajaxSetup({ 
  beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
})

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
whoops-0.5.5 app/assets/javascripts/whoops.js
whoops-0.5.4 app/assets/javascripts/whoops.js
whoops-0.5.3 app/assets/javascripts/whoops.js
whoops-0.5.2 app/assets/javascripts/whoops.js
whoops-0.5.1 app/assets/javascripts/whoops.js
whoops-0.5.0 app/assets/javascripts/whoops.js
whoops-0.4.0 app/assets/javascripts/whoops.js