Browse Source

Minor template variable renaming for DOIs

Achilleas Koutsou 6 years ago
parent
commit
ebf49dc2ef
3 changed files with 5 additions and 5 deletions
  1. 1 1
      routes/repo/view.go
  2. 3 3
      templates/repo/header.tmpl
  3. 1 1
      templates/repo/view_list.tmpl

+ 1 - 1
routes/repo/view.go

@@ -73,7 +73,7 @@ func renderDirectory(c *context.Context, treeLink string) {
 			setting.UI.MaxDisplayFileSize {
 			setting.UI.MaxDisplayFileSize {
 			readmeFile = entry.Blob()
 			readmeFile = entry.Blob()
 		} else if entry.Name() == "datacite.yml" {
 		} else if entry.Name() == "datacite.yml" {
-			c.Data["DOI"] = true
+			c.Data["HasDatacite"] = true
 			doiData, err := entry.Blob().Data()
 			doiData, err := entry.Blob().Data()
 			if err != nil {
 			if err != nil {
 				log.Trace("DOI Blob could not be read: %v", err)
 				log.Trace("DOI Blob could not be read: %v", err)

+ 3 - 3
templates/repo/header.tmpl

@@ -34,7 +34,7 @@
 								</div>
 								</div>
 							{{end}}
 							{{end}}
 							{{if not $.DOIReg}}
 							{{if not $.DOIReg}}
-								{{if and (and $.DOI $.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"
 										 href="/{{.Owner.Name}}/{{.Name}}/doi">
 										 href="/{{.Owner.Name}}/{{.Name}}/doi">
@@ -60,10 +60,10 @@
 								{{end}}
 								{{end}}
 							{{else}}
 							{{else}}
 										<div class="nobg ui image label">
 										<div class="nobg ui image label">
-											<a href="https://doi.org/{{$.doi}}">
+											<a href="https://doi.org/{{$.DOI}}">
 												<div class="gin doi">DOI</div>
 												<div class="gin doi">DOI</div>
 											</a>
 											</a>
-												<div class="gin doinr">{{$.doi}}</div>
+												<div class="gin doinr">{{$.DOI}}</div>
 										</div>
 										</div>
 							{{end}}
 							{{end}}
 						</div>
 						</div>

+ 1 - 1
templates/repo/view_list.tmpl

@@ -71,6 +71,6 @@
 {{if and .ReadmeExist .IsTextFile}}
 {{if and .ReadmeExist .IsTextFile}}
 	{{template "repo/view_file" .}}
 	{{template "repo/view_file" .}}
 {{end}}
 {{end}}
-{{if and .DOI .IsTextFile}}
+{{if and .HasDatacite .IsTextFile}}
 	{{template "repo/doifile" .}}
 	{{template "repo/doifile" .}}
 {{end}}
 {{end}}