Bug 17418 - Move staff client home page JavaScript to the footer
Summary: Move staff client home page JavaScript to the footer
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 17416
Blocks: 17858 17859 17870 17893 19041
  Show dependency treegraph
 
Reported: 2016-10-10 13:07 UTC by Owen Leonard
Modified: 2018-06-04 20:10 UTC (History)
5 users (show)

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


Attachments
Bug 17418 - Move staff client home page JavaScript to the footer (7.57 KB, patch)
2016-10-10 14:13 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 17418 - Move staff client home page JavaScript to the footer (7.59 KB, patch)
2016-10-11 10:19 UTC, Claire Gravely
Details | Diff | Splinter Review
Bug 17418 - Move staff client home page JavaScript to the footer (7.65 KB, patch)
2016-11-23 09:26 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2016-10-10 13:07:50 UTC
This patch will do two things:

1. Update the header and footer include files in order to be able to manage JavaScript either in the header or the footer.
2. Modify the staff client home page as a proof of concept, moving global and in-page JavaScript assets to the footer.
Comment 1 Owen Leonard 2016-10-10 14:13:58 UTC
Created attachment 56115 [details] [review]
Bug 17418 - Move staff client home page JavaScript to the footer

This patch alters the header and footer include files so that JavaScript
can be included in either one or the other. As a proof of concept, the
staff client home page is updated to include JS in the footer instead
of the header.

The processing of JavaScript included on individual pages can now be
similar to how it is done in the OPAC. A block is created with the
page's JavaScript which is then processed in js_includes.inc in the
correct order, after other required js assets.

On pages which have been modified to allow JavaScript to be moved to the
footer you must add a variable to the template: [% SET footerjs = 1 %].
Eventually all staff client templates should be modified so that setting
a flag is not required.

"[% MACRO jsinclude BLOCK %]" is used instead of "[% BLOCK %]" and "[%
PROCESS %]" because MACRO allows the template directives to be
processed correctly when included by intranet-bottom.inc.

To test, apply the patch and view the staff client home page.

- Confirm that you get a confirmation when deleting a news item from the
  home page.
- Enable the CircAutocompl system preference and test that patron
  autocomplete works from the "Check out" tab from the staff home page
  and from other pages where the "Check out" tab is present.
- Test that JavaScript is working correctly on other pages like
  Circulation, Preferences, etc.
Comment 2 Claire Gravely 2016-10-11 10:19:09 UTC
Created attachment 56164 [details] [review]
Bug 17418 - Move staff client home page JavaScript to the footer

This patch alters the header and footer include files so that JavaScript
can be included in either one or the other. As a proof of concept, the
staff client home page is updated to include JS in the footer instead
of the header.

The processing of JavaScript included on individual pages can now be
similar to how it is done in the OPAC. A block is created with the
page's JavaScript which is then processed in js_includes.inc in the
correct order, after other required js assets.

On pages which have been modified to allow JavaScript to be moved to the
footer you must add a variable to the template: [% SET footerjs = 1 %].
Eventually all staff client templates should be modified so that setting
a flag is not required.

"[% MACRO jsinclude BLOCK %]" is used instead of "[% BLOCK %]" and "[%
PROCESS %]" because MACRO allows the template directives to be
processed correctly when included by intranet-bottom.inc.

To test, apply the patch and view the staff client home page.

- Confirm that you get a confirmation when deleting a news item from the
  home page.
- Enable the CircAutocompl system preference and test that patron
  autocomplete works from the "Check out" tab from the staff home page
  and from other pages where the "Check out" tab is present.
- Test that JavaScript is working correctly on other pages like
  Circulation, Preferences, etc.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Comment 3 Jonathan Druart 2016-11-23 09:26:31 UTC
Created attachment 57723 [details] [review]
Bug 17418 - Move staff client home page JavaScript to the footer

This patch alters the header and footer include files so that JavaScript
can be included in either one or the other. As a proof of concept, the
staff client home page is updated to include JS in the footer instead
of the header.

The processing of JavaScript included on individual pages can now be
similar to how it is done in the OPAC. A block is created with the
page's JavaScript which is then processed in js_includes.inc in the
correct order, after other required js assets.

On pages which have been modified to allow JavaScript to be moved to the
footer you must add a variable to the template: [% SET footerjs = 1 %].
Eventually all staff client templates should be modified so that setting
a flag is not required.

"[% MACRO jsinclude BLOCK %]" is used instead of "[% BLOCK %]" and "[%
PROCESS %]" because MACRO allows the template directives to be
processed correctly when included by intranet-bottom.inc.

To test, apply the patch and view the staff client home page.

- Confirm that you get a confirmation when deleting a news item from the
  home page.
- Enable the CircAutocompl system preference and test that patron
  autocomplete works from the "Check out" tab from the staff home page
  and from other pages where the "Check out" tab is present.
- Test that JavaScript is working correctly on other pages like
  Circulation, Preferences, etc.

Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 4 Kyle M Hall 2016-12-16 11:53:35 UTC
Pushed to master for 17.05, thanks Owen!
Comment 5 Katrin Fischer 2016-12-18 20:36:50 UTC
This won't get backported to 16.11.x as it is an enhancement.
Comment 6 Bouzid Fergani 2016-12-19 14:37:19 UTC
BREAK CATALOGUING MODULE
    - Koha home
    - Cataloguing
    - New record
    - Number 1 to 9 is not show correctly.
error javascript :  TypeError: $(...).autocomplete(...).data(...) is undefined
Comment 7 Jonathan Druart 2016-12-20 14:32:59 UTC
(In reply to Bouzid from comment #6)
> BREAK CATALOGUING MODULE
>     - Koha home
>     - Cataloguing
>     - New record
>     - Number 1 to 9 is not show correctly.
> error javascript :  TypeError: $(...).autocomplete(...).data(...) is
> undefined

Must be fixed bug 17790, otherwise open a new bug report.