mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-22 10:51:24 +02:00
Make RSS thumbnail height configurable
This commit is contained in:
parent
7c4c1798b6
commit
54102ae35e
@ -392,6 +392,7 @@ Example:
|
|||||||
| ---- | ---- | -------- | ------- |
|
| ---- | ---- | -------- | ------- |
|
||||||
| style | string | no | vertical-list |
|
| style | string | no | vertical-list |
|
||||||
| feeds | array | yes |
|
| feeds | array | yes |
|
||||||
|
| thumbnail-height | float | no | 10 |
|
||||||
| limit | integer | no | 25 |
|
| limit | integer | no | 25 |
|
||||||
| collapse-after | integer | no | 5 |
|
| collapse-after | integer | no | 5 |
|
||||||
|
|
||||||
@ -406,6 +407,9 @@ Used to change the appearance of the widget. Possible values are `vertical-list`
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
##### `thumbnail-height`
|
||||||
|
Used to modify the height of the thumbnails. Works only when the style is set to `horizontal-cards`. The default value is `10` and the units are `rem`, if you want to for example double the height of the thumbnails you can set it to `20`.
|
||||||
|
|
||||||
##### `feeds`
|
##### `feeds`
|
||||||
An array of RSS/atom feeds. The title can optionally be changed.
|
An array of RSS/atom feeds. The title can optionally be changed.
|
||||||
|
|
||||||
|
@ -813,7 +813,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.rss-card-image {
|
.rss-card-image {
|
||||||
height: 10rem;
|
height: var(--rss-thumbnail-height, 10rem);
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: var(--border-radius) var(--border-radius) 0 0;
|
border-radius: var(--border-radius) var(--border-radius) 0 0;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{{ define "widget-content" }}
|
{{ define "widget-content" }}
|
||||||
<div class="carousel-container">
|
<div class="carousel-container">
|
||||||
<div class="cards-horizontal carousel-items-container">
|
<div class="cards-horizontal carousel-items-container"{{ if ne 0.0 .ThumbnailHeight }}style="--rss-thumbnail-height: {{ .ThumbnailHeight }}rem;"{{ end }}>
|
||||||
{{ range .Items }}
|
{{ range .Items }}
|
||||||
<div class="card widget-content-frame thumbnail-container">
|
<div class="card widget-content-frame thumbnail-container">
|
||||||
{{ if ne "" .ImageURL }}
|
{{ if ne "" .ImageURL }}
|
||||||
|
@ -10,12 +10,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type RSS struct {
|
type RSS struct {
|
||||||
widgetBase `yaml:",inline"`
|
widgetBase `yaml:",inline"`
|
||||||
FeedRequests []feed.RSSFeedRequest `yaml:"feeds"`
|
FeedRequests []feed.RSSFeedRequest `yaml:"feeds"`
|
||||||
Style string `yaml:"style"`
|
Style string `yaml:"style"`
|
||||||
Items feed.RSSFeedItems `yaml:"-"`
|
ThumbnailHeight float64 `yaml:"thumbnail-height"`
|
||||||
Limit int `yaml:"limit"`
|
Items feed.RSSFeedItems `yaml:"-"`
|
||||||
CollapseAfter int `yaml:"collapse-after"`
|
Limit int `yaml:"limit"`
|
||||||
|
CollapseAfter int `yaml:"collapse-after"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *RSS) Initialize() error {
|
func (widget *RSS) Initialize() error {
|
||||||
@ -29,6 +30,10 @@ func (widget *RSS) Initialize() error {
|
|||||||
widget.CollapseAfter = 5
|
widget.CollapseAfter = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if widget.ThumbnailHeight < 0 {
|
||||||
|
widget.ThumbnailHeight = 0
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user