Bug 16148

Summary: Revised layout and behavior of marc modification template management
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, kyle, sandboxes, veron
Version: Main   
Hardware: All   
OS: All   
URL: /cgi-bin/koha/tools/marc_modification_templates.pl
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 16793, 17916    
Attachments: Bug 16148 - Revised layout and behavior of marc modification template management
Bug 16148 - Revised layout and behavior of marc modification template management
Bug 16148 - Revised layout and behavior of marc modification template management
Bug 16148 - Revised layout and behavior of marc modification template management
Bug 16148: Add preventDefault to avoid the scrollbar to move to the top
Bug 16148 [Follow-up] Revised layout and behavior of marc modification template management
Bug 16148 - Revised layout and behavior of marc modification template management
Bug 16148: Add preventDefault to avoid the scrollbar to move to the top
Bug 16148 [Follow-up] Revised layout and behavior of marc modification template management
Bug 16148: Fix submit button text
Bug 16148 [Follow-up] - Use Font Awesome for arrows instead of images
Bug 16148 [Follow-up] - Use Font Awesome for arrows instead of images
[SIGNED-OFF] Bug 16148 [Follow-up] - Use Font Awesome for arrows instead of images

Description Owen Leonard 2016-03-25 15:25:46 UTC
The marc modification template management page is a sort of all-in-one interface with lots of different kinds of actions appearing at the same time. The screen is more complicated and (in my opinion) harder to approach initially than other pages which are divided into the same categories of interactions (list, add, edit).

I propose a revision which shows and hides sections of the page so that each task can be given better focus.
Comment 1 Owen Leonard 2016-03-25 16:32:48 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2016-03-26 10:22:48 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-03-30 14:46:53 UTC
There is a bug when you click on "edit an action" and then on "new action".

I am wondering if we should not display all the actions when there are only 3 buttons and there is not a lot of columns (2 here), to avoid 1 click.
Comment 4 Owen Leonard 2016-05-17 14:30:11 UTC Comment hidden (obsolete)
Comment 5 PTFS Europe Sandboxes 2016-06-03 09:23:15 UTC
Patch tested with a sandbox, by Filippos Kolovos <f.kolovos@gmail.com>
Comment 6 PTFS Europe Sandboxes 2016-06-03 09:23:37 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2016-06-06 13:43:27 UTC
Owen, The dropdown list does not select the template when I want to duplicate an existing template.
It comes from a JS error (TypeError: document.getElementById(...) is null) raised by marc_modification_templates.js line 2
     window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
Comment 8 Jonathan Druart 2016-06-06 13:44:51 UTC Comment hidden (obsolete)
Comment 9 Owen Leonard 2016-06-14 14:30:37 UTC Comment hidden (obsolete)
Comment 10 Jonathan Druart 2016-06-14 15:18:19 UTC
Created attachment 52382 [details] [review]
Bug 16148 - Revised layout and behavior of marc modification template management

This patch makes changes to the layout and behavior of the marc
modification template management page to make it adhere better to common
interaction patterns in Koha.

- The initial view shows a list of templates rather than pre-selecting
  the first available template for editing.

- A toolbar has been added with a "New template" button.

- The initial view of existing templates has an actions menu containing
  menu items for 'Edit actions,' 'Duplicate,' and 'Delete.' It doesn't
  appear to be possible to edit an existing template's name.

- The "Create template" form is no longer shown all the time.
  - Clicking the "New template" toolbar button triggers a modal with the
    form for creating a template. An existing template can be chosen to
    duplicate.
  - Choosing "Duplicate" from one of the template menus triggers the
    "New template" modal and preselects the corresponding template in
    the "duplicate" <select>.

- When editing actions for a template:
  - The breadcrumbs menu now reflects that a template is being modified.
  - The template name has been added as a heading.
  - A "New action" button appears in the toolbar
  - The "Edit" and "Delete" links now have a Bootstrap button style.
  - The add/edit form is now hidden by default.
  - Clicking "New action" or "edit" shows the add or edit form.
  - Clicking "Cancel" in the add/edit form hides the form.

To test, apply the patch and clear your cache if necessary.

- Got to Tools ->  MARC modification templates
- Test the "New template" button.
  - Confirm that new template creation works.
  - Confirm that duplicating a template works.
- Test the menu items in the "Actions" menu:
  - "Duplicate" should trigger the new template modal and preselect the
    template you chose to duplicate. Confirm that the template is
    successfully duplicated.
  - "Delete" should prompt you to confirm the deletion. Test both
    cancelling and confirming this operation.
  - "Edit actions" should load the page for adding or editing actions to
    a template. Test the operations on this page: New action, edit,
    delete, changing action order.

    Note that this patch does not fix Bug 15814, so action descriptions
    must still not contain single quotes.

Signed-off-by: Filippos Kolovos <f.kolovos@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2016-06-14 15:18:31 UTC
Created attachment 52383 [details] [review]
Bug 16148: Add preventDefault to avoid the scrollbar to move to the top

.. when click on buttons

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Jonathan Druart 2016-06-14 15:18:39 UTC
Created attachment 52384 [details] [review]
Bug 16148 [Follow-up] Revised layout and behavior of marc modification template management

This follow-up corrects a JavaScript error by using jQuery, which is is
more forgiving when selecting elements which may not exist on the page.

Also changed: Corrected a duplicate class attribute and fixed a jshint
error.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2016-06-14 15:18:44 UTC
Created attachment 52385 [details] [review]
Bug 16148: Fix submit button text

The text of the submit button should be init getting the val(), and not
the text().

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Kyle M Hall (khall) 2016-06-17 15:38:27 UTC Comment hidden (obsolete)
Comment 15 Kyle M Hall (khall) 2016-06-17 15:54:44 UTC Comment hidden (obsolete)
Comment 16 Owen Leonard 2016-06-17 15:57:07 UTC
Created attachment 52486 [details] [review]
[SIGNED-OFF] Bug 16148 [Follow-up] - Use Font Awesome for arrows instead of images

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 17 Kyle M Hall (khall) 2016-06-17 16:12:35 UTC
Pushed to master for 16.11, thanks Owen, Jonathan!