| Summary: | Add a more easily Javascript accessible biblionumber to each record in OPAC results | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Lucas Gass (lukeg) <lucas> |
| Component: | OPAC | Assignee: | Lucas Gass (lukeg) <lucas> |
| Status: | CLOSED INVALID | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | dcook, jonathan.druart, nick |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| 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
Bug 27632: add data-biblionumber attr to OPAC results Bug 27632: add data-biblionumber attr to OPAC results Bug 27632: add class to results TR and data-biblionumber Bug 27632: add class to results TR and data-biblionumber |
||
|
Description
Lucas Gass (lukeg)
2021-02-04 22:17:55 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 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". 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> 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> 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 """ I don't this it's a good idea to have it on the TD, IMO it must be on the TR. (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? It's the whole TR that is about the biblionumber, not only this specific TD. 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 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> Risking it - straight back to PQA :) 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');
});
(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() ) |