Skip to content

Commit

Permalink
Merge pull request #5716 from Yashs911/add-cover
Browse files Browse the repository at this point in the history
Display cover as comment in Recent Changes Table
  • Loading branch information
jimchamp committed Jan 6, 2022
2 parents db2d35a + 39b1dd7 commit ec46251
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
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

0 comments on commit ec46251

Please sign in to comment.