feat(listview): move likes to the right

This commit is contained in:
barredterra 2023-10-08 16:00:44 +02:00
parent b8677d8d56
commit ca2e04d35d
2 changed files with 20 additions and 18 deletions

View file

@ -631,9 +631,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
let subject_html = `
<input class="level-item list-check-all" type="checkbox"
title="${__("Select All")}">
<span class="level-item list-liked-by-me hidden-xs">
<span title="${__("Likes")}">${frappe.utils.icon("es-solid-heart", "sm", "like-icon")}</span>
</span>
<span class="level-item" data-sort-by="${subject_field.fieldname}"
title="${__("Click to sort by {0}", [subject_field.label])}">
${__(subject_field.label)}
@ -667,7 +664,16 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
})
.join("");
return this.get_header_html_skeleton($columns, '<span class="list-count"></span>');
const right_html = `
<span class="list-count"></span>
<span class="level-item list-liked-by-me hidden-xs">
<span title="${__("Liked by me")}">
${frappe.utils.icon("es-solid-heart", "sm", "like-icon")}
</span>
</span>
`;
return this.get_header_html_skeleton($columns, right_html);
}
get_header_html_skeleton(left = "", right = "") {
@ -909,19 +915,23 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
let comment_count = null;
if (this.list_view_settings && !this.list_view_settings.disable_comment_count) {
comment_count = $(`<span class="comment-count"></span>`);
comment_count = $(`<span class="comment-count d-flex align-items-center"></span>`);
$(comment_count).append(`
${frappe.utils.icon("es-line-chat-alt")}
${doc._comment_count > 99 ? "99+" : doc._comment_count || 0}`);
}
html += `
<div class="level-item list-row-activity hidden-xs">
<div class="level-item list-row-activity hidden-xs d-flex align-items-center">
<div class="hidden-md hidden-xs">
${settings_button || assigned_to}
</div>
${modified}
<span class="modified">${modified}</span>
${comment_count ? $(comment_count).prop("outerHTML") : ""}
${comment_count ? '<span class="mx-2">·</span>' : ""}
<span class="list-row-like hidden-xs style="margin-bottom: 1px;">
${this.get_like_html(doc)}
</span>
</div>
<div class="level-item visible-xs text-right">
${this.get_indicator_dot(doc)}
@ -1012,9 +1022,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
div.innerHTML = `
<span class="level-item select-like">
<input class="list-row-checkbox" type="checkbox">
<span class="list-row-like hidden-xs style="margin-bottom: 1px;">
${this.get_like_html(doc)}
</span>
</span>
<span class="level-item ${seen} ellipsis">
<a class="ellipsis"></a>

View file

@ -118,10 +118,10 @@
&> span {
display: inline-block;
}
&:not(:last-child) {
margin-right: 15px;
}
.modified {
margin-right: var(--margin-sm);
}
.comment-count {
@ -131,7 +131,6 @@
.frappe-timestamp {
font-size: var(--text-xs);
white-space: nowrap;
min-width: 30px;
}
.list-assignments, .list-actions {
@ -195,10 +194,6 @@ $level-margin-right: 8px;
color: var(--text-color);
}
.level-item:not(.file-select) {
margin-right: $level-margin-right;
}
&.seen {
font-weight: normal;
}