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

Display cover as comment in Recent Changes Table #5716

Merged
merged 3 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions openlibrary/plugins/upstream/covers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from infogami.utils.view import safeint
from openlibrary import accounts
from openlibrary.plugins.upstream.models import Image
from openlibrary.plugins.upstream.utils import get_coverstore_url, render_template
from openlibrary.plugins.upstream.utils import (
get_coverstore_url, get_coverstore_public_url, render_template)

logger = getLogger("openlibrary.plugins.upstream.covers")

Expand Down Expand Up @@ -83,7 +84,9 @@ def upload(self, key, i):

def save(self, book, coverid, url=None):
book.covers = [coverid] + [cover.id for cover in book.get_covers()]
book._save("Added new cover", action="add-cover", data={"url": url})
book._save('%s/b/id/%s-S.jpg' % (
get_coverstore_public_url(), coverid),
action="add-cover", data={"url": url})


class add_work_cover(add_cover):
Expand Down
7 changes: 6 additions & 1 deletion openlibrary/templates/recentchanges/render.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
<td class="history"><a rel="nofollow" href="$ip_url" class="$klass" title="When you see numbers here, that's the IP address of the anonymous editor">$c.ip</a></td>
$else:
<td class="history">$c.ip</td>
<td class="comment">$:call_template("comment", c)</td>
<td class="comment">
$if c.kind == 'add-cover':
Added new cover <img class="comment__cover" src='$:call_template("comment", c)' alt=""/>
$else:
$:call_template("comment", c)
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions static/css/legacy.less
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ table {
td.comment {
width: 33%;
}
.comment__cover {
vertical-align: middle;
}
}
// openlibrary/templates/lib/markdown.html
&.help {
Expand Down