[minor] Add button to add help article from Issue #7132 (#7154)

This commit is contained in:
Rushabh Mehta 2016-12-07 14:41:23 +05:30 committed by GitHub
parent e4b9473f83
commit b78fc37ce9

View File

@ -15,5 +15,21 @@ frappe.ui.form.on("Issue", {
frm.save();
});
}
},
timeline_refresh: function(frm) {
// create button for "Add to Knowledge Base"
if(frappe.model.can_create('Help Article')) {
$('<button class="btn btn-xs btn-default btn-add-to-kb pull-right" style="margin-top: -2px">'+
__('Add to Knowledge Base') + '</button>')
.appendTo(frm.timeline.wrapper.find('.comment-header'))
.on('click', function() {
var content = $(this).parents('.timeline-item:first').find('.timeline-item-content').html();
var doc = frappe.model.get_new_doc('Help Article');
doc.title = frm.doc.subject;
doc.content = content;
frappe.set_route('Form', 'Help Article', doc.name);
});
}
}
});