We need a re-usable function that will use the json patron object as returned from the API and render an equivalent to the TT patron-title.inc output.
Grabbing the code from bug 29275 by Tomas and submitting it here so we can depend on it in other bugs without requiring the whole of 29275 for backports.
Created attachment 127999 [details] [review] 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>
Created attachment 128000 [details] [review] Bug 29575: Add JSDoc documentation This patch adds some basic documentation for the $patron_to_html function the patchset introduces.
Grabbing SO from Victor on Bug 29275
Created attachment 128004 [details] [review] Bug 27975: (follow-up) Patron fields can be empty strings We need to account for empty strings as well as 'null' values in the patron data structure.
Created attachment 128006 [details] [review] Bug 29575: (follow-up) Patron fields can be empty strings We need to account for empty strings as well as 'null' values in the patron data structure.
Created attachment 128038 [details] [review] 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>
Created attachment 128039 [details] [review] Bug 29575: (QA follow-up) Add JSDoc documentation This patch adds some basic documentation for the $patron_to_html function the patchset introduces. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 128040 [details] [review] Bug 29575: (QA follow-up) Patron fields can be empty strings We need to account for empty strings as well as 'null' values in the patron data structure. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
I've tested this on a few of the dependant bugs, it's looking great and testing lead me to just these two minor QA follow-ups. Passing QA :)
File name is "js-patron-format.inc" but first line comment says "js-patron-title.inc" I suggest we rename file to be closer to existing include "patron-title.inc"
(In reply to Fridolin Somers from comment #11) > File name is "js-patron-format.inc" but first line comment says > "js-patron-title.inc" That's a typo. > I suggest we rename file to be closer to existing include "patron-title.inc" I followed the (already existing) js-format-date.inc file name. I think I prefer it. But can adjust if required, not personally attached.
(In reply to Tomás Cohen Arazi from comment #12) > (In reply to Fridolin Somers from comment #11) > > File name is "js-patron-format.inc" but first line comment says > > "js-patron-title.inc" > > That's a typo. Ok then I remove this HTML comments. > > > I suggest we rename file to be closer to existing include "patron-title.inc" > > I followed the (already existing) js-format-date.inc file name. I think I > prefer it. But can adjust if required, not personally attached. OK I like that (its js-date-format.inc) And since method is $patron_to_html it makes sens to name js-patron-format.inc
Created attachment 128639 [details] [review] Bug 29575: (RM follow-up) remove HTML comments Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]