fix(ListView): remove seperator if no data
This commit is contained in:
parent
c88cd6e1d3
commit
dfd8e8a13c
2 changed files with 17 additions and 1 deletions
|
|
@ -783,9 +783,14 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
|
||||
get_left_html(doc) {
|
||||
let left_html = "";
|
||||
let has_value_in_second_column = true;
|
||||
for (let i = 0; i < this.columns.length; i++) {
|
||||
let col = this.columns[i];
|
||||
|
||||
if (i == 4 && !doc[col.df.fieldname]) {
|
||||
has_value_in_second_column = false;
|
||||
}
|
||||
|
||||
if (frappe.is_mobile() && col.type == "Field" && [3, 4].includes(i)) {
|
||||
left_html += `<div class="mobile-layout">${this.get_column_html(
|
||||
col,
|
||||
|
|
@ -797,6 +802,17 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
}
|
||||
}
|
||||
|
||||
if (!has_value_in_second_column) {
|
||||
const container = document.createElement("div");
|
||||
container.innerHTML = left_html;
|
||||
const firstMobileLayout = container.querySelector(".mobile-layout");
|
||||
|
||||
if (firstMobileLayout) {
|
||||
firstMobileLayout.classList.add("no-seperator");
|
||||
}
|
||||
left_html = container.innerHTML;
|
||||
}
|
||||
|
||||
left_html += this.generate_button_html(doc);
|
||||
left_html += this.generate_dropdown_html(doc);
|
||||
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ input.list-header-checkbox {
|
|||
padding-left: 27px;
|
||||
margin-right: 6px;
|
||||
|
||||
&::after {
|
||||
&:not(.no-seperator)::after {
|
||||
content: "\2022";
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue