Bug 27632 - Add a more easily Javascript accessible biblionumber to each record in OPAC results
Summary: Add a more easily Javascript accessible biblionumber to each record in OPAC r...
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Lucas Gass (lukeg)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-04 22:17 UTC by Lucas Gass (lukeg)
Modified: 2024-11-07 16:09 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 27632: add data-biblionumber attr to OPAC results (1.55 KB, patch)
2021-02-04 22:23 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 27632: add data-biblionumber attr to OPAC results (1.60 KB, patch)
2021-02-05 00:03 UTC, David Cook
Details | Diff | Splinter Review
Bug 27632: add data-biblionumber attr to OPAC results (1.66 KB, patch)
2021-02-06 22:36 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 27632: add class to results TR and data-biblionumber (1.54 KB, patch)
2021-02-08 18:17 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 27632: add class to results TR and data-biblionumber (1.59 KB, patch)
2021-02-08 20:17 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2021-02-04 22:17:55 UTC
It would be handy to have an easily accessible biblionumber for each record in the OPAC results. 

I think .bibliocol would be an appropriate place
Comment 1 Lucas Gass (lukeg) 2021-02-04 22:23:04 UTC
Created attachment 116343 [details] [review]
Bug 27632: add data-biblionumber attr to OPAC results

To test:
-Apply patch and do an OPAC search that returns several results
-Inscept and look for the class bibiocol
-Make sure it contains a data-biblionumber attr with a value that matches the biblionumber
Comment 2 David Cook 2021-02-05 00:02:48 UTC
My test plan:
0) Use koha-testing-docker
1) Apply patch
2) Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
3) Open browser console
4) Run the following: $(".bibliocol").each( function(){ console.log($(this).attr('data-biblionumber')) });
5) Observe output of "29", "114", and "134".
Comment 3 David Cook 2021-02-05 00:03:15 UTC
Created attachment 116347 [details] [review]
Bug 27632: add data-biblionumber attr to OPAC results

To test:
-Apply patch and do an OPAC search that returns several results
-Inscept and look for the class bibiocol
-Make sure it contains a data-biblionumber attr with a value that matches the biblionumber

Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 4 Katrin Fischer 2021-02-06 22:36:11 UTC
Created attachment 116448 [details] [review]
Bug 27632: add data-biblionumber attr to OPAC results

To test:
-Apply patch and do an OPAC search that returns several results
-Inscept and look for the class bibiocol
-Make sure it contains a data-biblionumber attr with a value that matches the biblionumber

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2021-02-08 15:36:31 UTC
Lucas, please don't forget to add few lines to explain the patch.

""""
Bug 27632: [Commit title]

[Commit message] # This is missing

Test plan:
the steps
"""
Comment 6 Jonathan Druart 2021-02-08 15:37:04 UTC
I don't this it's a good idea to have it on the TD, IMO it must be on the TR.
Comment 7 Lucas Gass (lukeg) 2021-02-08 15:41:10 UTC
(In reply to Jonathan Druart from comment #6)
> I don't this it's a good idea to have it on the TD, IMO it must be on the TR.

I can redo this patch with data-attribute in the TR but I am curious, why is that better?
Comment 8 Jonathan Druart 2021-02-08 16:13:35 UTC
It's the whole TR that is about the biblionumber, not only this specific TD.
Comment 9 Lucas Gass (lukeg) 2021-02-08 18:17:28 UTC
Created attachment 116518 [details] [review]
Bug 27632: add class to results TR and data-biblionumber

This patch adds a data-biblionumber to each table row on the results page. To make it easier to target it also adds the class 'bibliorow'.

To test:
-Apply patch and do an OPAC search that returns several results
-Inscept and look for the class bibiorow
-Make sure it contains a data-biblionumber attr with a value that matches the biblionumber
Comment 10 Katrin Fischer 2021-02-08 20:17:32 UTC
Created attachment 116521 [details] [review]
Bug 27632: add class to results TR and data-biblionumber

This patch adds a data-biblionumber to each table row on the results page. To make it easier to target it also adds the class 'bibliorow'.

To test:
-Apply patch and do an OPAC search that returns several results
-Inscept and look for the class bibiorow
-Make sure it contains a data-biblionumber attr with a value that matches the biblionumber

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2021-02-08 20:18:13 UTC
Risking it - straight back to PQA :)
Comment 12 Jonathan Druart 2021-02-09 08:35:54 UTC
Sorry to be picky here but, can you detail the use case?

I don't think we need the "bibliorow" class. My feeling is that we are missing an id on the table.

What you want seems to be:
$("#id_table").find('tr').each(function(){ 
    var biblionumber = $(this).data('biblionumber');
});
Comment 13 Lucas Gass (lukeg) 2021-02-09 15:08:32 UTC
(In reply to Jonathan Druart from comment #12)
> Sorry to be picky here but, can you detail the use case?
> 
> I don't think we need the "bibliorow" class. My feeling is that we are
> missing an id on the table.
> 
> What you want seems to be:
> $("#id_table").find('tr').each(function(){ 
>     var biblionumber = $(this).data('biblionumber');
> });

Maybe we don't need this at all. You currently can:

$('#results tbody tr').each(function(){
   var biblionumber = $(this).find('input[name="biblionumber"]').val()
)