Bug 38476

Summary: Use anchor tag for DataTables configure button
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Jonathan Druart <jonathan.druart>
Status: RESOLVED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: caroline.cyr-la-rose, david, emily.lamancusa, fridolin.somers, jonathan.druart, m.de.rooy, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
This fixes the "Configure" button for tables, so that you can now right-click and open the table settings in a new tab.
Version(s) released in:
25.05.00,24.11.01,24.05.06
Circulation function:
Attachments: Bug 38476: Make DT 'Configure' button a link
Bug 38476: Make DT 'Configure' button a link
Bug 38476: Make DT 'Configure' button a link

Description Owen Leonard 2024-11-18 15:52:31 UTC
I find it frustrating that I can't right-click or Ctrl+click a DataTable's "Configure" button. I would rather open a new tab than have to find my way back.

DataTables provides the option to define which element is used for a button, but it seems like some default event-handling prevents the link from working 100% like a link:

        buttons.push(
            {
                tag: "a",
                attr: {
                    href: '/cgi-bin/koha/admin/columns_settings.pl?module=' + table_settings['module'] + '&page=' + table_settings['page'] + '&table=' + table_settings['table']
                },
                className: "dt_button_configure_table",
                fade: 100,
                titleAttr: __("Configure table"),
                text: '<i class="fa fa-lg fa-wrench"></i> <span class="dt-button-text">' + __("Configure") + '</span>',
            }
        );

If you add only the href attribute, right-click and "Open in new tab" works, but a regular click does not, and Ctrl+click does not.

If you include only the "action" event handler function, both right-click plus "Open in new tab" and Ctrl+click do not work, but a regular click does.

If you include both the href attribute and the event handler, Ctrl+click doesn't work.

I wonder if there is a way to override the default event handling so that a regular link can work like a regular link?
Comment 1 Emily Lamancusa (emlam) 2024-11-18 20:42:23 UTC
+1 for this! I've also thought many times that I wish I could click the configuration button to open the page in a new window.
Comment 2 Jonathan Druart 2024-11-19 10:16:53 UTC
Created attachment 174765 [details] [review]
Bug 38476: Make DT 'Configure' button a link

So that we can open in a separate bug using right click.
Comment 3 Jonathan Druart 2024-11-19 10:17:25 UTC
Why not keeping the 'action' to make regular clicks work?
Comment 4 Owen Leonard 2024-11-20 15:24:50 UTC
Created attachment 174849 [details] [review]
Bug 38476: Make DT 'Configure' button a link

So that we can open in a separate bug using right click.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Owen Leonard 2024-11-20 15:25:45 UTC
I was hoping we might find a solution which also works with a Ctrl+click, but that's probably the least common way the general user will interact with the button.
Comment 6 Marcel de Rooy 2024-11-22 10:58:30 UTC
(In reply to Jonathan Druart from comment #2)
> So that we can open in a separate bug using right click.

In a separate bug? :)
Comment 7 Marcel de Rooy 2024-11-22 10:59:19 UTC
Created attachment 174923 [details] [review]
Bug 38476: Make DT 'Configure' button a link

So that we can open in a separate bug using right click.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Marcel de Rooy 2024-11-22 10:59:47 UTC
(In reply to Marcel de Rooy from comment #6)
> (In reply to Jonathan Druart from comment #2)
> > So that we can open in a separate bug using right click.
> 
> In a separate bug? :)

Wonder if it should be a separate enhancment btw, haha
Comment 9 Katrin Fischer 2024-12-03 16:36:25 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 10 Paul Derscheid 2024-12-12 13:31:18 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.01
Comment 11 Wainui Witika-Park 2024-12-17 01:48:36 UTC
Backported to 24.05.x for 24.05.06
Comment 12 Fridolin Somers 2024-12-18 15:50:16 UTC
Great, but I prefer not backport to 23.11.x for UI stability
Comment 13 Caroline Cyr La Rose 2025-04-18 18:52:51 UTC
(In reply to Owen Leonard from comment #5)
> I was hoping we might find a solution which also works with a Ctrl+click,
> but that's probably the least common way the general user will interact with
> the button.

That is also how I open things in new tabs. Right-click, what's that? ;)
Comment 14 Caroline Cyr La Rose 2025-04-18 18:53:45 UTC
This feels like a bug fix, nothing to add/edit in the manual.