Commit 9393809066c10d1568e75372a8c99c3a67bed489

Authored by Bruno Albuquerque
1 parent 02822f74

Use project methods instead of attributes.

- This should work correctly in all cases now.
- Added a new project method that returns the web url for a project without
  the scheme prefix.
app/models/project.rb
... ... @@ -201,6 +201,10 @@ class Project < ActiveRecord::Base
201 201 [Gitlab.config.gitlab.url, path_with_namespace].join("/")
202 202 end
203 203  
  204 + def web_url_without_scheme
  205 + [Gitlab.config.gitlab.host, path_with_namespace].join("/")
  206 + end
  207 +
204 208 def build_commit_note(commit)
205 209 notes.new(commit_id: commit.id, noteable_type: "Commit")
206 210 end
... ...
app/views/layouts/_head.html.haml
... ... @@ -3,7 +3,7 @@
3 3  
4 4 -# Go repository retrieval support.
5 5 - if controller_name == 'projects' && action_name == 'show'
6   - %meta{name: "go-import", content: "#{Gitlab.config.gitlab.host}/#{@project.namespace.path}/#{@project.path} git http://#{Gitlab.config.gitlab.host}/#{@project.namespace.path}/#{@project.path}.git"}
  6 + %meta{name: "go-import", content: "#{@project.web_url_without_scheme} git #{@project.web_url}.git"}
7 7  
8 8 %title
9 9 = "#{title} | " if defined?(title)
... ...