diff options
| author | Abhinav Gupta <mail@abhinavg.net> | 2023-01-23 09:53:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-23 09:53:51 -0800 |
| commit | 9a95dcbf6ef077808a8874beea9d8a2754e60051 (patch) | |
| tree | 91bfce08d9ffc3e4f9870eb18aa03c57dfba1b5f | |
| parent | cb4081162b75508710f625b5b8dac0c48c813355 (diff) | |
| download | sally-9a95dcbf6ef077808a8874beea9d8a2754e60051.tar.gz | |
Add support for package descriptions (#68)
* template: Use a more fluid layout
Instead of using a table, take advantage of the grid layout.
We still print a table of sorts,
but it's more fluid in appearance based on width of the screen.
On narrower screens, we'll show a listing
where each item has a description label next to it
rather than at the top.
* Add support for package descrpitions
Packages may now optionally specify a description.
If specified, this is printed below the package information,
indented one column to make it stand out.
Co-authored-by: Sung Yoon Whang <sungyoonwhang@gmail.com>
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | config.go | 2 | ||||
| -rw-r--r-- | handler_test.go | 2 | ||||
| -rw-r--r-- | sally.yaml | 1 | ||||
| -rw-r--r-- | templates/index.html | 11 |
6 files changed, 21 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 31295a3..3f92d7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -### Changed +### Added +- Add an optional `description` field to packages. - Use a fluid layout for the index page. This renders better on narrow screens. @@ -47,6 +47,9 @@ packages: # Defaults to "master". branch: master + # Optional description of the package. + description: A fast, structured-logging library. + # Alternative base URL instead of the value configured at the top-level. # This is useful if the same sally instance is # hosted behind multiple base URLs. @@ -26,6 +26,8 @@ type Package struct { Repo string `yaml:"repo"` Branch string `yaml:"branch"` URL string `yaml:"url"` + + Desc string `yaml:"description"` // plain text only } // Parse takes a path to a yaml file and produces a parsed Config diff --git a/handler_test.go b/handler_test.go index 96a10dd..e300d19 100644 --- a/handler_test.go +++ b/handler_test.go @@ -17,6 +17,7 @@ packages: zap: url: go.uberalt.org repo: github.com/uber-go/zap + description: A fast, structured logging library. ` @@ -27,6 +28,7 @@ func TestIndex(t *testing.T) { body := rr.Body.String() assert.Contains(t, body, "github.com/thriftrw/thriftrw-go") assert.Contains(t, body, "github.com/yarpc/yarpc-go") + assert.Contains(t, body, "A fast, structured logging library.") } func TestPackageShouldExist(t *testing.T) { @@ -3,5 +3,6 @@ url: go.uber.org packages: thriftrw: repo: github.com/thriftrw/thriftrw-go + description: A customizable implementation of Thrift. yarpc: repo: github.com/yarpc/yarpc-go diff --git a/templates/index.html b/templates/index.html index 3fc210c..d193263 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,6 +7,7 @@ .separator { margin: 0.25em 0; } + .description { color: #666; } /* On narrow screens, switch to inline headers. */ .table-header { display: none; } @@ -44,6 +45,16 @@ </a> </div> </div> + {{ with .Desc }} + <div class="row"> + <div class="one column"> + <!-- indent --> + </div> + <div class="eleven columns description"> + {{ . }} + </div> + </div> + {{ end }} {{ end }} </div> </body> |