[Koha] Courser reserves on OPAC
Eric Phetteplace
ephetteplace at cca.edu
Tue Mar 31 15:35:08 NZDT 2020
Hmm you can ignore the bit about N and N + 1, it seems like jQuery
replicates the nth-child behavior in its selector. So my first (JavaScript)
example would remove the third column, while the CSS example would remove
the fourth, both behaving as you would expect.
Best,
ERIC PHETTEPLACE Systems Librarian (he/him)
ephetteplace at cca.edu | o 510.594.3660
5212 Broadway | Oakland, CA | 94618
:(){ :|: & };:
On Mon, Mar 30, 2020 at 7:31 PM Eric Phetteplace <ephetteplace at cca.edu>
wrote:
> Hi Carlos,
>
> I have not modified the Course Reserves display but yes, this is a perfect
> example of something that's customizable with JavaScript (OPACUserJS).
> Something like this hides column N + 1 (in this example the 4th column,
> Section):
>
> var n = 3
> $('#course_reserves_table').find('th:nth-child(' + n + ')') .remove()
> $('#course_reserves_table').find('td:nth-child(' + n + ')').remove()
>
> In my opinion, simple hiding something is better suited to CSS, however.
> So in your OpacUserCSS you could add:
>
> #course_reserves_table th:nth-child(4) { display: none; }
> #course_reserves_table td:nth-child(4) { display: none; }
>
> to accomplish the same thing with less code and more reliability. Note
> that N here works as you would expect because Nth child is indexed starting
> at one (:nth-child(1) is the same thing as :first-child), while JavaScript
> follows the convention of indexing things starting at 0.
>
> Reordering columns is a quite bit more complex but could be done with
> JavaScript. You would want to iterate over children of the thead and tr
> parent elements and put them in whatever order you want. If you search for
> "jquery reorder child elements" you can probably find something close. For
> instance, this Stackoverflow answer shows how to do it with a single list
> https://stackoverflow.com/questions/3050830/reorder-list-elements-jquery
> which is analogous to one table row (tr).
>
> Best,
>
> ERIC PHETTEPLACE Systems Librarian (he/him)
>
> ephetteplace at cca.edu | o 510.594.3660
>
> 5212 Broadway | Oakland, CA | 94618
>
> :(){ :|: & };:
>
>
> On Mon, Mar 30, 2020 at 3:54 PM Carlos Lopez <clopez at dml.vic.edu.au>
> wrote:
>
>> Hi folks
>>
>> Has anyone had any luck modifying columns on the OPAC Course Reserves
>> display? (suppressing some columns, reordering others)
>>
>> If so, what was involved? (modifying the template? adding some JS?
>> something else?)
>>
>>
>> With kind regards from the Dalton McCaughey Library Team
>>
>>
>>
>> Carlos Lopez
>>
>>
>>
>> Dalton McCaughey Library | 29 College Crescent, Parkville, VICTORIA 3052
>>
>> Ph: 03 9340 8888 ext.1 | library at dml.vic.edu.au<mailto:
>> library at dml.vic.edu.au> | library.dmlibrary.org.au
>>
>> _______________________________________________
>>
>> Koha mailing list http://koha-community.org
>> Koha at lists.katipo.co.nz
>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>>
>
More information about the Koha
mailing list