mirror of
https://github.com/glanceapp/glance.git
synced 2024-12-14 17:13:11 +03:00
Rename widget to just repository
This commit is contained in:
parent
4beab6bcec
commit
818138340c
@ -14,7 +14,7 @@
|
||||
- [Weather](#weather)
|
||||
- [Monitor](#monitor)
|
||||
- [Releases](#releases)
|
||||
- [Repository Overview](#repository-overview)
|
||||
- [Repository](#repository)
|
||||
- [Bookmarks](#bookmarks)
|
||||
- [Calendar](#calendar)
|
||||
- [Stocks](#stocks)
|
||||
@ -822,13 +822,13 @@ The maximum number of releases to show.
|
||||
#### `collapse-after`
|
||||
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.
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
- type: repository-overview
|
||||
- type: repository
|
||||
repository: glanceapp/glance
|
||||
pull-requests-limit: 5
|
||||
issues-limit: 3
|
||||
@ -836,7 +836,7 @@ Example:
|
||||
|
||||
Preview:
|
||||
|
||||
![](images/repository-overview-preview.png)
|
||||
![](images/repository-preview.png)
|
||||
|
||||
#### 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")
|
||||
TwitchGamesListTemplate = compileTemplate("twitch-games-list.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{
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/glanceapp/glance/internal/feed"
|
||||
)
|
||||
|
||||
type RepositoryOverview struct {
|
||||
type Repository struct {
|
||||
widgetBase `yaml:",inline"`
|
||||
RequestedRepository string `yaml:"repository"`
|
||||
Token OptionalEnvString `yaml:"token"`
|
||||
@ -18,7 +18,7 @@ type RepositoryOverview struct {
|
||||
RepositoryDetails feed.RepositoryDetails
|
||||
}
|
||||
|
||||
func (widget *RepositoryOverview) Initialize() error {
|
||||
func (widget *Repository) Initialize() error {
|
||||
widget.withTitle("Repository").withCacheDuration(1 * time.Hour)
|
||||
|
||||
if widget.PullRequestsLimit == 0 || widget.PullRequestsLimit < -1 {
|
||||
@ -32,7 +32,7 @@ func (widget *RepositoryOverview) Initialize() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (widget *RepositoryOverview) Update(ctx context.Context) {
|
||||
func (widget *Repository) Update(ctx context.Context) {
|
||||
details, err := feed.FetchRepositoryDetailsFromGithub(
|
||||
widget.RequestedRepository,
|
||||
string(widget.Token),
|
||||
@ -47,6 +47,6 @@ func (widget *RepositoryOverview) Update(ctx context.Context) {
|
||||
widget.RepositoryDetails = details
|
||||
}
|
||||
|
||||
func (widget *RepositoryOverview) Render() template.HTML {
|
||||
return widget.render(widget, assets.RepositoryOverviewTemplate)
|
||||
func (widget *Repository) Render() template.HTML {
|
||||
return widget.render(widget, assets.RepositoryTemplate)
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ func New(widgetType string) (Widget, error) {
|
||||
return &TwitchGames{}, nil
|
||||
case "twitch-channels":
|
||||
return &TwitchChannels{}, nil
|
||||
case "repository-overview":
|
||||
return &RepositoryOverview{}, nil
|
||||
case "repository":
|
||||
return &Repository{}, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown widget type: %s", widgetType)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user