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 1598-1603 Note that permanent location is a code, and location may be an authval. Link Here
1598
    [% INCLUDE 'columns_settings.inc' %]
1598
    [% INCLUDE 'columns_settings.inc' %]
1599
    [% INCLUDE 'js-date-format.inc' %]
1599
    [% INCLUDE 'js-date-format.inc' %]
1600
    [% INCLUDE 'js-patron-format.inc' %]
1600
    [% INCLUDE 'js-patron-format.inc' %]
1601
    [% INCLUDE 'js-biblio-format.inc' %]
1601
    [% Asset.js("js/browser.js") | $raw %]
1602
    [% Asset.js("js/browser.js") | $raw %]
1602
    [% Asset.js("js/table_filters.js") | $raw %]
1603
    [% Asset.js("js/table_filters.js") | $raw %]
1603
    <script>
1604
    <script>
Lines 1653-1674 Note that permanent location is a code, and location may be an authval. Link Here
1653
                    } ],
1654
                    } ],
1654
                    "columns": [
1655
                    "columns": [
1655
                        {
1656
                        {
1656
                            "data": "biblio.title:biblio.medium",
1657
                            "data": "biblio.title:biblio.subtitle:biblio.medium",
1657
                            "title": _("Title"),
1658
                            "title": _("Title"),
1658
                            "searchable": true,
1659
                            "searchable": true,
1659
                            "orderable": true,
1660
                            "orderable": true,
1660
                            "render": function(data, type, row, meta) {
1661
                            "render": function(data, type, row, meta) {
1661
                                var title = "";
1662
                                return $biblio_to_html(row.biblio, { link: 1 });
1662
                                if ( row.biblio.title ) {
1663
                                    title = title.concat('<span class="biblio-title">',row.biblio.title,'</span>');
1664
                                }
1665
                                if ( row.biblio.subtitle ) {
1666
                                    title = title.concat('<span class="biblio-subtitle">',row.biblio.subtitle,'</span>');
1667
                                }
1668
                                if ( row.biblio.medium ) {
1669
                                    title = title.concat('<span class="biblio-medium">',row.biblio.medium,'</span>');
1670
                                }
1671
                                return title;
1672
                            }
1663
                            }
1673
                        },
1664
                        },
1674
                        {
1665
                        {
1675
- 

Return to bug 28854