summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects.js
blob: dc13d00607715d777de43d2540df26d1410f9e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$(document).ready(function(){
  $('#tree-slider td.tree-item-file-name a, #tree-breadcrumbs a').live("click", function() {
    history.pushState({ path: this.path }, '', this.href)
  })

  $("#tree-slider tr.tree-item").live('click', function(e){
    if(e.target.nodeName != "A") {
      e.stopPropagation();
      $(this).find("td.tree-item-file-name a").click();
      return false;
    }  
  });

  $("#projects-list .project").live('click', function(e){
    if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") {
      location.href = $(this).attr("url");
      e.stopPropagation();
      return false;
    }
  });

  $("#issues-table .issue").live('click', function(e){
    if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") {
      location.href = $(this).attr("url");
      e.stopPropagation();
      return false;
    }
  });

  $(document).keypress(function(e) {
    if( $(e.target).is(":input") ) return;
    switch(e.which)  {
      case 115:  focusSearch();
        e.preventDefault();
    }
  });
});

function focusSearch() {
  $("#search").focus();
}