mirror of
https://github.com/glanceapp/glance.git
synced 2025-02-10 23:49:52 +01:00
Don't show error if RSS feeds didn't return any items
This commit is contained in:
parent
b25b117717
commit
328e10b89f
@ -33,6 +33,8 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li>{{ .NoItemsMessage }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
@ -3,6 +3,7 @@
|
||||
{{ define "widget-content-classes" }}widget-content-frameless{{ end }}
|
||||
|
||||
{{ define "widget-content" }}
|
||||
{{ if gt (len .Items) 0 }}
|
||||
<div class="carousel-container">
|
||||
<div class="cards-horizontal carousel-items-container"{{ if ne 0.0 .CardHeight }} style="--rss-card-height: {{ .CardHeight }}rem;"{{ end }}>
|
||||
{{ range .Items }}
|
||||
@ -25,4 +26,7 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="widget-content-frame padding-widget">{{ .NoItemsMessage }}</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -3,6 +3,7 @@
|
||||
{{ define "widget-content-classes" }}widget-content-frameless{{ end }}
|
||||
|
||||
{{ define "widget-content" }}
|
||||
{{ if gt (len .Items) 0 }}
|
||||
<div class="carousel-container">
|
||||
<div class="cards-horizontal carousel-items-container"{{ if ne 0.0 .ThumbnailHeight }} style="--rss-thumbnail-height: {{ .ThumbnailHeight }}rem;"{{ end }}>
|
||||
{{ range .Items }}
|
||||
@ -25,4 +26,7 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="widget-content-frame padding-widget">{{ .NoItemsMessage }}</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -12,6 +12,8 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li>{{ .NoItemsMessage }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
@ -228,7 +228,7 @@ func GetItemsFromRSSFeeds(requests []RSSFeedRequest) (RSSFeedItems, error) {
|
||||
entries = append(entries, feeds[i]...)
|
||||
}
|
||||
|
||||
if len(entries) == 0 {
|
||||
if failed == len(requests) {
|
||||
return nil, ErrNoContent
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ type RSS struct {
|
||||
Items feed.RSSFeedItems `yaml:"-"`
|
||||
Limit int `yaml:"limit"`
|
||||
CollapseAfter int `yaml:"collapse-after"`
|
||||
NoItemsMessage string `yaml:"-"`
|
||||
}
|
||||
|
||||
func (widget *RSS) Initialize() error {
|
||||
@ -45,6 +46,8 @@ func (widget *RSS) Initialize() error {
|
||||
}
|
||||
}
|
||||
|
||||
widget.NoItemsMessage = "No items were returned from the feeds."
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user