Commit f557686eb2d432f794addbc052331d5d8f0be400

Authored by randx
1 parent 8ca0b75d

git clone panel available on files tab too

app/assets/javascripts/projects.js
... ... @@ -14,3 +14,12 @@ function Projects() {
14 14  
15 15 disableButtonIfEmtpyField("#project_name", ".project-submit")
16 16 }
  17 +
  18 +function initGitCloneSwitcher() {
  19 + var link_sel = ".project_clone_holder button";
  20 + $(link_sel).bind("click", function(e) {
  21 + $(link_sel).removeClass("active");
  22 + $(this).addClass("active");
  23 + $("#project_clone").val($(this).attr("data-clone"));
  24 + })
  25 +}
... ...
app/assets/stylesheets/gitlab_bootstrap/blocks.scss
1 1 /**
2 2 * ===================================
3   - * Contain 3 main UI block elements:
  3 + * Contain 3 main UI block elements:
4 4 * .main_box - for show pages
5 5 * .ui-box - for simple block & widgets
6 6 * ===================================
... ...
app/assets/stylesheets/sections/projects.scss
... ... @@ -75,17 +75,21 @@
75 75 padding: 4px 7px;
76 76 border: 1px solid #CCC;
77 77 margin-bottom:5px;
78   - input[type=text] {
  78 +}
  79 +
  80 +.project_clone_holder {
  81 + input[type="text"] {
79 82 border: 1px solid #BBB;
  83 + box-shadow: none;
80 84 }
81 85 }
82 86  
83   -.save-project-loader {
84   - img {
  87 +.save-project-loader {
  88 + img {
85 89 margin-top:50px;
86 90 margin-bottom:50px;
87 91 }
88   - h3 {
  92 + h3 {
89 93 @extend .page_title;
90 94 }
91 95  
... ...
app/views/projects/_clone_panel.html.haml
... ... @@ -3,8 +3,8 @@
3 3 .span7
4 4 .form-horizontal
5 5 .input-prepend.project_clone_holder
6   - = link_to "SSH", "#", class: "btn small active", :"data-clone" => @project.ssh_url_to_repo
7   - = link_to "HTTP", "#", class: "btn small", :"data-clone" => @project.http_url_to_repo
  6 + %button{class: "btn small active", :"data-clone" => @project.ssh_url_to_repo} SSH
  7 + %button{class: "btn small", :"data-clone" => @project.http_url_to_repo} HTTP
8 8 = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5"
9 9 .span4.right
10 10 .right
... ...
app/views/projects/show.html.haml
... ... @@ -5,10 +5,5 @@
5 5  
6 6 :javascript
7 7 $(function(){
8   - var link_sel = ".project_clone_holder a";
9   - $(link_sel).bind("click", function() {
10   - $(link_sel).removeClass("active");
11   - $(this).addClass("active");
12   - $("#project_clone").val($(this).attr("data-clone"));
13   - })
  8 + initGitCloneSwitcher();
14 9 })
... ...
app/views/refs/_head.html.haml
... ... @@ -7,4 +7,13 @@
7 7 %li{class: "#{'active' if (controller.controller_name == "refs") }"}
8 8 = link_to tree_project_ref_path(@project, @ref) do
9 9 Source
  10 + %li.right
  11 + .input-prepend.project_clone_holder
  12 + %button{class: "btn small active", :"data-clone" => @project.ssh_url_to_repo} SSH
  13 + %button{class: "btn small", :"data-clone" => @project.http_url_to_repo} HTTP
  14 + = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5"
10 15  
  16 +:javascript
  17 + $(function(){
  18 + initGitCloneSwitcher();
  19 + })
... ...
app/views/refs/tree.js.haml
... ... @@ -6,5 +6,5 @@
6 6  
7 7 // Load last commit log for each file in tree
8 8 $('#tree-slider').waitForImages(function() {
9   - ajaxGet('#{@logs_path}');
  9 + ajaxGet('#{@logs_path}');
10 10 });
... ...