Bugzilla – Attachment 144966 Details for
Bug 30031
Add lists to table settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30031: Add column settings to list view
Bug-30031-Add-column-settings-to-list-view.patch (text/plain), 21.32 KB, created by
David Nind
on 2023-01-04 01:16:13 UTC
(
hide
)
Description:
Bug 30031: Add column settings to list view
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-01-04 01:16:13 UTC
Size:
21.32 KB
patch
obsolete
>From e6c2ab6450d8002b283969bc2bb78b9072205d81 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 29 Dec 2022 16:10:45 +0000 >Subject: [PATCH] Bug 30031: Add column settings to list view > >To test: >1. Apply patch and restart_all >2. Create a list >3. GO to Administration > Table settings >4. In Table settings look under Catalog for lists. >5. The search results table should be listed, with the ability to hide the author, date_added, or call_number >6. Go to the view of your list ( /cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=1 ) >7. Make sure you can hide the columns properly. ( The checkbox and Title columns should not be hidable ) >8. Turn on the item-level_itypes system preferecne which will add the item type column, make sure you can hide it and all other columns correctlly now. > >Note: I have also added the page-section class to this table. > >Signed-off-by: David Nind <david@davidnind.com> >--- > admin/columns_settings.yml | 20 ++ > .../prog/en/modules/virtualshelves/shelves.tt | 221 +++++++++--------- > 2 files changed, 136 insertions(+), 105 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index ec2a21dcd3..d06438da48 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -347,6 +347,26 @@ modules: > cannot_be_modified: 1 > > catalogue: >+ lists: >+ searchresults: >+ columns: >+ - >+ columnname: checkbox >+ cannot_be_toggled: 1 >+ cannot_be_modified: 1 >+ - >+ columnname: item_type >+ - >+ columnname: title >+ cannot_be_toggled: 1 >+ cannot_be_modified: 1 >+ - >+ columnname: author >+ - >+ columnname: date_added >+ - >+ columnname: call_number >+ > detail: > holdings_table: > columns: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 605a074f5e..f3cf123601 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% USE Koha %] > [% USE KohaDates %] >+[% USE TablesSettings %] > [% USE AuthorisedValues %] > [% USE Branches %] > [% SET footerjs = 1 %] >@@ -280,115 +281,118 @@ > </div> > </div> > [% END %] >- >- <table id="searchresults" class="dataTable"> >- <thead> >- <tr> >- [% IF ( itemsloop ) %] >- <th class="checkall"> </th> >- [% END %] >- [% UNLESS ( item_level_itypes ) %] >- <th>Item type</th> >- [% END %] >- [% IF sortfield == 'title' %] >- <th class="sorting_[% direction | html %]"> >- [% ELSE %] >- <th class="sorting"> >- [% END %] >- <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=title&direction=[% IF sortfield != 'title' %]asc[% ELSE %][% new_direction | uri %][% END %]">Title</a> >- </th> >- [% IF sortfield == 'author' %] >- <th class="sorting_[% direction | html %]"> >- [% ELSE %] >- <th class="sorting"> >- [% END %] >- <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=author&direction=[% IF sortfield != 'author' %]asc[% ELSE %][% new_direction | uri %][% END %]">Author</a> >- </th> >- [% IF sortfield == 'dateadded' %] >- <th class="sorting_[% direction | html %]"> >- [% ELSE %] >- <th class="sorting"> >- [% END %] >- <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=dateadded&direction=[% IF sortfield != 'dateadded' %]asc[% ELSE %][% new_direction | uri %][% END %]">Date added</a> >- </th> >- [% IF sortfield == 'itemcallnumber' %] >- <th class="sorting_[% direction | html %]"> >- [% ELSE %] >- <th class="sorting"> >- [% END %] >- <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=itemcallnumber&direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction | uri %][% END %]">Call number</a> >- </th> >- </tr> >- </thead> >- [% FOREACH itemsloo IN itemsloop %] >- <tr> >- [% IF itemsloop %] >- <td> >- <input type="checkbox" class="selection" value="[% itemsloo.biblionumber | html %]" name="biblionumber" /> >- </td> >- [% END %] >- [% UNLESS ( item_level_itypes ) %] >- <td> >- [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %] >- <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" /> >- [% END %] >- <span class="itypetext">[% itemsloo.description | html %]</span> >- </td> >- [% END %] >- <td> >- [% IF ( itemsloo.XSLTBloc ) %] >- [% itemsloo.XSLTBloc | $raw %] >+ <div class="page-section"> >+ <table id="searchresults" class="dataTable"> >+ <thead> >+ <tr> >+ [% IF ( itemsloop ) %] >+ <th class="checkall" data-colname="checkbox"> </th> >+ [% END %] >+ [% UNLESS ( item_level_itypes ) %] >+ <th data-colname="item_type">Item type</th> >+ [% END %] >+ [% IF sortfield == 'title' %] >+ <th class="sorting_[% direction | html %]" data-colname="title"> > [% ELSE %] >- [% INCLUDE 'biblio-title.inc' biblio=itemsloo link = 1 %] >- </a> >+ <th class="sorting" data-colname="title"> > [% END %] >- <p class="hold"> >- [% IF ( itemsloo.notforloan ) %] >- <span class="noholdstext">No holds allowed</span> >- [% ELSE %] >- [% IF ( itemsloo.ITEM_RESULTS.count ) %] >- <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a> >- [% IF ( holdfor ) %] >- <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | uri %]&findborrower=[% holdfor_patron.cardnumber | uri %]">Place hold for [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 %]</a></span> >- [% END %] >- [% ELSE %] >- <span class="noholdstext">No holds allowed</span> >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=title&direction=[% IF sortfield != 'title' %]asc[% ELSE %][% new_direction | uri %][% END %]">Title</a> >+ </th> >+ [% IF sortfield == 'author' %] >+ <th class="sorting_[% direction | html %]" data-colname="author"> >+ [% ELSE %] >+ <th class="sorting" data-colname="author"> >+ [% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=author&direction=[% IF sortfield != 'author' %]asc[% ELSE %][% new_direction | uri %][% END %]">Author</a> >+ </th> >+ [% IF sortfield == 'dateadded' %] >+ <th class="sorting_[% direction | html %]" data-colname="date_added"> >+ [% ELSE %] >+ <th class="sorting" data-colname="date_added"> >+ [% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=dateadded&direction=[% IF sortfield != 'dateadded' %]asc[% ELSE %][% new_direction | uri %][% END %]">Date added</a> >+ </th> >+ [% IF sortfield == 'itemcallnumber' %] >+ <th class="sorting_[% direction | html %]" data-colname="call_number"> >+ [% ELSE %] >+ <th class="sorting" data-colname="call_number"> >+ [% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=itemcallnumber&direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction | uri %][% END %]">Call number</a> >+ </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH itemsloo IN itemsloop %] >+ <tr> >+ [% IF itemsloop %] >+ <td data-colname="checkbox"> >+ <input type="checkbox" class="selection" value="[% itemsloo.biblionumber | html %]" name="biblionumber" /> >+ </td> >+ [% END %] >+ [% UNLESS ( item_level_itypes ) %] >+ <td data-colname="item_type"> >+ [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %] >+ <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" /> > [% END %] >+ <span class="itypetext">[% itemsloo.description | html %]</span> >+ </td> >+ [% END %] >+ <td data-colname="title"> >+ [% IF ( itemsloo.XSLTBloc ) %] >+ [% itemsloo.XSLTBloc | $raw %] >+ [% ELSE %] >+ [% INCLUDE 'biblio-title.inc' biblio=itemsloo link = 1 %] >+ </a> > [% END %] >- [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] >- | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit record</a> >- [% END %] >- [% IF ( CAN_user_editcatalogue_edit_items ) %] >- | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit items</a> >- [% END %] >- </p> >- </td> >- <td> >- [% itemsloo.author | html %] >- </td> >- <td> >- [% itemsloo.dateadded | $KohaDates%] >- </td> >- <td> >- <ul> >- [% FOREACH item IN itemsloo.ITEM_RESULTS %] >- <li> >- [% Branches.GetName(item.holdingbranch) | html %] >- [% IF ( item.location ) %] >- <span class="shelvingloc"> >- [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] >- </span> >- [% END %] >- [% IF ( item.itemcallnumber ) %] >- [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>] >+ <p class="hold"> >+ [% IF ( itemsloo.notforloan ) %] >+ <span class="noholdstext">No holds allowed</span> >+ [% ELSE %] >+ [% IF ( itemsloo.ITEM_RESULTS.count ) %] >+ <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a> >+ [% IF ( holdfor ) %] >+ <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | uri %]&findborrower=[% holdfor_patron.cardnumber | uri %]">Place hold for [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 %]</a></span> >+ [% END %] >+ [% ELSE %] >+ <span class="noholdstext">No holds allowed</span> > [% END %] >- </li> >- [% END # /FOREACH item %] >- </ul> >- </td> >- </tr> >- [% END #/FOREACH itemsloo %] >- </table> <!-- /#searchresults --> >+ [% END %] >+ [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] >+ | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit record</a> >+ [% END %] >+ [% IF ( CAN_user_editcatalogue_edit_items ) %] >+ | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber | uri %]">Edit items</a> >+ [% END %] >+ </p> >+ </td> >+ <td data-colname="author"> >+ [% itemsloo.author | html %] >+ </td> >+ <td data-colname="date_added"> >+ [% itemsloo.dateadded | $KohaDates%] >+ </td> >+ <td data-colname="call_number"> >+ <ul> >+ [% FOREACH item IN itemsloo.ITEM_RESULTS %] >+ <li> >+ [% Branches.GetName(item.holdingbranch) | html %] >+ [% IF ( item.location ) %] >+ <span class="shelvingloc"> >+ [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] >+ </span> >+ [% END %] >+ [% IF ( item.itemcallnumber ) %] >+ [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>] >+ [% END %] >+ </li> >+ [% END # /FOREACH item %] >+ </ul> >+ </td> >+ </tr> >+ [% END #/FOREACH itemsloo %] >+ </tbody> >+ </table> <!-- /#searchresults --> >+ </div><!-- /.page-section --> > <div class="pages">[% pagination_bar | $raw %]</div> > </form> > [% END # /IF itemsloop %] >@@ -593,6 +597,7 @@ > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'columns_settings.inc' %] > [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] > [% IF print %] > <script> >@@ -617,7 +622,6 @@ > [% IF op == 'list' %] > $(document).ready(function(){ > var public = [% public | html %]; >- > var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, { > "aaSorting": [[ 5, "asc" ]], > 'bServerSide': true, >@@ -717,6 +721,13 @@ > [% IF shelf AND op == 'view' %] > var Sticky; > $(document).ready(function(){ >+ var column_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'lists', 'searchresults', 'json' ) | $raw %]; >+ KohaTable("searchresults", { >+ 'bPaginate': false, >+ 'bAutoWidth': false, >+ "bKohaColumnsUseNames": true, >+ "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', >+ }, column_settings ); > Sticky = $("#searchheader"); > Sticky.hcSticky({ > stickTo: "#listform", >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30031
:
130182
|
130183
|
131798
|
132037
|
132049
|
132050
|
132051
|
144887
|
144962
|
144966
|
158626
|
159084
|
159119
|
159859
|
162085
|
166716