Просмотр исходного кода

[fix] comment paging and count (#4459)

version-14
Rushabh Mehta 7 лет назад
committed by GitHub
Родитель
Сommit
92c62a1c31
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
3 измененных файлов: 7 добавлений и 2 удалений
  1. +1
    -0
      frappe/desk/form/load.py
  2. +4
    -0
      frappe/public/js/frappe/form/footer/timeline.js
  3. +2
    -2
      frappe/public/js/frappe/form/form_sidebar.js

+ 1
- 0
frappe/desk/form/load.py Просмотреть файл

@@ -94,6 +94,7 @@ def get_docinfo(doc=None, doctype=None, name=None):
frappe.response["docinfo"] = { frappe.response["docinfo"] = {
"attachments": get_attachments(doc.doctype, doc.name), "attachments": get_attachments(doc.doctype, doc.name),
"communications": _get_communications(doc.doctype, doc.name), "communications": _get_communications(doc.doctype, doc.name),
'total_comments': len(json.loads(doc.get('_comments') or '[]')),
'versions': get_versions(doc), 'versions': get_versions(doc),
"assignments": get_assignments(doc.doctype, doc.name), "assignments": get_assignments(doc.doctype, doc.name),
"permissions": get_doc_permissions(doc), "permissions": get_doc_permissions(doc),


+ 4
- 0
frappe/public/js/frappe/form/footer/timeline.js Просмотреть файл

@@ -51,6 +51,10 @@ frappe.ui.form.Timeline = Class.extend({
var communications = me.get_communications().concat(new_communications); var communications = me.get_communications().concat(new_communications);
frappe.model.set_docinfo(me.frm.doc.doctype, me.frm.doc.name, "communications", communications); frappe.model.set_docinfo(me.frm.doc.doctype, me.frm.doc.name, "communications", communications);


if (new_communications.length < 20) {
me.more = false;
}

} else { } else {
me.more = false; me.more = false;
} }


+ 2
- 2
frappe/public/js/frappe/form/form_sidebar.js Просмотреть файл

@@ -70,10 +70,10 @@ frappe.ui.form.Sidebar = Class.extend({
}, },


refresh_comments: function() { refresh_comments: function() {
var comments = $.map(this.frm.timeline.get_communications(), function(c) {
$.map(this.frm.timeline.get_communications(), function(c) {
return (c.communication_type==="Communication" || (c.communication_type=="Comment" && c.comment_type==="Comment")) ? c : null; return (c.communication_type==="Communication" || (c.communication_type=="Comment" && c.comment_type==="Comment")) ? c : null;
}); });
this.comments.find(".n-comments").html(comments.length);
this.comments.find(".n-comments").html(this.frm.get_docinfo().total_comments);
}, },


make_tags: function() { make_tags: function() {


Загрузка…
Отмена
Сохранить