Listview fixes (#4997)

This commit is contained in:
Faris Ansari 2018-02-12 14:35:38 +05:30 committed by GitHub
parent 70d4a2f24e
commit 2bc7ff437e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 11 deletions

View file

@ -723,7 +723,6 @@ body[data-route^="Form/Communication"] textarea[data-fieldname="subject"] {
margin-top: 5px;
}
.frappe-control[data-fieldtype="Attach"] .attached-file .close {
margin-right: -7px;
position: absolute;
top: 0;
right: 0;

View file

@ -130,7 +130,6 @@
}
.list-subject {
flex: 2;
font-weight: bold;
justify-content: start;
}
.list-subject .level-item {

View file

@ -72,9 +72,7 @@ frappe.views.BaseList = class BaseList {
set_fields() {
let fields = [].concat(
frappe.model.std_fields_list,
this.get_fields_in_list_view(),
[this.meta.title_field, this.meta.image_field],
(this.settings.add_fields || [])
this.meta.title_field
);
fields.forEach(f => this._add_field(f));
@ -119,7 +117,8 @@ frappe.views.BaseList = class BaseList {
}
const is_valid_field = frappe.model.std_fields_list.includes(fieldname)
|| frappe.meta.has_field(doctype, fieldname);
|| frappe.meta.has_field(doctype, fieldname)
|| fieldname === '_seen';
if (!is_valid_field) {
return;

View file

@ -343,9 +343,8 @@ frappe.views.ListSidebar = Class.extend({
});
},
setup_assigned_to_me: function() {
var me = this;
this.page.sidebar.find(".assigned-to-me a").on("click", function() {
me.list_view.assigned_to_me();
this.page.sidebar.find(".assigned-to-me a").on("click", () => {
this.list_view.filter_area.add(this.list_view.doctype, "_assign", "like", `%${frappe.session.user}%`);
});
},
setup_upgrade_box: function() {

View file

@ -59,6 +59,18 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
this.patch_refresh_and_load_lib();
}
set_fields() {
let fields = [].concat(
frappe.model.std_fields_list,
this.get_fields_in_list_view(),
[this.meta.title_field, this.meta.image_field],
(this.settings.add_fields || []),
this.meta.track_seen ? '_seen' : null
);
fields.forEach(f => this._add_field(f));
}
patch_refresh_and_load_lib() {
// throttle refresh for 1s
this.refresh = this.refresh.bind(this);
@ -526,7 +538,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
'liked-by' : 'text-extra-muted not-liked';
const seen = JSON.parse(doc._seen || '[]')
.includes(user) ? 'seen' : '';
.includes(user) ? '' : 'bold';
let subject_html = `
<input class="level-item list-row-checkbox hidden-xs" type="checkbox" data-name="${doc.name}">

View file

@ -1,6 +1,9 @@
frappe.ui.Filter = class {
constructor(opts) {
$.extend(this, opts);
if (this.value === null || this.value === undefined) {
this.value = '';
}
this.utils = frappe.ui.filter_utils;
this.conditions = [

View file

@ -163,7 +163,6 @@
.list-subject {
flex: 2;
font-weight: bold;
justify-content: start;
.level-item {