From 5a87c787713edb20b735b8460f5ab49d0041e236 Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 29 Dec 2015 20:05:45 +0100 Subject: thumbnail kann jetzt bei gril.ImagePath bevorzugt werden. das bild des grils sollte jetzt auch nicht mehr gequetscht aussehen. diff --git a/assets/css/list.css b/assets/css/list.css index bc51fd2..7e6dde9 100644 --- a/assets/css/list.css +++ b/assets/css/list.css @@ -16,4 +16,12 @@ position: relative; top: 8px; left: -15px; +} + +.gril-img { + background-repeat: no-repeat; + background-position: center center; + background-size: cover; + width: 64px; + height: 64px; } \ No newline at end of file diff --git a/modules/grils/gril.go b/modules/grils/gril.go index a450647..fe316cd 100644 --- a/modules/grils/gril.go +++ b/modules/grils/gril.go @@ -28,23 +28,26 @@ type Gril struct { Lists []int } -func (g *Gril) ImagePath() string { +func (g *Gril) ImagePath(prioritizeThumbnail bool) string { + var big string exts := []string{"png", "jpg", "gif", "jpeg"} - var imagePath string for _, ext := range exts { path := fmt.Sprintf("assets/img/gril/%d/0.%s", g.ID, ext) if _, err := os.Stat(path); err == nil { - return path + if prioritizeThumbnail { + big = path + } else { + return path + } } } - if len(imagePath) == 0 { - for _, ext := range exts { - path := fmt.Sprintf("assets/img/gril/%d/1.%s", g.ID, ext) - if _, err := os.Stat(path); err == nil { - return path - } + for _, ext := range exts { + path := fmt.Sprintf("assets/img/gril/%d/1.%s", g.ID, ext) + if _, err := os.Stat(path); err == nil { + return path } } - return "" + + return big } diff --git a/views/gril.html b/views/gril.html index 12b2e8d..2dea399 100644 --- a/views/gril.html +++ b/views/gril.html @@ -12,7 +12,7 @@

{{ $gril.RomajiName }}{{ $gril.KanjiName }}

- +
{{ range $tag := $gril.Tags }}
diff --git a/views/list.html b/views/list.html index 1c32bd7..d4cfeae 100644 --- a/views/list.html +++ b/views/list.html @@ -21,7 +21,7 @@ {{ $index }}
- +
{{ $lg.Gril.RomajiName }}
-- cgit v0.10.1