mirror of
https://github.com/glanceapp/glance.git
synced 2024-12-15 01:22:37 +03:00
Rename widget to just repository
This commit is contained in:
parent
4beab6bcec
commit
818138340c
@ -14,7 +14,7 @@
|
|||||||
- [Weather](#weather)
|
- [Weather](#weather)
|
||||||
- [Monitor](#monitor)
|
- [Monitor](#monitor)
|
||||||
- [Releases](#releases)
|
- [Releases](#releases)
|
||||||
- [Repository Overview](#repository-overview)
|
- [Repository](#repository)
|
||||||
- [Bookmarks](#bookmarks)
|
- [Bookmarks](#bookmarks)
|
||||||
- [Calendar](#calendar)
|
- [Calendar](#calendar)
|
||||||
- [Stocks](#stocks)
|
- [Stocks](#stocks)
|
||||||
@ -822,13 +822,13 @@ The maximum number of releases to show.
|
|||||||
#### `collapse-after`
|
#### `collapse-after`
|
||||||
How many releases are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse.
|
How many releases are visible before the "SHOW MORE" button appears. Set to `-1` to never collapse.
|
||||||
|
|
||||||
### Repository Overview
|
### Repository
|
||||||
Display general information about a repository as well as a list of the latest open pull requests and issues.
|
Display general information about a repository as well as a list of the latest open pull requests and issues.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- type: repository-overview
|
- type: repository
|
||||||
repository: glanceapp/glance
|
repository: glanceapp/glance
|
||||||
pull-requests-limit: 5
|
pull-requests-limit: 5
|
||||||
issues-limit: 3
|
issues-limit: 3
|
||||||
@ -836,7 +836,7 @@ Example:
|
|||||||
|
|
||||||
Preview:
|
Preview:
|
||||||
|
|
||||||
![](images/repository-overview-preview.png)
|
![](images/repository-preview.png)
|
||||||
|
|
||||||
#### Properties
|
#### Properties
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@ -31,7 +31,7 @@ var (
|
|||||||
MonitorTemplate = compileTemplate("monitor.html", "widget-base.html")
|
MonitorTemplate = compileTemplate("monitor.html", "widget-base.html")
|
||||||
TwitchGamesListTemplate = compileTemplate("twitch-games-list.html", "widget-base.html")
|
TwitchGamesListTemplate = compileTemplate("twitch-games-list.html", "widget-base.html")
|
||||||
TwitchChannelsTemplate = compileTemplate("twitch-channels.html", "widget-base.html")
|
TwitchChannelsTemplate = compileTemplate("twitch-channels.html", "widget-base.html")
|
||||||
RepositoryOverviewTemplate = compileTemplate("repository-overview.html", "widget-base.html")
|
RepositoryTemplate = compileTemplate("repository.html", "widget-base.html")
|
||||||
)
|
)
|
||||||
|
|
||||||
var globalTemplateFunctions = template.FuncMap{
|
var globalTemplateFunctions = template.FuncMap{
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/glanceapp/glance/internal/feed"
|
"github.com/glanceapp/glance/internal/feed"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RepositoryOverview struct {
|
type Repository struct {
|
||||||
widgetBase `yaml:",inline"`
|
widgetBase `yaml:",inline"`
|
||||||
RequestedRepository string `yaml:"repository"`
|
RequestedRepository string `yaml:"repository"`
|
||||||
Token OptionalEnvString `yaml:"token"`
|
Token OptionalEnvString `yaml:"token"`
|
||||||
@ -18,7 +18,7 @@ type RepositoryOverview struct {
|
|||||||
RepositoryDetails feed.RepositoryDetails
|
RepositoryDetails feed.RepositoryDetails
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *RepositoryOverview) Initialize() error {
|
func (widget *Repository) Initialize() error {
|
||||||
widget.withTitle("Repository").withCacheDuration(1 * time.Hour)
|
widget.withTitle("Repository").withCacheDuration(1 * time.Hour)
|
||||||
|
|
||||||
if widget.PullRequestsLimit == 0 || widget.PullRequestsLimit < -1 {
|
if widget.PullRequestsLimit == 0 || widget.PullRequestsLimit < -1 {
|
||||||
@ -32,7 +32,7 @@ func (widget *RepositoryOverview) Initialize() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *RepositoryOverview) Update(ctx context.Context) {
|
func (widget *Repository) Update(ctx context.Context) {
|
||||||
details, err := feed.FetchRepositoryDetailsFromGithub(
|
details, err := feed.FetchRepositoryDetailsFromGithub(
|
||||||
widget.RequestedRepository,
|
widget.RequestedRepository,
|
||||||
string(widget.Token),
|
string(widget.Token),
|
||||||
@ -47,6 +47,6 @@ func (widget *RepositoryOverview) Update(ctx context.Context) {
|
|||||||
widget.RepositoryDetails = details
|
widget.RepositoryDetails = details
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *RepositoryOverview) Render() template.HTML {
|
func (widget *Repository) Render() template.HTML {
|
||||||
return widget.render(widget, assets.RepositoryOverviewTemplate)
|
return widget.render(widget, assets.RepositoryTemplate)
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ func New(widgetType string) (Widget, error) {
|
|||||||
return &TwitchGames{}, nil
|
return &TwitchGames{}, nil
|
||||||
case "twitch-channels":
|
case "twitch-channels":
|
||||||
return &TwitchChannels{}, nil
|
return &TwitchChannels{}, nil
|
||||||
case "repository-overview":
|
case "repository":
|
||||||
return &RepositoryOverview{}, nil
|
return &Repository{}, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown widget type: %s", widgetType)
|
return nil, fmt.Errorf("unknown widget type: %s", widgetType)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user