#184: not show link when submodule does not exist

This commit is contained in:
Vokhmin Alexey V 2013-06-14 13:54:08 +04:00
parent a835f3b45e
commit e36a0386a2
2 changed files with 8 additions and 5 deletions

View File

@ -5,7 +5,8 @@ module GitHelper
# node.url(treeish) looks like:
# - http://0.0.0.0:3000/abf/git@abf.rosalinux.ru:abf/rhel-scripts.git
# - git://github.com/avokhmin/mdv-scripts.git
url = node.url(treeish).gsub(/.git$/, '')
return nil unless url = node.url(treeish)
url.gsub!(/.git$/, '')
if url =~ /^git:/
url.gsub!(/^git/, 'http')
elsif str = /git@.*:.*/.match(url)

View File

@ -26,10 +26,12 @@
- if node.is_a? Grit::Submodule
.pic= image_tag 'folder-submodule.png'
.name
- url = submodule_url node, @treeish
= link_to(node.name, url, :class => 'files-see')
= '@'
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
- if url = submodule_url(node, @treeish)
= link_to(node.name, url, :class => 'files-see')
= '@'
= link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see')
- else
= "#{node.name} @ #{node.id[0..6]}"
- else
- options = [@project, @treeish, node_path]
- if node.is_a?(Grit::Tree)