Bug 4819 - Add ID attribute to certain areas of OPAC so jquery can be used to hide them
Summary: Add ID attribute to certain areas of OPAC so jquery can be used to hide them
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: 3.6
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Katrin Fischer
QA Contact: Ian Walls
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 13:17 UTC by Jane Wagner
Modified: 2013-12-05 19:59 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
patch file against current head (4.29 KB, patch)
2010-05-26 13:26 UTC, Jane Wagner
Details | Diff | Splinter Review
Bug 4918: Add ids to OPAC detail page (11.77 KB, patch)
2012-03-22 16:41 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 4819: Add ids to OPAC detail page (11.77 KB, patch)
2012-03-22 16:42 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 4819: Add ids to OPAC detail page (11.88 KB, patch)
2012-03-23 11:06 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 4819: Add ids to OPAC detail page (11.89 KB, patch)
2012-03-23 11:07 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jane Wagner 2010-05-26 13:17:29 UTC
I've gotten requests to hide various parts of the OPAC screen that don't presently have tags, so it's been hard to do it with jquery.  This patch adds tags to three places.

* The OPAC search strategy -- some sites don't want to see the actual strategy used to display (e.g., “ mc-itype:BK or mc-itype:CR”), just the count.  I added a span surrounding that part of the line, and put the word Search in front.  Now the line reads Search “ mc-itype:BK or mc-itype:CR” returned 2235 results.  If this jquery is used: 

$("#strategy").remove();

The line reads Search returned 2235 results.

* The OPAC record display -- I've had a couple of requests to turn off the Notes tab.  I added a span to it, so that using this jquery:

$("#holdingnotes").remove();

hides that tab.

* The OPAC patron account messaging tab -- Enhanced Messaging Preferences syspref has to be on for hold notices etc. to get sent out, but if that syspref is on, the Messaging tab shows in the OPAC patron account.  Some sites do not want to allow patrons to change the settings.  I added a span to that tab, so that using this jquery:

$("#showmsgtab").remove();

hides the messaging tab.
Comment 1 Jane Wagner 2010-05-26 13:22:49 UTC
Actually, I wrote a patch some time batck to use a syspref to hide the messaging tab -- looks like Bug 3535 hasn't been pushed to head yet.  The span label will work in the meantime, if it gets pushed.
Comment 2 Jane Wagner 2010-05-26 13:26:22 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2012-03-22 16:39:32 UTC
The attached patch predates TT and will no longer apply.

'OPAC search strategy' is no longer a problem, as we have decided to generally not show the search terms and indexes but only the result count. 
Current display: "Your search returned 3119 results."  

My patch adds an unique id to every item tab and to every column in the items table on the holdings tab.

I think the patron account tabs should be checked and dealt with in a separate patch.
Comment 4 Katrin Fischer 2012-03-22 16:41:17 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2012-03-22 16:42:19 UTC Comment hidden (obsolete)
Comment 6 Owen Leonard 2012-03-23 11:06:51 UTC Comment hidden (obsolete)
Comment 7 Owen Leonard 2012-03-23 11:07:28 UTC
Created attachment 8583 [details] [review]
[SIGNED-OFF] Bug 4819: Add ids to OPAC detail page

Patch adds an unique id to every item tab and
to every column in the items table on the holdings tab.

http://bugs.koha-community.org/show_bug.cgi?id=4819
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 8 Owen Leonard 2012-03-23 13:52:29 UTC
This change allows us to use some variation on the following JavaScript:
----
// Hide the "date due" column

// identify the header for the column we're hiding

var th = $("#item_datedue");

// Get the index of the header cell

var ind = $("#holdingst th").index(th);

// Indexes are zero-based but ":nth-child" starts at one, so increment

ind++;

// Hide the table header

$(th).hide();

// Hide each table cell within the holdings table which has the same
// index as the header cell we identified

$('#holdingst td:nth-child('+ind+')').hide();
----
Place that JS inside a $(document).ready() block in your OPACUserJS system preference to automatically hide the specified column in the OPAC.
Comment 9 Ian Walls 2012-03-28 16:31:04 UTC
Template only change to add IDs to opac-details.tt.  Fixes some indentation for readability.  Marking as Passed QA.
Comment 10 Paul Poulain 2012-03-29 08:42:44 UTC
patch pushed, with a small conflict solve, please double check
Comment 11 Jared Camins-Esakov 2012-05-09 19:56:28 UTC
This bug will be included in the Koha 3.6.5 release.
Comment 12 Jared Camins-Esakov 2012-05-09 20:03:50 UTC
This bug will be included in the Koha 3.6.5 release.