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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc (+50 lines)
Line 0 Link Here
1
<script>
2
    (function() {
3
        /**
4
        * Format the biblio response from a Koha RESTful API request.
5
        * @param  {Object}  biblio  The biblio json object as returned from the Koha RESTful API
6
        * @param  {Object}  config  A configuration object
7
        *                           Valid keys are: `link`
8
        * @return {string}          The formatted HTML string
9
        */
10
        window.$biblio_to_html = function( biblio, config ) {
11
12
            if ( biblio === undefined ) {
13
                return ''; // empty string for no biblio
14
            }
15
16
            var title = '<span class="biblio-title">';
17
            if ( biblio.title != null && biblio.title != '' ) {
18
                title += escape_str(biblio.title);
19
            } else {
20
                title += __("No title");
21
            }
22
            title += '</span>';
23
24
            if ( biblio.subtitle != null && biblio.subtitle != '' ) {
25
                title += '<span clas="biblio-subtitle">' + escape_str(biblio.subtitle) + '</span>';
26
            }
27
28
            if (config && config.link) {
29
                if ( config.link === 'marcdetail' ) {
30
                    title = '<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber='+ encodeURIComponent(biblio.biblio_id) +'">' + title + '</a>';
31
                }
32
                else if ( config.link === 'labeled_marc') {
33
                    title = '<a href="/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber='+ encodeURIComponent(biblio.biblio_id) +'">' + title + '</a>';
34
                }
35
                else if ( config.link === 'isbd' ) {
36
                    title = '<a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber='+ encodeURIComponent(biblio.biblio_id) +'">' + title + '</a>';
37
                }
38
                else {
39
                    title = '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber='+ encodeURIComponent(biblio.biblio_id) +'">' + title + '</a>';
40
                }
41
            }
42
43
            if ( biblio.medium != null && biblio.medium != '' ) {
44
                title +=  '<span class="biblio-medium">'+escape_str(biblio.medium)+'</span>';
45
            }
46
47
            return title;
48
        };
49
    })();
50
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-13 / +3 lines)
Lines 1435-1440 Note that permanent location is a code, and location may be an authval. Link Here
1435
    [% INCLUDE 'columns_settings.inc' %]
1435
    [% INCLUDE 'columns_settings.inc' %]
1436
    [% INCLUDE 'js-date-format.inc' %]
1436
    [% INCLUDE 'js-date-format.inc' %]
1437
    [% INCLUDE 'js-patron-format.inc' %]
1437
    [% INCLUDE 'js-patron-format.inc' %]
1438
    [% INCLUDE 'js-biblio-format.inc' %]
1438
    [% Asset.js("js/browser.js") | $raw %]
1439
    [% Asset.js("js/browser.js") | $raw %]
1439
    [% Asset.js("js/table_filters.js") | $raw %]
1440
    [% Asset.js("js/table_filters.js") | $raw %]
1440
    <script>
1441
    <script>
Lines 1490-1511 Note that permanent location is a code, and location may be an authval. Link Here
1490
                    } ],
1491
                    } ],
1491
                    "columns": [
1492
                    "columns": [
1492
                        {
1493
                        {
1493
                            "data": "biblio.title:biblio.medium",
1494
                            "data": "biblio.title:biblio.subtitle:biblio.medium",
1494
                            "title": _("Title"),
1495
                            "title": _("Title"),
1495
                            "searchable": true,
1496
                            "searchable": true,
1496
                            "orderable": true,
1497
                            "orderable": true,
1497
                            "render": function(data, type, row, meta) {
1498
                            "render": function(data, type, row, meta) {
1498
                                var title = "";
1499
                                return $biblio_to_html(row.biblio, { link: 1 });
1499
                                if ( row.biblio.title ) {
1500
                                    title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>');
1501
                                }
1502
                                if ( row.biblio.subtitle ) {
1503
                                    title = title.concat('<span class="biblio-subtitle">',row.biblio.subtitle,'</span>');
1504
                                }
1505
                                if ( row.biblio.medium ) {
1506
                                    title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>');
1507
                                }
1508
                                return title;
1509
                            }
1500
                            }
1510
                        },
1501
                        },
1511
                        {
1502
                        {
1512
- 

Return to bug 28854