Skip to content

Commit a267d95

Browse files
authored
Merge pull request internetarchive#11077 from emggeorge/10933/fix/use-cover-and-title-endpoints
Use cover and title endpoints for IA cover upload
2 parents 65ad7d8 + 3d18c9d commit a267d95

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

openlibrary/i18n/messages.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5474,7 +5474,7 @@ msgstr ""
54745474

54755475
#: covers/external_image.html
54765476
#, python-format
5477-
msgid "Or, use the cover from %s"
5477+
msgid "Or, use a cover from %s"
54785478
msgstr ""
54795479

54805480
#: covers/manage.html

openlibrary/templates/covers/add.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@
8181
$#</form>
8282

8383
$if doc.type.key == "/type/edition" and doc.ocaid:
84-
$ img_url = "https://archive.org/services/img/%s/full/pct:600/0/default.jpg" % doc.ocaid
85-
$:render_template("covers/external_image", action, img_url, _("Internet Archive"))
84+
$ img_url_cover = "https://archive.org/download/%s/page/cover" % doc.ocaid
85+
$ img_url_title = "https://archive.org/download/%s/page/title" % doc.ocaid
86+
$:render_template("covers/external_image", action, img_url_cover, img_url_title, _("Internet Archive"))
8687

8788
$if doc.type.key == "/type/author" and data.get('wikidata_images'):
88-
$ img_url = data.get('wikidata_images')[0]
89-
$:render_template("covers/external_image", action, img_url, _("Wikidata"))
89+
$ img_url_cover = data.get('wikidata_images')[0]
90+
$ img_url_title = None
91+
$:render_template("covers/external_image", action, img_url_cover, img_url_title, _("Wikidata"))
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
$def with (action, img_url, source_name)
1+
$def with (action, img_url_cover, img_url_title, source_name)
22

33
<form class="ol-cover-form ol-cover-form--external" method="post" enctype="multipart/form-data" action="$action">
44
<div class="label">
5-
<label>$_("Or, use the cover from %s", source_name)</label>
5+
<label>$_("Or, use a cover from %s", source_name)</label>
66
</div>
7-
<div class="input">
8-
<a href="$img_url" target="_blank">
9-
<img class="ol-cover-form--external_image" src="$img_url" style="height: 200px" alt="" />
10-
</a>
11-
<button type="submit" class="cta-btn cta-btn--vanilla" name="url" value="$img_url">$_("Upload Image")</button>
7+
<div class="input-container">
8+
$for url in [img_url_cover, img_url_title]:
9+
$if url:
10+
<div class="input">
11+
<a href="$url" target="_blank">
12+
<img class="ol-cover-form--external_image" src="$url" style="height: 200px" alt="" />
13+
</a>
14+
<button type="submit" class="cta-btn cta-btn--vanilla" name="url" value="$url">$_("Upload Image")</button>
15+
</div>
1216
</div>
1317
</form>

static/css/components/cbox.less

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,12 @@ div.floater {
279279

280280
.input {
281281
flex-direction: column;
282-
align-items: flex-start;
282+
}
283+
284+
.input-container {
285+
display: flex;
286+
flex-direction: row;
287+
gap: 5px;
283288
}
284289

285290
button[type="submit"] {

0 commit comments

Comments
 (0)