Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

author page infobox #8949

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions openlibrary/templates/authors/infobox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$def with (page)

$def render_infobox_row(label, itemprop, value):
$if value:
<tr>
<td><strong>$_(label)</strong></td>
<td><span itemprop="$itemprop">$value</span></td>
</tr>

<div class="infobox">
<div class="illustration">
$:render_template("covers/author_photo", page)
$:render_template("covers/change", page, ".bookCover img")
</div>
<table>
$if page.birth_date or page.death_date:
$:render_infobox_row("Born", 'birthDate', page.birth_date)
$:render_infobox_row("Died", 'deathDate', page.death_date)
$elif page.date:
$:render_infobox_row("Date", '', page.date)
</table>
</div>
29 changes: 15 additions & 14 deletions openlibrary/templates/type/author/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@

$set_share_links(url=request.canonical_url, title=title, view_context=ctx)

$ show_librarian_extras = ctx.user and (ctx.user.is_admin() or ctx.user.is_usergroup_member('/usergroup/librarians'))
<div id="contentHead">

$:macros.databarView(page)

<h1 itemprop="name">$title</h1>
<h2 class="author collapse">
$if page.birth_date or page.death_date:
<span itemprop="birthDate">$page.birth_date</span> - <span itemprop="deathDate">$page.death_date</span>
$else:
$if page.date:
$page.date
</h2>
$if show_librarian_extras:
<h2 class="author collapse">
$if page.birth_date or page.death_date:
<span itemprop="birthDate">$page.birth_date</span> - <span itemprop="deathDate">$page.death_date</span>
$else:
$if page.date:
$page.date
</h2>

</div>

Expand Down Expand Up @@ -107,7 +109,9 @@ <h2 class="author collapse">
<h6 class="collapse black uppercase">$_("Location")</h6>
$page.location
</div>

<span class="mobile-only">
$:render_template("authors/infobox", page)
</span>
<div class="clearfix"></div>
<div id="works" class="section">
<h2 class="collapse">
Expand Down Expand Up @@ -139,7 +143,6 @@ <h2 class="collapse">

<div id="searchResults">
<ul class="list-books">
$ show_librarian_extras = ctx.user and (ctx.user.is_admin() or ctx.user.is_usergroup_member('/usergroup/librarians'))
$for doc in books.docs:
$:macros.SearchResultsWork(doc, show_librarian_extras=show_librarian_extras, include_dropper=True)
</ul>
Expand All @@ -149,11 +152,9 @@ <h2 class="collapse">
</div>
</div>
<div class="contentOnethird">
<div class="illustration">
$:render_template("covers/author_photo", page)
$:render_template("covers/change", page, ".bookCover img")
</div>

<span class="desktop-only">
$:render_template("authors/infobox", page)
</span>
$def render_subjects(label, subjects, prefix):
$if subjects:
<div class="section">
Expand Down
32 changes: 32 additions & 0 deletions static/css/components/author-infobox.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// used in infobox.html
.infobox {
line-height: 1.5em;
background-color: @grey-fafafa;
border-radius: 5px;
padding: 10px;
margin-bottom: 3px;
border-bottom: 1px solid @light-beige;

.illustration {
margin-bottom: unset;
}

tr {
// Without this page-user.css makes the background beige
background-color: transparent;
td:first-child {
padding-right: 5px;
}
}

table {
// Without this page-user.css makes the table very compact
border-collapse: unset;
border-spacing: 3px;
}
}

.infobox-name {
text-align: center;
margin-bottom: 10px;
}
2 changes: 2 additions & 0 deletions static/css/page-user.less
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ tr.table-row.selected{
transform: translateY(-50%);
}

// Import styles for author infobox
@import (less) "components/author-infobox.less";
// Import all common components
@import (less) "legacy.less";
// Import styles specific to the BorrowTable for user pages
Expand Down
Loading