Bug 16576

Summary: Remove the use of "onclick" from label templates
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: f.demians, gmcharlt, hector.hecaxmmx, jonathan.druart, katrin.fischer, kyle, testopia, veron
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 16576 - Remove the use of "onclick" from label templates
Bug 16576 - Remove the use of "onclick" from label templates
Bug 16576 [Revised] Remove the use of "onclick" from label templates
[SIGNED-OFF]Bug 16576 [Revised] Remove the use of "onclick" from label templates
Bug 16576 [Revised] Remove the use of "onclick" from label templates

Description Owen Leonard 2016-05-24 14:43:59 UTC
There are several places in the label creator templates where where an "onclick" attribute is used. These should be rewritten so that JS functionality can be separate from the markup.
Comment 1 Owen Leonard 2016-05-24 15:19:06 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2016-05-28 18:44:10 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-06-21 13:09:15 UTC
Owen,
Have a look at the pagination on labels/label-item-search.pl, your patch breaks it.
Comment 4 Owen Leonard 2016-07-13 20:41:05 UTC Comment hidden (obsolete)
Comment 5 Héctor Eduardo Castro Avalos 2016-07-15 17:20:20 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2016-07-25 11:13:00 UTC
Created attachment 53680 [details] [review]
Bug 16576 [Revised] Remove the use of "onclick" from label templates

This patch updates several label creator templates to remove the use of
"onclick" in favor of defining click events in JavaScript.

Also changed:
 - Replaced the non-existant element <icon> with <i>
 - Removed the use of <center> and 'align="center"';
 - In the item search results template:
   - The use of the checkboxes jQuery plugin has been replaced with
     straight jQuery for simplicity's sake.
   - Output of table headers has been modified so that translatable
     strings are in the template instead of having English strings
     passed from the script.
   - Moved the 'Add checked' and 'Done' buttons into a floating toolbar.

To test, apply the patch and go to Tools -> Label creator.

- Choose New -> Label batch
  - Click 'Add items'
    - Perform a search for items.
    - Confirm that 'select all' and 'clear all' links work.
    - Confirm that clicking an individual 'Add' button works.
    - Select multiple items and click the 'Add checked' button. Confirm
      that the selected items were added to your batch.
  - Click 'Add items' again to save the selected items to your batch.
  - Test that the 'Delete' and 'Export' buttons next to any item work
    correctly.
- Choose Manage -> Label batches
  - Test that the 'Delete' button works correctly.
  - Select one or more batches and test that the 'Export selected'
    button works correctly.

Revision: Removed changes to pagination in the item search results
template since it didn't work.

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Kyle M Hall 2016-09-09 13:10:43 UTC
Pushed to master for 16.11, thanks Owen!
Comment 8 Frédéric Demians 2016-09-13 07:00:52 UTC
Pushed in 16.05. Will be in 16.05.04.