Преглед на файлове

[DOI] Add doi to templates

cgars преди 8 години
родител
ревизия
bcf8326bd4
променени са 3 файла, в които са добавени 11 реда и са изтрити 7 реда
  1. 1 0
      pkg/context/context.go
  2. 2 7
      templates/base/head.tmpl
  3. 8 0
      templates/repo/header.tmpl

+ 1 - 0
pkg/context/context.go

@@ -295,6 +295,7 @@ func Contexter() macaron.Handler {
 
 
 		c.Data["CSRFToken"] = x.GetToken()
 		c.Data["CSRFToken"] = x.GetToken()
 		c.Data["CSRFTokenHTML"] = template.HTML(`<input type="hidden" name="_csrf" value="` + x.GetToken() + `">`)
 		c.Data["CSRFTokenHTML"] = template.HTML(`<input type="hidden" name="_csrf" value="` + x.GetToken() + `">`)
+		c.Data["SessionID"] = sess.ID()
 		log.Trace("Session ID: %s", sess.ID())
 		log.Trace("Session ID: %s", sess.ID())
 		log.Trace("CSRF Token: %v", c.Data["CSRFToken"])
 		log.Trace("CSRF Token: %v", c.Data["CSRFToken"])
 
 

+ 2 - 7
templates/base/head.tmpl

@@ -11,15 +11,10 @@
 	<meta name="referrer" content="no-referrer" />
 	<meta name="referrer" content="no-referrer" />
 	<meta name="_csrf" content="{{.CSRFToken}}" />
 	<meta name="_csrf" content="{{.CSRFToken}}" />
 	<meta name="_suburl" content="{{AppSubURL}}" />
 	<meta name="_suburl" content="{{AppSubURL}}" />
-<<<<<<< feca79c32e342e16fba95c9a66ccbef48e7e5797
-	
-=======
 	{{if .GoGetImport}}
 	{{if .GoGetImport}}
-		<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">
-		<meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
+	<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}"/>
+	<meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}"/>
 	{{end}}
 	{{end}}
-
->>>>>>> [GINR] Templates -> GIN
 	<!-- Open Graph Tags -->
 	<!-- Open Graph Tags -->
 	{{if .PageIsAdmin}}
 	{{if .PageIsAdmin}}
 	{{else if .PageIsUserProfile}}
 	{{else if .PageIsUserProfile}}

+ 8 - 0
templates/repo/header.tmpl

@@ -41,6 +41,14 @@
 									</a>
 									</a>
 								</div>
 								</div>
 							{{end}}
 							{{end}}
+							{{if .CanDoified}}
+							<div class="ui labeled button" tabindex="0">
+								<a class="ui basic button"
+									 href="https://doi.gin.g-node.org/?repo={{.FullName}}&name={{.Owner.Name}}&token={{$.SessionID}}">
+									<i class="octicon octicon-squirrel"></i>Doify
+								</a>
+							</div>
+							{{end}}
 						</div>
 						</div>
 					{{end}}
 					{{end}}
 				</div>
 				</div>