Commit 04baf0b569a84430cb8c366594b82a72a4ff73b6
1 parent
3c7a8064
Exists in
spb-stable
and in
3 other branches
Update clone panel to use input group.
Use clone panel in `Git Access` section of wiki.
Showing
7 changed files
with
29 additions
and
44 deletions
Show diff stats
app/assets/javascripts/project.js.coffee
... | ... | @@ -35,7 +35,7 @@ $ -> |
35 | 35 | $('a, button', scope).removeClass 'active' |
36 | 36 | $(@).addClass 'active' |
37 | 37 | $('#project_clone', scope).val $(@).data 'clone' |
38 | - $(".clone").text("").append 'git remote add origin ' + $(@).data 'clone' | |
38 | + $(".clone").text("").append $(@).data 'clone' | |
39 | 39 | |
40 | 40 | # Ref switcher |
41 | 41 | $('.project-refs-select').on 'change', -> | ... | ... |
app/assets/stylesheets/sections/projects.scss
... | ... | @@ -72,45 +72,33 @@ |
72 | 72 | } |
73 | 73 | |
74 | 74 | .git-clone-holder { |
75 | - margin-right: 45px; | |
76 | - border: 1px solid #E1E1E1; | |
77 | - @include border-radius(4px); | |
78 | - | |
79 | - input[type="text"], | |
80 | - .btn { | |
81 | - border: none; | |
82 | - @include border-radius(0px); | |
83 | - border-left: 1px solid #E1E1E1; | |
75 | + .project-home-dropdown + & { | |
76 | + margin-right: 45px; | |
77 | + } | |
78 | + | |
79 | + .btn, | |
80 | + .form-control { | |
81 | + border: 1px solid #E1E1E1; | |
84 | 82 | box-shadow: none; |
85 | 83 | padding: 6px 9px; |
86 | 84 | } |
87 | 85 | |
88 | 86 | .btn { |
89 | - float: left; | |
90 | 87 | background: none; |
91 | 88 | color: #29b; |
92 | 89 | |
93 | - &:first-child { | |
94 | - @include border-radius-left(4px); | |
95 | - border-left: 0px; | |
96 | - } | |
97 | - | |
98 | 90 | &.active { |
99 | 91 | color: #333; |
100 | 92 | font-weight: bold; |
101 | 93 | } |
102 | 94 | } |
103 | 95 | |
104 | - input[type="text"] { | |
96 | + .form-control { | |
105 | 97 | cursor: auto; |
106 | 98 | @extend .monospace; |
107 | 99 | background: #FAFAFA; |
108 | 100 | width: 100%; |
109 | 101 | } |
110 | - | |
111 | - .protocol-clone { | |
112 | - overflow: hidden; | |
113 | - } | |
114 | 102 | } |
115 | 103 | |
116 | 104 | .project-visibility-level-holder { | ... | ... |
app/helpers/projects_helper.rb
... | ... | @@ -180,8 +180,9 @@ module ProjectsHelper |
180 | 180 | title |
181 | 181 | end |
182 | 182 | |
183 | - def default_url_to_repo | |
184 | - current_user ? @project.url_to_repo : @project.http_url_to_repo | |
183 | + def default_url_to_repo(project = nil) | |
184 | + project = project || @project | |
185 | + current_user ? project.url_to_repo : project.http_url_to_repo | |
185 | 186 | end |
186 | 187 | |
187 | 188 | def default_clone_protocol | ... | ... |
app/views/projects/_home_panel.html.haml
app/views/projects/empty.html.haml
... | ... | @@ -29,8 +29,7 @@ |
29 | 29 | touch README |
30 | 30 | git add README |
31 | 31 | git commit -m 'first commit' |
32 | - %span.clone= "git remote add origin #{default_url_to_repo}" | |
33 | - :preserve | |
32 | + git remote add origin #{ content_tag(:span, default_url_to_repo, class: 'clone')} | |
34 | 33 | git push -u origin master |
35 | 34 | |
36 | 35 | %fieldset |
... | ... | @@ -38,8 +37,7 @@ |
38 | 37 | %pre.dark |
39 | 38 | :preserve |
40 | 39 | cd existing_git_repo |
41 | - %span.clone= "git remote add origin #{default_url_to_repo}" | |
42 | - :preserve | |
40 | + git remote add origin #{ content_tag(:span, default_url_to_repo, class: 'clone')} | |
43 | 41 | git push -u origin master |
44 | 42 | |
45 | 43 | - if can? current_user, :remove_project, @project | ... | ... |
app/views/projects/wikis/git_access.html.haml
1 | 1 | = render 'nav' |
2 | -%h3.page-title | |
3 | - Git access for | |
4 | - %strong= @gollum_wiki.path_with_namespace | |
2 | +.row | |
3 | + .col-sm-6 | |
4 | + %h3.page-title | |
5 | + Git access for | |
6 | + %strong= @gollum_wiki.path_with_namespace | |
5 | 7 | |
6 | - .form-horizontal.pull-right | |
7 | - .git-clone-holder | |
8 | - %button{class: "btn active", :"data-clone" => @gollum_wiki.ssh_url_to_repo} SSH | |
9 | - %button{class: "btn", :"data-clone" => @gollum_wiki.http_url_to_repo}= gitlab_config.protocol.upcase | |
10 | - = text_field_tag :project_clone, @gollum_wiki.url_to_repo, class: "one_click_select form-control", readonly: true | |
8 | + .col-sm-6 | |
9 | + = render "shared/clone_panel", project: @gollum_wiki | |
11 | 10 | |
12 | 11 | .git-empty |
13 | 12 | %fieldset |
... | ... | @@ -19,7 +18,7 @@ |
19 | 18 | %legend Clone Your Wiki: |
20 | 19 | %pre.dark |
21 | 20 | :preserve |
22 | - git clone #{@gollum_wiki.ssh_url_to_repo} | |
21 | + git clone #{ content_tag(:span, default_url_to_repo(@gollum_wiki), class: 'clone')} | |
23 | 22 | cd #{@gollum_wiki.path} |
24 | 23 | |
25 | 24 | %legend Start Gollum And Edit Locally: | ... | ... |
app/views/shared/_clone_panel.html.haml
1 | -.git-clone-holder | |
2 | - .protocol-btns | |
3 | - %button{class: "btn #{ 'active' if default_clone_protocol == 'ssh' }", :"data-clone" => @project.ssh_url_to_repo} SSH | |
4 | - %button{class: "btn #{ 'active' if default_clone_protocol == 'http' }", :"data-clone" => @project.http_url_to_repo}= gitlab_config.protocol.upcase | |
5 | - .protocol-clone | |
6 | - = text_field_tag :project_clone, default_url_to_repo, class: "one_click_select span4", readonly: true | |
1 | +- project = project || @project | |
2 | +.git-clone-holder.input-group | |
3 | + .input-group-btn | |
4 | + %button{class: "btn #{ 'active' if default_clone_protocol == 'ssh' }", :"data-clone" => project.ssh_url_to_repo} SSH | |
5 | + %button{class: "btn #{ 'active' if default_clone_protocol == 'http' }", :"data-clone" => project.http_url_to_repo}= gitlab_config.protocol.upcase | |
6 | + = text_field_tag :project_clone, default_url_to_repo(project), class: "one_click_select form-control", readonly: true | ... | ... |