Bug 23229: Only load ILL table JS when needed

This patch prevents the JS associated with the ILL table from loading
unless we're actually displaying the table. This has the knock on effect
of not causing the "get all ILL requests" API request to fire when
loading any ILL page.

Test plan:

- Go to "ILL requests" page
- TEST: Observe that the table loads all ILL requests
- Go to the "New ILL request" page for any installed backend
- TEST: Check the browser dev tools "Network" panel, observe that the
/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias,comments,requested_partners
request is not made.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f79da166ae)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5ab8a4c13e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Andrew Isherwood 2019-06-28 10:24:32 +01:00 committed by Lucas Gass
parent d30a8ac817
commit f95749a66b
1 changed files with 16 additions and 0 deletions

View File

@ -703,6 +703,22 @@
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
[% INCLUDE 'calendar.inc' %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
<script>
var prefilters = '[% prefilters | $raw %]';
// Set column settings
var columns_settings = [% ColumnsSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %];
</script>
[% IF query_type == 'illlist' %]
[% INCLUDE 'ill-list-table-strings.inc' %]
[% Asset.js("js/ill-list-table.js") | $raw %]
[% END %]
[% END %]
[% TRY %]
[% PROCESS backend_jsinclude %]
[% CATCH %]