Skip to content

Commit

Permalink
Use ellipsis in cover large texts, cleaned up API
Browse files Browse the repository at this point in the history
  • Loading branch information
svera committed Dec 7, 2024
1 parent ea65ad8 commit f8e2a5a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions internal/index/bleve_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ func indexAuthors(document Document, index func(id string, data interface{}) err
Slug: document.AuthorsSlugs[i],
Type: "author",
}
err := index(author.Slug, author)
if err != nil {

if err := index(author.Slug, author); err != nil {
log.Printf("Error indexing author %s: %s\n", name, err)
return err
}
Expand Down
5 changes: 0 additions & 5 deletions internal/webserver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ func SetupControllers(cfg Config, db *gorm.DB, metadataReaders map[string]metada

authorsCfg := author.Config{
WordsPerMinute: cfg.WordsPerMinute,
LibraryPath: cfg.LibraryPath,
HomeDir: cfg.HomeDir,
CoverMaxWidth: cfg.CoverMaxWidth,
Hostname: cfg.Hostname,
Port: cfg.Port,
}

homeCfg := home.Config{
Expand Down
8 changes: 0 additions & 8 deletions internal/webserver/controller/author/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ type Sender interface {
type IdxReaderWriter interface {
SearchByAuthor(authorSlug string, page, resultsPerPage int) (result.Paginated[[]index.Document], error)
Author(slug string) (index.Author, error)
Count(t string) (uint64, error)
Close() error
Documents(IDs []string) (map[string]index.Document, error)
}

type highlightsRepository interface {
Expand All @@ -26,11 +23,6 @@ type highlightsRepository interface {

type Config struct {
WordsPerMinute float64
LibraryPath string
HomeDir string
CoverMaxWidth int
Hostname string
Port int
}

type Controller struct {
Expand Down
5 changes: 5 additions & 0 deletions internal/webserver/embedded/views/document.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@ <h4>
</h4>
</div>
<div class="col-3 text-end">
{{if gt (len $document.Authors) 1}}
<a href='/documents?search=AuthorsSlugs&colon;{{join $document.AuthorsSlugs ","}}'>
{{t $lang "See all" }}</a>
{{else}}
<a href='/authors/{{index $document.AuthorsSlugs 0}}'>
{{t $lang "See all" }}</a>
{{end}}
</div>

<div class="row mt-3 pe-0 align-items-end">
Expand Down
4 changes: 2 additions & 2 deletions internal/webserver/embedded/views/partials/cover.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<img src="/images/generic.jpg" loading="lazy" class="cover img-fluid cover-corner" alt='{{t .Lang "\"%s\" cover" .Document.Title}}'>
</picture>
<div class="card-img-overlay card-body d-none">
<h5 class="card-title text-center">{{.Document.Title}}</h5>
<h5 class="card-title text-center text-truncate">{{.Document.Title}}</h5>
{{if .Document.Authors}}
<p class="card-text text-center">
<p class="card-text text-center text-truncate">
{{join .Document.Authors ", "}}
</p>
{{else}}
Expand Down

0 comments on commit f8e2a5a

Please sign in to comment.