From a00194e665af4731cf353a7d1da9bba1d7a3530f Mon Sep 17 00:00:00 2001
From: Unknwon <u@gogs.io>
Date: Fri, 28 Aug 2015 19:15:25 +0800
Subject: [PATCH] work on #1548

---
 routers/repo/issue.go                  | 1 +
 templates/repo/issue/comment_tab.tmpl  | 4 ++--
 templates/repo/issue/view_content.tmpl | 6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 6a0cc2de3..5e76cd04c 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -521,6 +521,7 @@ func ViewIssue(ctx *middleware.Context) {
 
 	ctx.Data["Issue"] = issue
 	ctx.Data["IsIssueOwner"] = ctx.Repo.IsAdmin() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))
+	ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login"
 	ctx.HTML(200, ISSUE_VIEW)
 }
 
diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl
index d6f71e649..80854440a 100644
--- a/templates/repo/issue/comment_tab.tmpl
+++ b/templates/repo/issue/comment_tab.tmpl
@@ -1,7 +1,7 @@
 <div class="field">
   <div class="ui top attached tabular menu" data-write="write" data-preview="preview">
     <a class="active item" data-tab="write">{{.i18n.Tr "repo.release.write"}}</a>
-    <a class="item" data-tab="preview"  data-url="/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a>
+    <a class="item" data-tab="preview"  data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a>
   </div>
   <div class="ui bottom attached active tab segment" data-tab="write">
     <textarea id="content" name="content"></textarea>
@@ -12,5 +12,5 @@
 </div>
 {{if .IsAttachmentEnabled}}
 <div class="attachments"></div>
-<div class="ui basic button dropzone" id="dropzone" data-upload-url="/issues/attachments" data-accepts="{{.AttachmentAllowedTypes}}" data-max-file="{{.AttachmentMaxFiles}}" data-max-size="2" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"></div>
+<div class="ui basic button dropzone" id="dropzone" data-upload-url="{{AppSubUrl}}/issues/attachments" data-accepts="{{.AttachmentAllowedTypes}}" data-max-file="{{.AttachmentMaxFiles}}" data-max-size="2" data-default-message="{{.i18n.Tr "dropzone.default_message"}}" data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}" data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}" data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"></div>
 {{end}}
\ No newline at end of file
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index fa0d6868a..9f36a24ce 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -69,7 +69,7 @@
 					<div class="ui bottom attached segment">
 						<div class="ui small images">
 							{{range .Issue.Attachments}}
-						  <a target="_blank" href="/attachments/{{.UUID}}"><img class="ui image" src="/attachments/{{.UUID}}"></a>
+						  <a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"><img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}"></a>
 						  {{end}}
 						</div>
 					</div>
@@ -179,8 +179,8 @@
 		  </div>
 		  {{else}}
 		  <div class="ui warning message">
-		    <a href="/user/sign_up" class="ui green button">{{.i18n.Tr "repo.issues.sign_up_for_free"}}</a>
-		    {{.i18n.Tr "repo.issues.sign_in_require_desc" "/user/login" | Safe}}
+		    <a href="{{AppSubUrl}}/user/sign_up" class="ui green button">{{.i18n.Tr "repo.issues.sign_up_for_free"}}</a>
+		    {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
 		  </div>
 		  {{end}}
   	</ui>