Bug 33568: Cover images
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
1c181f9844
commit
b1973b3abd
16
Koha/Item.pm
16
Koha/Item.pm
|
|
@ -1214,9 +1214,19 @@ Return the cover images associated with this item.
|
|||
sub cover_images {
|
||||
my ( $self ) = @_;
|
||||
|
||||
my $cover_image_rs = $self->_result->cover_images;
|
||||
return unless $cover_image_rs;
|
||||
return Koha::CoverImages->_new_from_dbic($cover_image_rs);
|
||||
my $cover_images_rs = $self->_result->cover_images;
|
||||
return Koha::CoverImages->_new_from_dbic($cover_images_rs);
|
||||
}
|
||||
|
||||
=head3 cover_image_ids
|
||||
|
||||
Return the cover image ids associated with this item.
|
||||
|
||||
=cut
|
||||
|
||||
sub cover_image_ids {
|
||||
my ($self) = @_;
|
||||
return [ $self->cover_images->get_column('imagenumber') ];
|
||||
}
|
||||
|
||||
=head3 columns_to_str
|
||||
|
|
|
|||
|
|
@ -230,6 +230,10 @@ properties:
|
|||
type:
|
||||
- object
|
||||
- "null"
|
||||
cover_image_ids:
|
||||
type:
|
||||
- array
|
||||
- "null"
|
||||
_strings:
|
||||
type:
|
||||
- object
|
||||
|
|
|
|||
|
|
@ -423,6 +423,7 @@
|
|||
type: string
|
||||
enum:
|
||||
- +strings
|
||||
- cover_image_ids
|
||||
collectionFormat: csv
|
||||
- $ref: "../swagger.yaml#/parameters/match"
|
||||
- $ref: "../swagger.yaml#/parameters/order_by"
|
||||
|
|
|
|||
|
|
@ -2495,10 +2495,14 @@
|
|||
const can_edit_items_from = [% To.json(can_edit_items_from) | $raw %];
|
||||
const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
|
||||
let table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
|
||||
let embed = ["+strings"];
|
||||
[% IF Koha.Preference('LocalCoverImages') %]
|
||||
embed.push('cover_image_ids');
|
||||
[% END %]
|
||||
var items_table = $("#table_items").kohaTable({
|
||||
ajax: { url: table_url },
|
||||
order: [[ 0, "asc" ]],
|
||||
embed: ["+strings"],
|
||||
embed,
|
||||
bAutoWidth: false,
|
||||
columns: [
|
||||
[% IF (StaffDetailItemSelection) %]
|
||||
|
|
@ -2519,10 +2523,24 @@
|
|||
{
|
||||
data: "",
|
||||
className: "cover",
|
||||
searchable: true,
|
||||
orderable: true,
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
render: function (data, type, row, meta) {
|
||||
return ""; // FIXME Build cover images
|
||||
if ( !row.cover_image_ids.length > 0 ) {
|
||||
return '';
|
||||
}
|
||||
let node = '<div class="bookcoverimg">';
|
||||
node += '<div class="cover-slider">';
|
||||
row.cover_image_ids.forEach(id => {
|
||||
node += '<div class="cover-image local-coverimg">';
|
||||
node += '<a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=%s&imagenumber=%s" title="Local cover image">'.format(id, id);
|
||||
node += '<img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=%s" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&imagenumber=%s" />'.format(id, id);
|
||||
node += '</a>';
|
||||
node += '</div>';
|
||||
});
|
||||
node += '</div>';
|
||||
node += '</div>';
|
||||
return node;
|
||||
}
|
||||
},
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue