Bug 29575 - Add a JS render function equivalent of the patron-title.inc TT include
Summary: Add a JS render function equivalent of the patron-title.inc TT include
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords: release-notes-needed
Depends on:
Blocks: 28854 28874 29275
  Show dependency treegraph
 
Reported: 2021-11-25 11:28 UTC by Martin Renvoize
Modified: 2021-12-18 21:12 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement adds a re-usable javascript render function that accepts a Koha REST APIi Patron object and outputs the HTML representation.
Version(s) released in:
22.05.00


Attachments
Bug 29575: Add $patron_to_html to render patron information in JS (2.57 KB, patch)
2021-11-25 11:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29575: Add JSDoc documentation (1.32 KB, patch)
2021-11-25 11:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27975: (follow-up) Patron fields can be empty strings (1.48 KB, patch)
2021-11-25 12:34 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29575: (follow-up) Patron fields can be empty strings (1.43 KB, patch)
2021-11-25 12:36 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29575: Add $patron_to_html to render patron information in JS (2.63 KB, patch)
2021-11-26 13:16 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29575: (QA follow-up) Add JSDoc documentation (1.40 KB, patch)
2021-11-26 13:16 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29575: (QA follow-up) Patron fields can be empty strings (1.50 KB, patch)
2021-11-26 13:16 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29575: (RM follow-up) remove HTML comments (889 bytes, patch)
2021-12-16 21:27 UTC, Fridolin Somers
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2021-11-25 11:28:26 UTC
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.
Comment 1 Martin Renvoize 2021-11-25 11:29:23 UTC
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.
Comment 2 Martin Renvoize 2021-11-25 11:43:09 UTC
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>
Comment 3 Martin Renvoize 2021-11-25 11:43:13 UTC
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.
Comment 4 Martin Renvoize 2021-11-25 11:44:00 UTC
Grabbing SO from Victor on Bug 29275
Comment 5 Martin Renvoize 2021-11-25 12:34:37 UTC Comment hidden (obsolete)
Comment 6 Martin Renvoize 2021-11-25 12:36:22 UTC
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.
Comment 7 Martin Renvoize 2021-11-26 13:16:40 UTC
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>
Comment 8 Martin Renvoize 2021-11-26 13:16:43 UTC
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>
Comment 9 Martin Renvoize 2021-11-26 13:16:47 UTC
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>
Comment 10 Martin Renvoize 2021-11-26 13:18:14 UTC
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 :)
Comment 11 Fridolin Somers 2021-12-02 08:03:10 UTC
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"
Comment 12 Tomás Cohen Arazi 2021-12-02 11:21:03 UTC
(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.
Comment 13 Fridolin Somers 2021-12-16 21:24:23 UTC
(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
Comment 14 Fridolin Somers 2021-12-16 21:27:31 UTC
Created attachment 128639 [details] [review]
Bug 29575: (RM follow-up) remove HTML comments

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 15 Fridolin Somers 2021-12-16 22:13:30 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄