There are many tables in Koha where it would be useful for librarians to easily copy, download or print the table for various purposes. These functions are available via DataTables button plugins.
Created attachment 64233 [details] [review] Bug 18791 - Add the ability for librarians to easily copy, download or print DataTables based tables in Koha There are many tables in Koha where it would be useful for librarians to easily copy, download or print the table for various purposes. These functions are available via DataTables button plugins. Test Plan: 1) Clear your browser cache ( just in case ) 2) Apply this patch 3) Browse to boraccount.pl ( or another page using DataTabes ) 4) Note the new Excel, CSV, Copy and Print buttons 5) Test each button to ensure they work
Hi Kyle, this is fun - I like it! Just 2 things: 1) The new buttons only appear for tables using the column configuration. Is that correct? I tried the administration tables (branches, itemtypes, patron categories) first, before taking a look at the code. If it's intended that's not a blocker. 2) The buttons don't appear to be translatable. It seems we did some work to make the other strings from datatables translatable. Can we apply the same technique here too? Failing for the translation issue for now, waiting for Kyle to comment.
Works as mentioned. I will add another bug for the functionality to be added to all tables (some reports don't use datatables). I suggest doing the same for the translation issue.
I'd really like to see the translation issue fixed the same version as this goes in as it will appear in quite a few spots.
Marking failed QA for my comments #2 and #4 - Kyle, can you please take a look?
Created attachment 72615 [details] [review] Bug 18791 - Add the ability for librarians to easily copy, download or print DataTables based tables in Koha There are many tables in Koha where it would be useful for librarians to easily copy, download or print the table for various purposes. These functions are available via DataTables button plugins. Test Plan: 1) Clear your browser cache ( just in case ) 2) Apply this patch 3) Browse to boraccount.pl ( or another page using DataTabes ) 4) Note the new Excel, CSV, Copy and Print buttons 5) Test each button to ensure they work
Created attachment 72616 [details] [review] Bug 18791 - Make buttons translatable
Created attachment 72618 [details] [review] Bug 18791 - Make buttons translatable Signed-off-by: Roch D'Amour <roch.damour@inlibro.com>
Hi Kyle, I'd really like to get this feature in. 2 things: - Can you please double-check the about page for the Javascript libraries updated and introduced here? I see only one entry changed, but 4 were touched. - One of the libraries contains another string that is not translatable this way. It is the "copy" modal text: c.i18n("buttons.copySuccess",{1:"Copied one row to clipboard",_:"Copied %d rows to clipboard"},a.rows),2E3);
(In reply to Katrin Fischer from comment #9) > Hi Kyle, > > I'd really like to get this feature in. 2 things: > > - Can you please double-check the about page for the Javascript libraries > updated and introduced here? I see only one entry changed, but 4 were > touched. > > - One of the libraries contains another string that is not translatable this > way. It is the "copy" modal text: > > c.i18n("buttons.copySuccess",{1:"Copied one row to clipboard",_:"Copied %d > rows to clipboard"},a.rows),2E3); Try is I might, I simply cannot get that message to translate : \ It should be very simple to do: Literal example of exactly this: https://datatables.net/extensions/buttons/examples/html5/copyi18n.html https://datatables.net/reference/button/copyHtml5 Is there anyone in the community that might know how to translate datatables better than I?
(In reply to Katrin Fischer from comment #9) > Hi Kyle, > > I'd really like to get this feature in. 2 things: > > - Can you please double-check the about page for the Javascript libraries > updated and introduced here? I see only one entry changed, but 4 were > touched. Those are all part of DataTables so no new entries are needed!
Created attachment 73325 [details] [review] Bug 18791 (follow up) Translation of copy messages This patch updates DataTables configuration so that more strings are translatable: https://datatables.net/extensions/buttons/examples/html5/copyi18n.html To test, apply the patch and clear your browser cache. - Open the account tab for a patron who has only one fine. - Confirm that the new DataTables buttons appear. - Click the 'Copy' button and confirm that a "Copied 1 row to clipboard" message appears. - Test again with a patron who has multiple fines, confirm that the message reads "Copied X rows to clipboard." To test the translation: - Confirm that "Copied 1 row to clipboard" is missing from the language file you're testing with (misc/translator/po/xx-YY-staff-prog.po). - Run 'translate update xx-YY' - Check that the clipboard strings are now in the po file. - Add translations for those strings. - Run 'translate update xx-YY' and 'translate install xx-YY' - Switch to the translated language and clear your browser cache. - Test the 'Copy' button again. Your translated text should appear.
Thx Owen! Could we get another quick sign-off please?
Created attachment 73995 [details] [review] [SIGNED-OFF] Bug 18791 - Add the ability for librarians to easily copy, download or print DataTables based tables in Koha There are many tables in Koha where it would be useful for librarians to easily copy, download or print the table for various purposes. These functions are available via DataTables button plugins. Test Plan: 1) Clear your browser cache ( just in case ) 2) Apply this patch 3) Browse to boraccount.pl ( or another page using DataTabes ) 4) Note the new Excel, CSV, Copy and Print buttons 5) Test each button to ensure they work Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Created attachment 73996 [details] [review] [SIGNED-OFF] Bug 18791 - Make buttons translatable Signed-off-by: Roch D'Amour <roch.damour@inlibro.com> Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Created attachment 73997 [details] [review] [SIGNED-OFF] Bug 18791 (follow up) Translation of copy messages This patch updates DataTables configuration so that more strings are translatable: https://datatables.net/extensions/buttons/examples/html5/copyi18n.html To test, apply the patch and clear your browser cache. - Open the account tab for a patron who has only one fine. - Confirm that the new DataTables buttons appear. - Click the 'Copy' button and confirm that a "Copied 1 row to clipboard" message appears. - Test again with a patron who has multiple fines, confirm that the message reads "Copied X rows to clipboard." To test the translation: - Confirm that "Copied 1 row to clipboard" is missing from the language file you're testing with (misc/translator/po/xx-YY-staff-prog.po). - Run 'translate update xx-YY' - Check that the clipboard strings are now in the po file. - Add translations for those strings. - Run 'translate update xx-YY' and 'translate install xx-YY' - Switch to the translated language and clear your browser cache. - Test the 'Copy' button again. Your translated text should appear. Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Working on this.
Created attachment 74085 [details] [review] Bug 18791: Add the ability for librarians to easily copy, download or print DataTables based tables in Koha There are many tables in Koha where it would be useful for librarians to easily copy, download or print the table for various purposes. These functions are available via DataTables button plugins. Test Plan: 1) Clear your browser cache ( just in case ) 2) Apply this patch 3) Browse to boraccount.pl ( or another page using DataTabes ) 4) Note the new Excel, CSV, Copy and Print buttons 5) Test each button to ensure they work Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 74086 [details] [review] Bug 18791: (follow-up) Make buttons translatable Signed-off-by: Roch D'Amour <roch.damour@inlibro.com> Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 74087 [details] [review] Bug 18791: (follow up) Fix translation of copy messages This patch updates DataTables configuration so that more strings are translatable: https://datatables.net/extensions/buttons/examples/html5/copyi18n.html To test, apply the patch and clear your browser cache. - Open the account tab for a patron who has only one fine. - Confirm that the new DataTables buttons appear. - Click the 'Copy' button and confirm that a "Copied 1 row to clipboard" message appears. - Test again with a patron who has multiple fines, confirm that the message reads "Copied X rows to clipboard." To test the translation: - Confirm that "Copied 1 row to clipboard" is missing from the language file you're testing with (misc/translator/po/xx-YY-staff-prog.po). - Run 'translate update xx-YY' - Check that the clipboard strings are now in the po file. - Add translations for those strings. - Run 'translate update xx-YY' and 'translate install xx-YY' - Switch to the translated language and clear your browser cache. - Test the 'Copy' button again. Your translated text should appear. Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
It does not work well with the column visibility settings. For instance: Search for patrons, hide date of birth, export => date of birth is displayed Did you try and fix that already?
Reading https://datatables.net/extensions/buttons/examples/html5/columns.html It seems we need exportOptions: { columns: ':visible' } Maybe we could also add the PDF export and create a new pref with the list of available exports (on a separate bug report of course).
Hope there is an easy solution! Pref for later sounds good.
+ var MSG_DT_COPY_KEYS = _("Press ctrl or ⌘ + C to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape."); When am I supposed to see this message?
(In reply to Jonathan Druart from comment #24) > + var MSG_DT_COPY_KEYS = _("Press ctrl or ⌘ + C to copy the table > data<br>to your system clipboard.<br><br>To cancel, click this message or > press escape."); > > > When am I supposed to see this message? I remember seeing that message in the past. It's in a fallback feature that you won't see in a recent browser.
Failing QA to get answers.
(In reply to Jonathan Druart from comment #26) > Failing QA to get answers. The answer is on any recent browser, you will never see that message.
I was referring to comment 21 and comment 22.
(In reply to Jonathan Druart from comment #28) > I was referring to comment 21 and comment 22. I wonder if Owen might be able to take a look. I'm not sure where to implement that.
Created attachment 74174 [details] [review] Bug 18791: Export visible columns only We certainly will want to improve that and explicitely list the columns to export. For instance the actions and checkboxes should not be exported, even if visible.
Pushed to master for 18.05, thanks to everybody involved!
(In reply to Jonathan Druart from comment #31) > Pushed to master for 18.05, thanks to everybody involved! \O/ Thanks Jonathan!
Ehancement, not backported for 17.11.X