Bugzilla – Attachment 128038 Details for
Bug 29575
Add a JS render function equivalent of the patron-title.inc TT include
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29575: Add $patron_to_html to render patron information in JS
Bug-29575-Add-patrontohtml-to-render-patron-inform.patch (text/plain), 2.63 KB, created by
Martin Renvoize (ashimema)
on 2021-11-26 13:16:40 UTC
(
hide
)
Description:
Bug 29575: Add $patron_to_html to render patron information in JS
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-11-26 13:16:40 UTC
Size:
2.63 KB
patch
obsolete
>From 3294c96716110a9cb0877a0bad385a97f6aa1361 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 20 Oct 2021 18:16:37 -0300 >Subject: [PATCH] Bug 29575: Add $patron_to_html to render patron information > in JS > >This patch adds a re-usable javascript render function that accepts a >Koha REST api Patron object and outputs the HTML representation. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/js-patron-format.inc | 46 +++++++++++++++++++ > 1 file changed, 46 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc >new file mode 100644 >index 0000000000..c81d37338f >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc >@@ -0,0 +1,46 @@ >+<!-- js-patron-title.inc --> >+<script> >+ (function() { >+ window.$patron_to_html = function( patron, config ) { >+ >+ if ( patron === undefined ) { >+ return ''; // empty string for no patron >+ } >+ >+ var title = null; >+ if ( patron.title != null ) { >+ title = '<span class="patron-title">' + escape_str(patron.title) + '</span>'; >+ } >+ >+ var name; >+ var firstname = escape_str(patron.firstname); >+ var surname = escape_str(patron.surname); >+ >+ if ( patron.other_name != null ) { >+ firstname += ' (' + escape_str(patron.other_name) + ')'; >+ } >+ if ( config && config.invert_name ) { >+ name = surname + ', ' + firstname; >+ } >+ else { >+ name = firstname + ' ' + surname; >+ } >+ >+ if ( config && config.display_cardnumber ) { >+ name = name + ' (' + escape_str(patron.cardnumber) + ')'; >+ } >+ >+ if (config && config.url) { >+ if ( config.url === 'circulation_reserves' ) { >+ name = '<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber='+ encodeURIComponent(patron.patron_id) +'#reserves">' + name + '</a>'; >+ } >+ else { >+ name = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='+ encodeURIComponent(patron.patron_id) +'">' + name + '</a>'; >+ } >+ } >+ >+ return name; >+ }; >+ })(); >+</script> >+<!-- / js-patron-title.inc --> >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29575
:
127999
|
128000
|
128004
|
128006
| 128038 |
128039
|
128040
|
128639