Skip to content

Commit

Permalink
Merge pull request #9178 from cdrini/design/book-details
Browse files Browse the repository at this point in the history
DRY design/code of "Book Details" section
  • Loading branch information
jimchamp authored May 9, 2024
2 parents 8b13df9 + fe9b302 commit bf0c5aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
26 changes: 9 additions & 17 deletions openlibrary/templates/type/edition/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,10 @@
$if edition:
<h2 class="details-title" itemprop="name">$_("Book Details")</h2>
<hr>
$if edition.publish_places:
<div class="section">
<h3 class="edition-header">$_('Published in')</h3>
<p>
$for p in edition.publish_places:
$(p)$cond(loop.last, "", ", ")
</p>
</div>
$if edition.first_sentence:
<div>
<h3 class="edition-header">$_("First Sentence")</h3>
<p>"$(edition.first_sentence)"</p>
<h3>$_("First Sentence")</h3>
<p>"$(edition.first_sentence)"</p>
</div>

$ table_of_contents = edition.get_table_of_contents()
Expand All @@ -374,15 +366,15 @@ <h3>$_("Table of Contents")</h3>
$:macros.ReadMore()
</div>

$if edition.notes or edition.series or edition.volume or edition.genres or edition.other_titles or edition.copyright_date or edition.translation_of or edition.translated_from:
$if edition.notes or edition.publish_places or edition.series or edition.volume or edition.genres or edition.other_titles or edition.copyright_date or edition.translation_of or edition.translated_from:
<div class="section">
<h3 class="edition-header">$_("Edition Notes")
</h3>
<h3>$_("Edition Notes")</h3>
$if edition.notes:
<div class="edition-notes">
$:format(edition.notes)
</div>
<dl class="meta">
$:display_value(_("Published in"), edition.publish_places)
$:display_value(_("Series"), edition.series)
$:display_value(_("Volume"), edition.volume)
$:display_value(_("Genre"), edition.genres)
Expand All @@ -396,7 +388,7 @@ <h3 class="edition-header">$_("Edition Notes")
$ classifications = edition.get_classifications().multi_items()
$if classifications:
<div class="section">
<h3 class="list-header collapse">$_("Classifications")</h3>
<h3>$_("Classifications")</h3>
<dl class="meta">
$for name, values in classifications:
$:display_identifiers(values[0].label, values)
Expand All @@ -421,7 +413,7 @@ <h3 class="header">
$ contributors = edition.get('contributors', [])
$if contributors:
<div class="section">
<h3 class="edition-header">$_("Contributors")</h3>
<h3>$_("Contributors")</h3>
<dl class="meta">
$for c in contributors:
$:display_value(c.role, c.name)
Expand All @@ -430,7 +422,7 @@ <h3 class="edition-header">$_("Contributors")</h3>

$if has_any("physical_format", "pagination", "physical_dimensions", "weight"):
<div class="section">
<h3 class="list-header collapse">$_("The Physical Object")</h3>
<h3>$_("The Physical Object")</h3>
<dl class="meta">
$:display_value(_("Format"), edition.physical_format)
$:display_value(_("Pagination"), edition.pagination)
Expand All @@ -442,7 +434,7 @@ <h3 class="list-header collapse">$_("The Physical Object")</h3>


<div class="section">
<h3 class="list-header collapse">$_("ID Numbers")</h3>
<h3>$_("ID Numbers")</h3>
<dl class="meta">
$:display_identifiers("Open Library", [storage(url=None, value=edition.key.split("/")[-1])])
$ no_index = edition.get_ia_meta_fields().get('noindex', False)
Expand Down
7 changes: 1 addition & 6 deletions static/css/base/dl.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ dd,
dt {
float: left;
}
dt,
.list-header {
dt {
clear: both;
}
.list-header {
float: left;
margin-bottom: 10px;
}
dl {
margin: 10px 0;
&:after {
Expand Down
5 changes: 0 additions & 5 deletions static/css/components/work.less
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ textarea[name="work--description"] + h3 + .wmd-preview,
font-size: @font-size-label-medium;
}

h3.edition-header {
font-size: @font-size-label-large;
margin: 0;
}

.edition-overview {
background: @light-grey;
padding: 10px;
Expand Down

0 comments on commit bf0c5aa

Please sign in to comment.