diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee
index 6bbfbacc38234f8e3489016c97fca15db52bfa99..ca8f13f674474736ad0ef49e235d01b5f2726264 100644
--- a/app/assets/javascripts/projects.js.coffee
+++ b/app/assets/javascripts/projects.js.coffee
@@ -1,25 +1,21 @@
-function Projects() { 
-  $("#project_name").live("change", function(){
-    var slug = slugify($(this).val());
-    $("#project_code").val(slug);
-    $("#project_path").val(slug);
-  });
+window.Projects = ->
+  $("#project_name").live "change", ->
+    slug = slugify($(this).val())
+    $("#project_code").val(slug)
+    $("#project_path").val(slug)
 
-  $('.new_project, .edit_project').live('ajax:before', function() {
-    $('.project_new_holder, .project_edit_holder').hide();
-    $('.save-project-loader').show();
-  });
+  $(".new_project, .edit_project").live "ajax:before", ->
+    $(".project_new_holder, .project_edit_holder").hide()
+    $(".save-project-loader").show()
 
-  $('form #project_default_branch').chosen();
+  $("form #project_default_branch").chosen()
+  disableButtonIfEmtpyField "#project_name", ".project-submit"
 
-  disableButtonIfEmtpyField("#project_name", ".project-submit")
-}
-
-function initGitCloneSwitcher() {
-  var link_sel = ".project_clone_holder button";
-  $(link_sel).bind("click", function(e) {
-    $(link_sel).removeClass("active");
-    $(this).addClass("active");
-    $("#project_clone").val($(this).attr("data-clone"));
-  })
-}
+# Git clone panel switcher
+$ ->
+  scope = $('.project_clone_holder')
+  if scope.length > 0
+    $('a, button', scope).click ->
+      $('a, button', scope).removeClass('active')
+      $(this).addClass('active')
+      $('#project_clone', scope).val($(this).data('clone'))
diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml
index d408c0a64aec982209ff101375cf4dbf28a4b043..6ec7015a82e8a5d98d53eb6f96cf0d25686ed0f1 100644
--- a/app/views/projects/empty.html.haml
+++ b/app/views/projects/empty.html.haml
@@ -36,16 +36,3 @@
   - if can? current_user, :admin_project, @project
     .prepend-top-20
       = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger right"
-
-
-
-:javascript
-  $(function(){
-    var link_sel = ".project_clone_holder a";
-    $(link_sel).bind("click", function() {
-      $(link_sel).removeClass("active");
-      $(this).addClass("active");
-      $("#project_clone").val($(this).attr("data-clone"));
-    })
-  })
-
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index de3e9cefc0616056bc2c992417a3f133d3ef620c..21459da256f7b9398f7f2845c8ebb13fba84592e 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -2,8 +2,3 @@
 = render 'clone_panel'
 = render "events/event_last_push", event: @last_push
 .content_list= render @events
-
-:javascript
-  $(function(){
-    initGitCloneSwitcher();
-  })
diff --git a/app/views/refs/_head.html.haml b/app/views/refs/_head.html.haml
index affd07cba38bb2644023437eedb246649ad8d861..d51602de9b7c892129367745912739ad5bd8cbeb 100644
--- a/app/views/refs/_head.html.haml
+++ b/app/views/refs/_head.html.haml
@@ -12,8 +12,3 @@
       %button{class: "btn small active", :"data-clone" => @project.ssh_url_to_repo} SSH
       %button{class: "btn small", :"data-clone" => @project.http_url_to_repo} HTTP
       = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5"
-
-:javascript
-  $(function(){
-    initGitCloneSwitcher();
-  })