Bläddra i källkod

GIN Repo header button redesign

- Watch, Star, and Fork buttons are smaller.
- DOI related buttons for owners are placed in place of the original
  buttons and the buttons are pushed to the row below.
- The DOI badge for registered repositories is also in place of the
  original buttons, with the original buttons pushed to the row below.
- Simplified new styling rules so no the original repo/header template
  doesn't need any changes, except single line GIN header injection.
- "Request *New* DOI" when it's not the first.  When the repository is
  ready to re-register (it has been registered but also has changes), we
  add the word "New" to the "Request DOI" button to make it clear that
  the button will register the new version of the repository for a new
  DOI.
- Separate button for adding DataCite file (datacite.yml)
Achilleas Koutsou 5 år sedan
förälder
incheckning
1740c9d12c
3 ändrade filer med 36 tillägg och 39 borttagningar
  1. 7 2
      public/css/custom.css
  2. 1 1
      templates/repo/header.tmpl
  3. 28 36
      templates/repo/header_gin.tmpl

+ 7 - 2
public/css/custom.css

@@ -237,7 +237,7 @@ figure figcaption {
   color: white;
   border-top-left-radius: 0.28571429rem;
   border-bottom-left-radius: 0.28571429rem;
-  padding: 0.833em 1em;
+  padding: 0.5em 1.5em;
 }
 .gin.doinr {
   background-color: #2185D0;
@@ -245,7 +245,7 @@ figure figcaption {
   color: white;
   border-top-right-radius: 0.28571429rem;
   border-bottom-right-radius: 0.28571429rem;
-  padding: 0.833em 1em;
+  padding: 0.5em 1.5em;
 }
 .ui.image.label.nobg {
   background: none;
@@ -375,3 +375,8 @@ textarea#description {
   font-size: 1rem;
   vertical-align: middle;
 }
+.ui.header .button {
+    height: 2em;
+    vertical-align: middle;
+    padding: 0.5em 1.5em;
+}

+ 1 - 1
templates/repo/header.tmpl

@@ -20,6 +20,7 @@
 
 					{{if not $.IsGuest}}
 						<div class="ui right">
+							{{template "repo/header_gin" $}}
 							<form class="display inline" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}" method="POST">
 								{{$.CSRFTokenHTML}}
 								<div class="ui labeled button" tabindex="0">
@@ -59,7 +60,6 @@
 		</div><!-- end grid -->
 	</div><!-- end container -->
 {{end}}
-{{template "repo/header_gin" .}}
 {{if not .IsDiffCompare}}
 	<div class="ui tabs container">
 		<div class="ui tabular menu navbar">

+ 28 - 36
templates/repo/header_gin.tmpl

@@ -1,37 +1,29 @@
-<div class="ui container"><!-- start container -->
-	<div class="ui vertically padded grid head"><!-- start grid -->
-		<div class="column"><!-- start column -->
-			<div class="ui header">
-				{{if not $.IsGuest}}
-					<div class="ui right">
-						{{if and $.IsRepositoryAdmin .PageIsRepoHome}}
-							{{if $.IsDOIReady}} {{/* Ready to (re)register: Show button */}}
-							<div class="ui labeled button" tabindex="0">
-								<a class="ui basic button" href="/{{.Repository.Owner.Name}}/{{.Repository.Name}}/doi"><i class="octicon octicon-squirrel"></i> Request DOI</a>
-							</div>
-							{{else if not $.DOI}} {{/*Link to registration instructions*/}}
-								<div class="ui labeled button	" tabindex="0">
-									<a class="ui basic button" data-tooltip="Your repository does not fulfill all requirements for a DOI yet. Click to get instructions." data-position="bottom center" href="/G-Node/Info/wiki/DOI">
-										<i class="octicon octicon-squirrel"></i> How to publish
-									</a>
-									<a class="ui basic label" href="{{$.RepoLink}}/_add/{{EscapePound $.BranchName}}/datacite.yml" data-tooltip="Add datacite file" data-position="bottom center">
-										<i class="octicon octicon-file"></i>
-									</a>
-								</div>
-							{{end}} {{/* End registration button */}}
-						{{end}} {{/* Admin section */}}
-							
-						{{if $.DOI}} {{/* Registered repo: Show DOI badge */}}
-							<div class="nobg ui image label">
-								<a href="https://doi.org/{{$.DOI}}">
-									<div class="gin doi">DOI</div>
-								</a>
-								<div class="gin doinr">{{$.DOI}}</div>
-							</div>
-						{{end}} {{/* End DOI badge */}}
+{{if or $.DOI $.IsRepositoryAdmin}} {{/* Show DOI buttons or badge */}}
+					{{if $.IsRepositoryAdmin}}
+						{{if $.IsDOIReady}} {{/* Ready to (re)register: Show button */}}
+							<a class="ui basic button" href="/{{.Repository.Owner.Name}}/{{.Repository.Name}}/doi"><i class="octicon octicon-squirrel"></i> Request {{if $.DOI}}New{{end}} DOI</a>
+						{{else if not $.DOI}} {{/*Link to registration instructions*/}}
+							<a class="ui basic button" data-tooltip="Your repository does not fulfill all requirements for a DOI yet. Click to get instructions." data-position="bottom center" href="/G-Node/Info/wiki/DOI"><i class="octicon octicon-squirrel"></i> How to publish</a>
+							<a class="ui basic button" href="{{$.RepoLink}}/_add/{{EscapePound $.BranchName}}/datacite.yml" data-tooltip="Add datacite file" data-position="bottom center"><i class="octicon octicon-file">Add DataCite file</i></a>
+						{{end}} {{/* End registration button */}}
+					{{end}} {{/* Admin section */}}
+					{{if $.DOI}} {{/* Registered repo: Show DOI badge */}}
+						<div class="ui labeled button" tabindex="0">
+							<a href="https://doi.org/{{$.DOI}}">
+								<div class="gin doi">DOI</div>
+							</a>
+							<div class="gin doinr">{{$.DOI}}</div>
+						</div>
+					{{end}} {{/* End DOI badge */}}
+					{{/* Close original header divs and create second row below for original buttons */}}
 					</div>
-				{{end}}
-			</div>
-		</div>
-	</div>
-</div>
+				</div>
+			</div><!--- end column -->
+		</div><!--- end grid -->
+	</div><!--- end container -->
+	<div class="ui container"><!-- start container -->
+		<div class="ui vertically padded grid head"><!-- start grid -->
+			<div class="column"><!-- start column -->
+				<div class="ui header">
+					<div class="ui right">
+{{end}}