aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/css/list.css8
-rw-r--r--modules/grils/gril.go23
-rw-r--r--views/gril.html2
-rw-r--r--views/list.html2
4 files changed, 23 insertions, 12 deletions
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 @@
16 position: relative; 16 position: relative;
17 top: 8px; 17 top: 8px;
18 left: -15px; 18 left: -15px;
19}
20
21.gril-img {
22 background-repeat: no-repeat;
23 background-position: center center;
24 background-size: cover;
25 width: 64px;
26 height: 64px;
19} \ No newline at end of file 27} \ 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 {
28 Lists []int 28 Lists []int
29} 29}
30 30
31func (g *Gril) ImagePath() string { 31func (g *Gril) ImagePath(prioritizeThumbnail bool) string {
32 var big string
32 exts := []string{"png", "jpg", "gif", "jpeg"} 33 exts := []string{"png", "jpg", "gif", "jpeg"}
33 var imagePath string
34 for _, ext := range exts { 34 for _, ext := range exts {
35 path := fmt.Sprintf("assets/img/gril/%d/0.%s", g.ID, ext) 35 path := fmt.Sprintf("assets/img/gril/%d/0.%s", g.ID, ext)
36 if _, err := os.Stat(path); err == nil { 36 if _, err := os.Stat(path); err == nil {
37 return path 37 if prioritizeThumbnail {
38 big = path
39 } else {
40 return path
41 }
38 } 42 }
39 } 43 }
40 44
41 if len(imagePath) == 0 { 45 for _, ext := range exts {
42 for _, ext := range exts { 46 path := fmt.Sprintf("assets/img/gril/%d/1.%s", g.ID, ext)
43 path := fmt.Sprintf("assets/img/gril/%d/1.%s", g.ID, ext) 47 if _, err := os.Stat(path); err == nil {
44 if _, err := os.Stat(path); err == nil { 48 return path
45 return path
46 }
47 } 49 }
48 } 50 }
49 return "" 51
52 return big
50} 53}
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 @@
12 <div class="container"> 12 <div class="container">
13 <h1>{{ $gril.RomajiName }}<small>{{ $gril.KanjiName }}</small></h1> 13 <h1>{{ $gril.RomajiName }}<small>{{ $gril.KanjiName }}</small></h1>
14 <div class="row center-align"> 14 <div class="row center-align">
15 <img src="/{{ $gril.ImagePath }}" /> 15 <img src="/{{ $gril.ImagePath false }}" />
16 </div> 16 </div>
17 {{ range $tag := $gril.Tags }} 17 {{ range $tag := $gril.Tags }}
18 <div class="chip"> 18 <div class="chip">
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 @@
21 {{ $index }} 21 {{ $index }}
22 </div> 22 </div>
23 <div class="col s3 m2"> 23 <div class="col s3 m2">
24 <img src="/{{ $lg.Gril.ImagePath }}" alt="" class="circle list-img" /> 24 <div class="circle gril-img" style="background-image: url(/{{ $lg.Gril.ImagePath true }})"> </div>
25 </div> 25 </div>
26 <div class="col s6 m6"> 26 <div class="col s6 m6">
27 <span><a href="/gril/{{ $lg.Gril.ID }}">{{ $lg.Gril.RomajiName }}</a><br /> 27 <span><a href="/gril/{{ $lg.Gril.ID }}">{{ $lg.Gril.RomajiName }}</a><br />