View | Details | Raw Unified | Return to bug 33568
Collapse All | Expand All

(-)a/Koha/Item.pm (-3 / +13 lines)
Lines 1214-1222 Return the cover images associated with this item. Link Here
1214
sub cover_images {
1214
sub cover_images {
1215
    my ( $self ) = @_;
1215
    my ( $self ) = @_;
1216
1216
1217
    my $cover_image_rs = $self->_result->cover_images;
1217
    my $cover_images_rs = $self->_result->cover_images;
1218
    return unless $cover_image_rs;
1218
    return Koha::CoverImages->_new_from_dbic($cover_images_rs);
1219
    return Koha::CoverImages->_new_from_dbic($cover_image_rs);
1219
}
1220
1221
=head3 cover_image_ids
1222
1223
Return the cover image ids associated with this item.
1224
1225
=cut
1226
1227
sub cover_image_ids {
1228
    my ($self) = @_;
1229
    return [ $self->cover_images->get_column('imagenumber') ];
1220
}
1230
}
1221
1231
1222
=head3 columns_to_str
1232
=head3 columns_to_str
(-)a/api/v1/swagger/definitions/item.yaml (+4 lines)
Lines 230-235 properties: Link Here
230
    type:
230
    type:
231
      - object
231
      - object
232
      - "null"
232
      - "null"
233
  cover_image_ids:
234
    type:
235
      - array
236
      - "null"
233
  _strings:
237
  _strings:
234
    type:
238
    type:
235
      - object
239
      - object
(-)a/api/v1/swagger/paths/biblios.yaml (+1 lines)
Lines 423-428 Link Here
423
          type: string
423
          type: string
424
          enum:
424
          enum:
425
            - +strings
425
            - +strings
426
            - cover_image_ids
426
        collectionFormat: csv
427
        collectionFormat: csv
427
      - $ref: "../swagger.yaml#/parameters/match"
428
      - $ref: "../swagger.yaml#/parameters/match"
428
      - $ref: "../swagger.yaml#/parameters/order_by"
429
      - $ref: "../swagger.yaml#/parameters/order_by"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-5 / +22 lines)
Lines 2495-2504 Link Here
2495
        const can_edit_items_from = [% To.json(can_edit_items_from) | $raw %];
2495
        const can_edit_items_from = [% To.json(can_edit_items_from) | $raw %];
2496
        const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
2496
        const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
2497
        let table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
2497
        let table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
2498
        let embed = ["+strings"];
2499
        [% IF Koha.Preference('LocalCoverImages') %]
2500
            embed.push('cover_image_ids');
2501
        [% END %]
2498
        var items_table = $("#table_items").kohaTable({
2502
        var items_table = $("#table_items").kohaTable({
2499
            ajax: { url: table_url },
2503
            ajax: { url: table_url },
2500
            order: [[ 0, "asc" ]],
2504
            order: [[ 0, "asc" ]],
2501
            embed: ["+strings"],
2505
            embed,
2502
            bAutoWidth: false,
2506
            bAutoWidth: false,
2503
            columns: [
2507
            columns: [
2504
            [% IF (StaffDetailItemSelection) %]
2508
            [% IF (StaffDetailItemSelection) %]
Lines 2519-2528 Link Here
2519
            {
2523
            {
2520
                data: "",
2524
                data: "",
2521
                className: "cover",
2525
                className: "cover",
2522
                searchable: true,
2526
                searchable: false,
2523
                orderable: true,
2527
                orderable: false,
2524
                render: function (data, type, row, meta) {
2528
                render: function (data, type, row, meta) {
2525
                    return ""; // FIXME Build cover images
2529
                    if ( !row.cover_image_ids.length > 0 ) {
2530
                        return '';
2531
                    }
2532
                    let node = '<div class="bookcoverimg">';
2533
                    node += '<div class="cover-slider">';
2534
                    row.cover_image_ids.forEach(id => {
2535
                        node += '<div class="cover-image local-coverimg">';
2536
                        node += '<a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=%s&amp;imagenumber=%s" title="Local cover image">'.format(id, id);
2537
                        node += '<img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=%s" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=%s" />'.format(id, id);
2538
                        node += '</a>';
2539
                        node += '</div>';
2540
                    });
2541
                    node += '</div>';
2542
                    node += '</div>';
2543
                    return node;
2526
                }
2544
                }
2527
            },
2545
            },
2528
            [% END %]
2546
            [% END %]
2529
- 

Return to bug 33568