Commit d75cc7eafd980198e6f7484ded56c148ea96479f
Committed by
Sytse Sijbrandij
1 parent
2ff36e74
Exists in
master
and in
4 other branches
Display https as repo clone indicator and prevent modification of web_protocol variable.
Rewrite build_url, use web_protocol for repo indicator. Explicitly initialize custom port to make the logic obvious.
Showing
3 changed files
with
11 additions
and
9 deletions
Show diff stats
app/views/blame/_head.html.haml
@@ -6,5 +6,5 @@ | @@ -6,5 +6,5 @@ | ||
6 | %li.right | 6 | %li.right |
7 | .input-prepend.project_clone_holder | 7 | .input-prepend.project_clone_holder |
8 | %button{class: "btn small active", :"data-clone" => @project.ssh_url_to_repo} SSH | 8 | %button{class: "btn small active", :"data-clone" => @project.ssh_url_to_repo} SSH |
9 | - %button{class: "btn small", :"data-clone" => @project.http_url_to_repo} HTTP | 9 | + %button{class: "btn small", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase |
10 | = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" | 10 | = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" |
app/views/projects/_clone_panel.html.haml
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | .form-horizontal | 4 | .form-horizontal |
5 | .input-prepend.project_clone_holder | 5 | .input-prepend.project_clone_holder |
6 | %button{class: "btn small active", :"data-clone" => @project.ssh_url_to_repo} SSH | 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 | 7 | + %button{class: "btn small", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase |
8 | = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" | 8 | = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" |
9 | .span4.right | 9 | .span4.right |
10 | .right | 10 | .right |
config/initializers/1_settings.rb
@@ -31,15 +31,17 @@ class Settings < Settingslogic | @@ -31,15 +31,17 @@ class Settings < Settingslogic | ||
31 | end | 31 | end |
32 | 32 | ||
33 | def build_url | 33 | def build_url |
34 | - raw_url = self.web_protocol | ||
35 | - raw_url << "://" | ||
36 | - raw_url << web_host | ||
37 | - | ||
38 | if web_custom_port? | 34 | if web_custom_port? |
39 | - raw_url << ":#{web_port}" | 35 | + custom_port = ":#{web_port}" |
36 | + else | ||
37 | + custom_port = nil | ||
40 | end | 38 | end |
41 | - | ||
42 | - raw_url | 39 | + [ |
40 | + web_protocol, | ||
41 | + "://", | ||
42 | + web_host, | ||
43 | + custom_port | ||
44 | + ].join('') | ||
43 | end | 45 | end |
44 | 46 | ||
45 | def ssh_port | 47 | def ssh_port |