fix(sidebar_item): make open URL behavior configurable
added an "Open in new tab" checkbox to sidebar item settings, giving users direct control over how URLs are opened. defaults to checked (_blank) to preserve existing behavior
This commit is contained in:
parent
94a50655a3
commit
7e4b55977c
3 changed files with 10 additions and 1 deletions
|
|
@ -585,6 +585,7 @@ def get_sidebar_items(allowed_workspaces):
|
|||
"filters": item.filters,
|
||||
"route_options": item.route_options,
|
||||
"tab": item.navigate_to_tab,
|
||||
"open_in_new_tab": item.open_in_new_tab,
|
||||
}
|
||||
if item.link_type == "Report" and item.link_to and frappe.db.exists("Report", item.link_to):
|
||||
report_type, ref_doctype = frappe.db.get_value(
|
||||
|
|
|
|||
|
|
@ -333,6 +333,14 @@ export class SidebarEditor {
|
|||
fieldtype: "Data",
|
||||
label: "URL",
|
||||
},
|
||||
{
|
||||
depends_on: 'eval: doc.link_type == "URL"',
|
||||
fieldname: "open_in_new_tab",
|
||||
fieldtype: "Check",
|
||||
default: "1",
|
||||
label: "Open in New Tab",
|
||||
description: "open the URL in a new browser tab",
|
||||
},
|
||||
{
|
||||
depends_on:
|
||||
'eval: doc.type == "Link" || (doc.indent == 1 && doc.type == "Section Break")',
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<a
|
||||
{% if (path) { %}
|
||||
href="{{ path }}"
|
||||
target="{%= item.link_type === "URL" ? "_blank" : "" %}"
|
||||
target="{%= item.link_type === "URL" && item.open_in_new_tab ? "_blank" : "" %}"
|
||||
{% } %}
|
||||
class="item-anchor"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue