Bug 15867

Summary: Move MARC modification templates JavaScript into separate file
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: brendan, hector.hecaxmmx, julian.maurice, testopia
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 15867 - Move MARC modification templates JavaScript into separate file
[SIGNED-OFF]Bug 15867: Move MARC modification templates JavaScript into separate file
Bug 15867: Move MARC modification templates JavaScript into separate file

Description Owen Leonard 2016-02-19 17:59:12 UTC
Coding guideline JS1 (https://wiki.koha-community.org/wiki/Coding_Guidelines#JS1:_Embedding_JavaScript_blocks_in_templates) says "Whenever possible JavaScript should be placed in a separate file."

The JavaScript embedded in tools/marc_modification_templates.tt is not so dependent on template processing that it can't be safely moved to a separate file.
Comment 1 Owen Leonard 2016-02-19 19:19:48 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2016-02-23 14:50:20 UTC
Hi Owen

JSHint give me one error:

koha-tmpl/intranet-tmpl/prog/en/js/marc_modification_templates.js: line 182, col 14, 'i' is already defined.

1 error
Comment 3 Owen Leonard 2016-02-23 15:01:53 UTC
(In reply to Héctor Eduardo Castro Avalos from comment #2)
> JSHint give me one error:
> 
> koha-tmpl/intranet-tmpl/prog/en/js/marc_modification_templates.js: line 182,
> col 14, 'i' is already defined.

I think that is a case where the warning can be ignored, since "i" is only being used in the for loop.
Comment 4 Héctor Eduardo Castro Avalos 2016-02-23 15:04:45 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-02-29 15:48:14 UTC
Created attachment 48461 [details] [review]
Bug 15867: Move MARC modification templates JavaScript into separate file

The JavaScript embedded in the MARC modification templates template is
not dependent on template processing to such an extent that it can't
be safely moved to a separate file. This patch does so, adding
definition of a some translatable strings to the template.

Other minor changes: A couple of JSHint warnings corrected, a couple of
missing semicolons added to template markup.

To test, apply the patch and go to Tools -> MARC modification templates

- Confirm that The add/update form works normally with various actions
  (Add/update,Delete,Move, etc.).
- Confirm that template switching works correctly.
- Confirm that template deletion confirmation works correctly.
- Confirm that cancelling an edit works correctly

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Brendan Gallagher 2016-03-02 03:20:20 UTC
Pushed to Master - Should be in the May 2016 Release.  Thanks!
Comment 7 Julian Maurice 2016-03-07 11:24:55 UTC
severity changed to enhancement