lil js refactoring
This commit is contained in:
parent
4df4b38185
commit
faf7c79eb2
5 changed files with 26 additions and 16 deletions
0
app/assets/javascripts/merge_requests.js
Normal file
0
app/assets/javascripts/merge_requests.js
Normal file
|
@ -1,3 +0,0 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -1,17 +1,4 @@
|
|||
$(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();
|
||||
link = $(this).find("td.tree-item-file-name a")
|
||||
link.click();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#projects-list .project").live('click', function(e){
|
||||
if(e.target.nodeName != "A" && e.target.nodeName != "INPUT") {
|
||||
location.href = $(this).attr("url");
|
||||
|
|
21
app/assets/javascripts/tree.js
Normal file
21
app/assets/javascripts/tree.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Tree slider for code browse
|
||||
*
|
||||
*/
|
||||
var Tree = {
|
||||
init:
|
||||
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();
|
||||
link = $(this).find("td.tree-item-file-name a");
|
||||
link.click();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1 +1,6 @@
|
|||
#tree-holder= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}
|
||||
|
||||
:javascript
|
||||
$(function() {
|
||||
Tree.init();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue