From ea375c0dcca118c8ac3c48ba569b025836ad5ccf Mon Sep 17 00:00:00 2001
From: Unknwon <u@gogs.io>
Date: Sun, 13 Dec 2015 23:16:58 -0500
Subject: [PATCH] new template func

---
 modules/template/template.go  | 3 +++
 templates/repo/view_list.tmpl | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/template/template.go b/modules/template/template.go
index cc670a651f..638febe89d 100644
--- a/modules/template/template.go
+++ b/modules/template/template.go
@@ -34,6 +34,9 @@ var Funcs template.FuncMap = map[string]interface{}{
 	"AppSubUrl": func() string {
 		return setting.AppSubUrl
 	},
+	"AppUrl": func() string {
+		return setting.AppUrl
+	},
 	"AppVer": func() string {
 		return setting.AppVer
 	},
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl
index d94dc96e25..d88d7b5597 100644
--- a/templates/repo/view_list.tmpl
+++ b/templates/repo/view_list.tmpl
@@ -30,7 +30,7 @@
 				{{if $entry.IsSubModule}}
 					<td>
 						<span class="icon octicon octicon-file-submodule"></span>
-						{{if $commit.RefUrl}}
+						{{if $commit.RefUrl AppUrl}}
 							<a href="{{$commit.RefUrl}}">{{$entry.Name}}</a> @ <a href="{{$commit.RefUrl}}/commit/{{$commit.RefId}}">{{ShortSha $commit.RefId}}</a>
 						{{else}}
 							{{$entry.Name}} @ {{ShortSha $commit.RefId}}