diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-12 20:08:04 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-12 20:08:04 +0200 |
commit | faf7c79eb2d0c380b692be413953d206f2984b0b (patch) | |
tree | 4a8e524fbbede5ae4c908d473b82131c73eb8940 | |
parent | 4df4b381852ea432659f488aa713aa336e27b89b (diff) | |
download | gitlab-ce-faf7c79eb2d0c380b692be413953d206f2984b0b.tar.gz |
lil js refactoring
-rw-r--r-- | app/assets/javascripts/merge_requests.js | 0 | ||||
-rw-r--r-- | app/assets/javascripts/merge_requests.js.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/projects.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/tree.js | 21 | ||||
-rw-r--r-- | app/views/refs/tree.html.haml | 5 |
5 files changed, 26 insertions, 16 deletions
diff --git a/app/assets/javascripts/merge_requests.js b/app/assets/javascripts/merge_requests.js new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/app/assets/javascripts/merge_requests.js diff --git a/app/assets/javascripts/merge_requests.js.coffee b/app/assets/javascripts/merge_requests.js.coffee deleted file mode 100644 index 761567942fc..00000000000 --- a/app/assets/javascripts/merge_requests.js.coffee +++ /dev/null @@ -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/ diff --git a/app/assets/javascripts/projects.js b/app/assets/javascripts/projects.js index 4ffbd140d6e..7d21f061703 100644 --- a/app/assets/javascripts/projects.js +++ b/app/assets/javascripts/projects.js @@ -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"); diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js new file mode 100644 index 00000000000..6edd7e49c5a --- /dev/null +++ b/app/assets/javascripts/tree.js @@ -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; + } + }); + } +} diff --git a/app/views/refs/tree.html.haml b/app/views/refs/tree.html.haml index e59bbf05ee3..46eeb6f5c29 100644 --- a/app/views/refs/tree.html.haml +++ b/app/views/refs/tree.html.haml @@ -1 +1,6 @@ #tree-holder= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree} + +:javascript + $(function() { + Tree.init(); + }); |