소스 검색

Remove unnecessary DOIReg flag in template data

Simply keep DOI template data empty if it's not registered.
Achilleas Koutsou 5 년 전
부모
커밋
c212e2e673
2개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 2
      internal/route/repo/repo_gin.go
  2. 1 1
      templates/repo/header.tmpl

+ 3 - 2
internal/route/repo/repo_gin.go

@@ -97,8 +97,9 @@ func readDataciteFile(entry *git.TreeEntry, c *context.Context) {
 	doi := calcRepoDOI(c, setting.DOI.Base)
 	doi := calcRepoDOI(c, setting.DOI.Base)
 	//ddata, err := ginDoi.GDoiMData(doi, "https://api.datacite.org/works/") //todo configure URL?
 	//ddata, err := ginDoi.GDoiMData(doi, "https://api.datacite.org/works/") //todo configure URL?
 
 
-	c.Data["DOIReg"] = libgin.IsRegisteredDOI(doi)
-	c.Data["DOI"] = doi
+	if libgin.IsRegisteredDOI(doi) {
+		c.Data["DOI"] = doi
+	}
 }
 }
 
 
 // calcRepoDOI calculates the theoretical DOI for a repository. If the repository
 // calcRepoDOI calculates the theoretical DOI for a repository. If the repository

+ 1 - 1
templates/repo/header.tmpl

@@ -42,7 +42,7 @@
 									</a>
 									</a>
 								</div>
 								</div>
 							{{end}}
 							{{end}}
-							{{if not $.DOIReg}}
+							{{if not $.DOI}}
 								{{if and (and $.HasDatacite $.IsRepositoryAdmin) (not .IsPrivate)}}
 								{{if and (and $.HasDatacite $.IsRepositoryAdmin) (not .IsPrivate)}}
 								<div class="ui labeled button" tabindex="0">
 								<div class="ui labeled button" tabindex="0">
 									<a class="ui basic button"
 									<a class="ui basic button"