From 4f1178fc2a3e5865c2fb1c16c83fc1abb15484f9 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 1 Jan 2022 19:43:19 -0700 Subject: crane, http, util: housekeeping, performance improvements, styling --- templates/admin-edit.html | 105 +++++++++++------ templates/admin.html | 74 ++++++------ templates/index.html | 23 ++-- templates/layout.html | 280 ++++++---------------------------------------- templates/list.html | 65 ++++++++--- 5 files changed, 208 insertions(+), 339 deletions(-) (limited to 'templates') diff --git a/templates/admin-edit.html b/templates/admin-edit.html index 5bd4fa1..d8805f9 100644 --- a/templates/admin-edit.html +++ b/templates/admin-edit.html @@ -1,32 +1,40 @@ {{ template "layout.html" . }} {{ define "content" }} -

{{ .Status }}

- + + + + {{ $categoryCount := len .Papers.List }} {{ if gt $categoryCount 0 }} - {{ end }} -
- {{ range $category, $paper := .Papers.List }}[{{ $category }}] {{ end }} +
+
+ {{ range $category, $paper := .Papers.List }} + [{{ $category }}] + {{ end }} +
- - - - -
Back
+

Back

{{ if gt $categoryCount 0 }}
@@ -41,43 +49,76 @@ {{ end }} - +
-
+
{{ range $category, $papers := .Papers.List }} {{ $paperCount := len $papers }} -
- - -
+ + {{ range $path, $paper := $papers }} -
    -
  • +
    {{ if $paper.Meta.Title }} - {{ $paper.Meta.Title }}
    + + + {{ $paper.Meta.Title }} + +
    {{ else }} -
    + + + + +
    {{ end }} {{ $contCount := len $paper.Meta.Contributors }}{{ if ge $contCount 1 }} - {{ range $index, $contributor := $paper.Meta.Contributors }}{{if $index}}, {{end}}{{ $contributor.FirstName }} {{ $contributor.LastName }}{{end}}
    + + {{- range $index, $contributor := $paper.Meta.Contributors -}} + {{- if $index }}, {{ end }} + {{- $contributor.FirstName }} {{ $contributor.LastName -}} + {{- end -}} + +
    {{ end }} {{ $hasVal := false }} - {{ if $paper.Meta.PubYear }}{{ $hasVal = true }}{{ $paper.Meta.PubYear }}{{ end }} - - {{ if $paper.Meta.DOI }}{{ if $hasVal }}- {{end}}{{ $paper.Meta.DOI }} + {{ if $paper.Meta.PubYear }}{{ $hasVal = true }} + {{ $paper.Meta.PubYear }} + {{ end }} - {{ else if $paper.Meta.ArxivID }}{{ if $hasVal }}- {{ end }}{{ $paper.Meta.ArxivID }} - {{ else if $paper.Meta.Resource }}{{ if $hasVal }}- {{ end }}{{ $paper.Meta.Resource }}{{ end }} + {{ if $paper.Meta.DOI }}{{ if $hasVal }}- {{end}} + + {{ $paper.Meta.DOI }} + + {{ else if $paper.Meta.ArxivID }} + {{ if $hasVal }}- {{ end }} + + {{ $paper.Meta.ArxivID }} + + {{ else if $paper.Meta.Resource }} + {{ if $hasVal }}- {{ end }} + + {{ $paper.Meta.Resource }} + + {{ end }} - {{ if $paper.Meta.Journal }}{{ if $hasVal }}- {{ end }}{{ $paper.Meta.Journal }}{{ end }} + {{ if $paper.Meta.Journal }} + {{ if $hasVal }}- {{ end }} + {{ $paper.Meta.Journal }} + + {{ end }} -
  • -
+
{{ end }} -
{{ end }} +
{{ end }}
{{ end }} diff --git a/templates/admin.html b/templates/admin.html index 8573e23..fb3a3d2 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -1,51 +1,55 @@ {{ template "layout.html" . }} {{ define "content" }} -{{ if .LastPaperDL }} -

{{ .Status }} (download)

-{{ else }} -

{{ .Status }}

-{{ end }} - + + + + - + {{ $categoryCount := len .Papers.List }} {{ if gt $categoryCount 0 }} - + {{ end }}
+ {{ if .LastPaperDL }} + {{ .Status }} (download) + {{ else }} + {{ .Status }} + {{ end }} +
-
- - +
+ + + -
-
- - - -
-
+
+ + + +
+
{{ if gt $categoryCount 0 }} -
- {{ range $category, $paper := .Papers.List }}[{{ $category }}] {{ end }} +
+
+ {{ range $category, $paper := .Papers.List }} + [{{ $category }}] + {{ end }} +
- - - - -
Edit
+

Edit

{{ block "list" . }}{{ end }}
diff --git a/templates/index.html b/templates/index.html index d435a38..861410d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,21 +1,22 @@ {{ template "layout.html" . }} {{ define "content" }} - - + +
{{ $categoryCount := len .Papers.List }} {{ if gt $categoryCount 0 }} -
- {{ range $category, $paper := .Papers.List }}[{{ $category }}] {{ end }} +
+
+ {{ range $category, $paper := .Papers.List }} + [{{ $category }}] + {{ end }} +
- - - - -
Manage
-
+

Manage

{{ block "list" . }}{{ end }}
{{ else }} -

nothing here yet, create a category to start downloading papers

+

nothing here yet, +create a category +to start downloading papers

{{ end }} {{ end }} diff --git a/templates/layout.html b/templates/layout.html index b9449b6..9f6109b 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -2,255 +2,49 @@ - + Crane -
-
- - - - +
+

+

Crane is a research literature download and categorization +service. The source code can be downloaded +here.

{{ block "content" . }}{{ end }} -
-
+crane diff --git a/templates/list.html b/templates/list.html index 52e7bb9..132bb6d 100644 --- a/templates/list.html +++ b/templates/list.html @@ -1,37 +1,66 @@ {{ define "list" }} -
+
{{ range $category, $papers := .Papers.List }} {{ $paperCount := len $papers }} {{ if ge $paperCount 1 }} -
- {{ $category }} -
+

+ +

{{ range $path, $paper := $papers }} -
    -
  • +
    {{ if $paper.Meta.Title }} - {{ $paper.Meta.Title }}
    + + {{ $paper.Meta.Title }} + +
    {{ else }} - {{ $paper.PaperName }}
    + + {{ $paper.PaperName }} + +
    {{ end }} - {{ $contCount := len $paper.Meta.Contributors }}{{ if ge $contCount 1 }} - {{ range $index, $contributor := $paper.Meta.Contributors }}{{if $index}}, {{end}}{{ $contributor.FirstName }} {{ $contributor.LastName }}{{end}}
    + {{ $contCount := len $paper.Meta.Contributors }} + {{ if ge $contCount 1 }} + + {{- range $index, $contributor := $paper.Meta.Contributors -}} + {{- if $index }}, {{ end -}} + {{- $contributor.FirstName }} {{ $contributor.LastName -}} + {{- end -}} + +
    {{ end }} {{ $hasVal := false }} - {{ if $paper.Meta.PubYear }}{{ $hasVal = true }}{{ $paper.Meta.PubYear }}{{ end }} + {{ if $paper.Meta.PubYear }} + {{ $hasVal = true }} + {{ $paper.Meta.PubYear }} + {{ end }} - {{ if $paper.Meta.DOI }}{{ if $hasVal }}- {{end}}{{ $paper.Meta.DOI }} + {{ if $paper.Meta.DOI }} + {{ if $hasVal }}- {{end}} + + {{ $paper.Meta.DOI }} + - {{ else if $paper.Meta.ArxivID }}{{ if $hasVal }}- {{ end }}{{ $paper.Meta.ArxivID }} - {{ else if $paper.Meta.Resource }}{{ if $hasVal }}- {{ end }}{{ $paper.Meta.Resource }}{{ end }} + {{ else if $paper.Meta.ArxivID }} + {{ if $hasVal }}- {{ end }} + + {{ $paper.Meta.ArxivID }} + + {{ else if $paper.Meta.Resource }} + {{ if $hasVal }}- {{ end }} + + {{ $paper.Meta.Resource }} + + {{ end }} - {{ if $paper.Meta.Journal }}{{ if $hasVal }}- {{ end }}{{ $paper.Meta.Journal }}{{ end }} -
  • -
+ {{ if $paper.Meta.Journal }} + {{ if $hasVal }}- {{ end }} + {{ $paper.Meta.Journal }} + {{ end }} +
{{ end }} -
{{ end }} {{ end }}
-- cgit v1.2.3-54-g00ecf