From d75cc7eafd980198e6f7484ded56c148ea96479f Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 2 Oct 2012 09:54:33 +0200 Subject: [PATCH] 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. --- app/views/blame/_head.html.haml | 2 +- app/views/projects/_clone_panel.html.haml | 2 +- config/initializers/1_settings.rb | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/views/blame/_head.html.haml b/app/views/blame/_head.html.haml index 3b027bdaf18..175719b1199 100644 --- a/app/views/blame/_head.html.haml +++ b/app/views/blame/_head.html.haml @@ -6,5 +6,5 @@ %li.right .input-prepend.project_clone_holder %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 + %button{class: "btn small", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" diff --git a/app/views/projects/_clone_panel.html.haml b/app/views/projects/_clone_panel.html.haml index 20891610ace..4411ff1734b 100644 --- a/app/views/projects/_clone_panel.html.haml +++ b/app/views/projects/_clone_panel.html.haml @@ -4,7 +4,7 @@ .form-horizontal .input-prepend.project_clone_holder %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 + %button{class: "btn small", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" .span4.right .right diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 276707a73af..fb809636557 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -31,15 +31,17 @@ class Settings < Settingslogic end def build_url - raw_url = self.web_protocol - raw_url << "://" - raw_url << web_host - if web_custom_port? - raw_url << ":#{web_port}" + custom_port = ":#{web_port}" + else + custom_port = nil end - - raw_url + [ + web_protocol, + "://", + web_host, + custom_port + ].join('') end def ssh_port