Merge pull request #38156 from sokumon/info-card-fixes

This commit is contained in:
Soham Kulkarni 2026-03-25 12:26:18 +05:30 committed by GitHub
commit 9da1c63189
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 5 deletions

View file

@ -15,7 +15,7 @@ export class InfoCard {
"sm",
"",
"",
"cursor-pointer m-0"
"cursor-pointer m-0 info-trigger"
)}`
).appendTo($(this.label_span));
$(this.label_span).find("svg").attr("role", "button");
@ -54,7 +54,7 @@ export class InfoCard {
setup_click() {
const me = this;
$(this.label_span)
.find("svg")
.find(".info-trigger")
.on("click", (event) => {
event.preventDefault();
me.card.toggle();

View file

@ -27,6 +27,9 @@ frappe.ui.SidebarCard = class SidebarCard {
card: this,
})
);
if (!this.primary_action_label) {
this.card.css("gap", "0px");
}
if (this.dismiss_it_for) {
const next_time_for_show = localStorage.getItem(this.get_dismiss_key());
if (next_time_for_show && Date.now() < Number(next_time_for_show)) {
@ -36,6 +39,7 @@ frappe.ui.SidebarCard = class SidebarCard {
}
if (this.popper) {
this.popper = createPopper($(this.trigger).get(0), $(this.parent).get(0), {
placement: "auto",
modifiers: [
{
name: "offset",
@ -52,7 +56,7 @@ frappe.ui.SidebarCard = class SidebarCard {
}
this.card.prependTo(this.parent);
this.set_button_alignment();
this.show();
if (!this.popper) this.show();
}
setup() {
this.setup_primary_action();
@ -91,7 +95,8 @@ frappe.ui.SidebarCard = class SidebarCard {
setup_close_button() {
const me = this;
if (this.close_button) {
this.card.find(".close-button").on("click", function () {
this.card.find(".close-button").on("click", function (event) {
event.preventDefault();
if (me.dismiss_it_for) {
let next_show_time = Date.now() + me.dismiss_intervals[me.dismiss_it_for];

View file

@ -185,4 +185,5 @@ body {
box-shadow: 0px 18px 22px -6px rgba(0, 0, 0, 0.1), 0px 0px 6px 3px rgba(0, 0, 0, 0.03),
0px 0px 1.5px 0px rgba(0, 0, 0, 0.18);
}
min-width: calc(var(--sm-width) - 360px);
}

View file

@ -27,7 +27,6 @@
width: 100%;
background-color: var(--surface-modal);
box-shadow: var(--shadow-sm);
gap: 12px;
border-radius: 12px;
}
.sidebar-card-description {