From f1dd3da3f022d12320848ca61bb9ab84d7211d78 Mon Sep 17 00:00:00 2001 From: Shrihari Mahabal Date: Tue, 24 Feb 2026 12:23:41 +0530 Subject: [PATCH] refactor: remove add icon for add doc button with large doctype name --- frappe/public/js/frappe/list/list_view.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index 6473db896e..375cee1d0a 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -291,9 +291,9 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { set_primary_action() { if (this.can_create && !frappe.boot.read_only) { const doctype_name = __(frappe.router.doctype_layout) || __(this.doctype); - const full_label = __("Add {0}", [doctype_name], "Primary action in list view"); + const add_button_label = __("Add {0}", [doctype_name], "Primary action in list view"); const create_button = this.page.set_primary_action( - full_label, + add_button_label, () => { if (this.settings.primary_action) { this.settings.primary_action(); @@ -306,28 +306,23 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { if (frappe.is_mobile()) { create_button.append(__("Add")); } else { - this._trim_primary_action_if_overflow(create_button, full_label); + this._trim_primary_action_if_overflow(create_button, add_button_label); } } else { this.page.clear_primary_action(); } } - _trim_primary_action_if_overflow(btn, full_label) { + _trim_primary_action_if_overflow(btn, add_button_label) { const container = this.page.wrapper.find(".page-head-content")[0]; if (!container || !btn[0]) return; const containerRect = container.getBoundingClientRect(); const btnRect = btn[0].getBoundingClientRect(); if (btnRect.right > containerRect.right) { const short_label = __("Add"); - btn.attr("title", full_label) - .tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" }) - .html( - `${frappe.utils.icon( - "add", - "xs" - )} ` - ); + btn.attr("title", add_button_label) + .tooltip({ delay: { show: 100, hide: 100 }, trigger: "hover" }) + .html(``); } }