Bug 38476 - Use anchor tag for DataTables configure button
Summary: Use anchor tag for DataTables configure button
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-18 15:52 UTC by Owen Leonard
Modified: 2024-12-03 16:36 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 38476: Make DT 'Configure' button a link (1.60 KB, patch)
2024-11-19 10:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 38476: Make DT 'Configure' button a link (1.64 KB, patch)
2024-11-20 15:24 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 38476: Make DT 'Configure' button a link (1.74 KB, patch)
2024-11-22 10:59 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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!