Bug 17418

Summary: Move staff client home page JavaScript to the footer
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: bouzid.fergani, jonathan.druart, katrin.fischer, kyle, philippe.blouin
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17790
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 17416    
Bug Blocks: 17858, 17859, 17870, 17893, 19041    
Attachments: Bug 17418 - Move staff client home page JavaScript to the footer
Bug 17418 - Move staff client home page JavaScript to the footer
Bug 17418 - Move staff client home page JavaScript to the footer

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.