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,7 +35,7 @@ $ -> | ||
| 35 | $('a, button', scope).removeClass 'active' | 35 | $('a, button', scope).removeClass 'active' |
| 36 | $(@).addClass 'active' | 36 | $(@).addClass 'active' |
| 37 | $('#project_clone', scope).val $(@).data 'clone' | 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 | # Ref switcher | 40 | # Ref switcher |
| 41 | $('.project-refs-select').on 'change', -> | 41 | $('.project-refs-select').on 'change', -> |
app/assets/stylesheets/sections/projects.scss
| @@ -72,45 +72,33 @@ | @@ -72,45 +72,33 @@ | ||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | .git-clone-holder { | 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 | box-shadow: none; | 82 | box-shadow: none; |
| 85 | padding: 6px 9px; | 83 | padding: 6px 9px; |
| 86 | } | 84 | } |
| 87 | 85 | ||
| 88 | .btn { | 86 | .btn { |
| 89 | - float: left; | ||
| 90 | background: none; | 87 | background: none; |
| 91 | color: #29b; | 88 | color: #29b; |
| 92 | 89 | ||
| 93 | - &:first-child { | ||
| 94 | - @include border-radius-left(4px); | ||
| 95 | - border-left: 0px; | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | &.active { | 90 | &.active { |
| 99 | color: #333; | 91 | color: #333; |
| 100 | font-weight: bold; | 92 | font-weight: bold; |
| 101 | } | 93 | } |
| 102 | } | 94 | } |
| 103 | 95 | ||
| 104 | - input[type="text"] { | 96 | + .form-control { |
| 105 | cursor: auto; | 97 | cursor: auto; |
| 106 | @extend .monospace; | 98 | @extend .monospace; |
| 107 | background: #FAFAFA; | 99 | background: #FAFAFA; |
| 108 | width: 100%; | 100 | width: 100%; |
| 109 | } | 101 | } |
| 110 | - | ||
| 111 | - .protocol-clone { | ||
| 112 | - overflow: hidden; | ||
| 113 | - } | ||
| 114 | } | 102 | } |
| 115 | 103 | ||
| 116 | .project-visibility-level-holder { | 104 | .project-visibility-level-holder { |
app/helpers/projects_helper.rb
| @@ -180,8 +180,9 @@ module ProjectsHelper | @@ -180,8 +180,9 @@ module ProjectsHelper | ||
| 180 | title | 180 | title |
| 181 | end | 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 | end | 186 | end |
| 186 | 187 | ||
| 187 | def default_clone_protocol | 188 | def default_clone_protocol |
app/views/projects/_home_panel.html.haml
| @@ -11,8 +11,7 @@ | @@ -11,8 +11,7 @@ | ||
| 11 | - unless empty_repo | 11 | - unless empty_repo |
| 12 | .project-home-dropdown | 12 | .project-home-dropdown |
| 13 | = render "dropdown" | 13 | = render "dropdown" |
| 14 | - .form-horizontal | ||
| 15 | - = render "shared/clone_panel" | 14 | + = render "shared/clone_panel" |
| 16 | 15 | ||
| 17 | .project-home-extra.row | 16 | .project-home-extra.row |
| 18 | .col-md-8 | 17 | .col-md-8 |
app/views/projects/empty.html.haml
| @@ -29,8 +29,7 @@ | @@ -29,8 +29,7 @@ | ||
| 29 | touch README | 29 | touch README |
| 30 | git add README | 30 | git add README |
| 31 | git commit -m 'first commit' | 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 | git push -u origin master | 33 | git push -u origin master |
| 35 | 34 | ||
| 36 | %fieldset | 35 | %fieldset |
| @@ -38,8 +37,7 @@ | @@ -38,8 +37,7 @@ | ||
| 38 | %pre.dark | 37 | %pre.dark |
| 39 | :preserve | 38 | :preserve |
| 40 | cd existing_git_repo | 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 | git push -u origin master | 41 | git push -u origin master |
| 44 | 42 | ||
| 45 | - if can? current_user, :remove_project, @project | 43 | - if can? current_user, :remove_project, @project |
app/views/projects/wikis/git_access.html.haml
| 1 | = render 'nav' | 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 | .git-empty | 11 | .git-empty |
| 13 | %fieldset | 12 | %fieldset |
| @@ -19,7 +18,7 @@ | @@ -19,7 +18,7 @@ | ||
| 19 | %legend Clone Your Wiki: | 18 | %legend Clone Your Wiki: |
| 20 | %pre.dark | 19 | %pre.dark |
| 21 | :preserve | 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 | cd #{@gollum_wiki.path} | 22 | cd #{@gollum_wiki.path} |
| 24 | 23 | ||
| 25 | %legend Start Gollum And Edit Locally: | 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 |