Merge Edge with sort and resize #2

Merged
alfred merged 64 commits from edge into master 2022-07-28 01:51:14 +01:00
4 changed files with 65 additions and 16 deletions
Showing only changes of commit c148e71e7d - Show all commits

View File

@ -127,16 +127,23 @@ main{
.item-table-360{ .item-table-360{
display: none; display: none;
} }
.item-table-span{ .image-box{
position: absolute; display: -webkit-box;
left: 0; display: -moz-box;
} display: -ms-flexbox;
.item-table-dummy{ display: -webkit-flex;
display: table-cell; display: flex;
vertical-align: top; -webkit-box-orient: horizontal;
border-color: transparent; -moz-box-orient: horizontal;
background-color: transparent; -webkit-box-direction: normal;
box-sizing: inherit; -moz-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
align-items: center;
} }
@media (min-width: 480px){ @media (min-width: 480px){
.main-table > div > div > div{ .main-table > div > div > div{

View File

@ -78,16 +78,21 @@
</video></div> </video></div>
</div> </div>
</div> </div>
<div>
<div class="item-table-dummy"></div>
<div class="item-table-full item-table-span">
<div class="padded-2px">{{ .GetContent }}</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{ if not (eq .GetImageCount 0) }}
<div>
<div>
<div class="image-box">
{{ range .GetImages }}
<a href="{{ .ImageLocation }}"><img src="{{ .ThumbnailLocation }}" width="144"></a>
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ end }} {{ end }}
</main> </main>
</body> </body>

View File

@ -38,6 +38,14 @@ entries:
endDate: "31/10/2021" endDate: "31/10/2021"
videoLocation: "https://cityuni.captainalm.com/resources/stream/vid1.mp4" videoLocation: "https://cityuni.captainalm.com/resources/stream/vid1.mp4"
videoContentType: "video/mp4" videoContentType: "video/mp4"
thumbnailLocations:
- "https://cityuni.captainalm.com/resources/assets/pic1.png"
- "https://cityuni.captainalm.com/resources/assets/pic2.png"
- "https://cityuni.captainalm.com/resources/assets/pic3.png"
imageLocations:
- "https://cityuni.captainalm.com/resources/assets/pic1.png"
- "https://cityuni.captainalm.com/resources/assets/pic2.png"
- "https://cityuni.captainalm.com/resources/assets/pic3.png"
- name: "City Game Project 2022: Ninjaformer (Alpha, Beta)" - name: "City Game Project 2022: Ninjaformer (Alpha, Beta)"
content: > content: >
<p> <p>
@ -60,3 +68,11 @@ entries:
endDate: "08/05/2022" endDate: "08/05/2022"
videoLocation: "https://cityuni.captainalm.com/resources/stream/vid2.mp4" videoLocation: "https://cityuni.captainalm.com/resources/stream/vid2.mp4"
videoContentType: "video/mp4" videoContentType: "video/mp4"
thumbnailLocations:
- "https://cityuni.captainalm.com/resources/assets/pic4.png"
- "https://cityuni.captainalm.com/resources/assets/pic5.png"
- "https://cityuni.captainalm.com/resources/assets/pic6.png"
imageLocations:
- "https://cityuni.captainalm.com/resources/assets/pic4.png"
- "https://cityuni.captainalm.com/resources/assets/pic5.png"
- "https://cityuni.captainalm.com/resources/assets/pic6.png"

View File

@ -3,6 +3,7 @@ package index
import ( import (
"golang.captainalm.com/cityuni-webserver/utils/yaml" "golang.captainalm.com/cityuni-webserver/utils/yaml"
"html/template" "html/template"
"math"
"time" "time"
) )
@ -19,6 +20,11 @@ type EntryYaml struct {
ImageLocations []string `yaml:"imageLocations"` ImageLocations []string `yaml:"imageLocations"`
} }
type ImageReference struct {
ThumbnailLocation string
ImageLocation string
}
func (ey EntryYaml) GetStartDate() string { func (ey EntryYaml) GetStartDate() string {
return ey.StartDate.Format(dateFormat) return ey.StartDate.Format(dateFormat)
} }
@ -46,3 +52,18 @@ func (ey EntryYaml) GetContent() template.HTML {
func (ey EntryYaml) GetDuration() time.Duration { func (ey EntryYaml) GetDuration() time.Duration {
return ey.GetEndTime().Sub(ey.StartDate.Time).Truncate(time.Second) return ey.GetEndTime().Sub(ey.StartDate.Time).Truncate(time.Second)
} }
func (ey EntryYaml) GetImageCount() int {
return int(math.Min(float64(len(ey.ThumbnailLocations)), float64(len(ey.ImageLocations))))
}
func (ey EntryYaml) GetImages() []ImageReference {
toReturn := make([]ImageReference, ey.GetImageCount())
for i := 0; i < len(ey.ThumbnailLocations) && i < len(ey.ImageLocations); i++ {
toReturn[i] = ImageReference{
ThumbnailLocation: ey.ThumbnailLocations[i],
ImageLocation: ey.ImageLocations[i],
}
}
return toReturn
}