Bug 15867 - Move MARC modification templates JavaScript into separate file
Summary: Move MARC modification templates JavaScript into separate file
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-19 17:59 UTC by Owen Leonard
Modified: 2017-06-14 22:08 UTC (History)
4 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:
Circulation function:


Attachments
Bug 15867 - Move MARC modification templates JavaScript into separate file (23.07 KB, patch)
2016-02-19 19:19 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 15867: Move MARC modification templates JavaScript into separate file (23.12 KB, patch)
2016-02-23 15:04 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 15867: Move MARC modification templates JavaScript into separate file (23.18 KB, patch)
2016-02-29 15:48 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-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