Timeline Title for small resolution Add to knowledge base button. (#9926)

* Add to Knowledge Base button class updated to hide for mobile view.

* Updated code to avoid multiple occurance of Knowledge Base button while updating comment.
This commit is contained in:
Ashwini Save 2017-07-25 14:16:48 +05:30 committed by Nabin Hait
parent 49a6b4a4fa
commit 2ffe878999

View File

@ -20,9 +20,11 @@ frappe.ui.form.on("Issue", {
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">'+
// Removing Knowledge Base button if exists to avoid multiple occurance
frm.timeline.wrapper.find('.comment-header .asset-details .btn-add-to-kb').remove();
$('<button class="btn btn-xs btn-default btn-add-to-kb hidden-xs pull-right" style="margin-top: -2px">'+
__('Add to Knowledge Base') + '</button>')
.appendTo(frm.timeline.wrapper.find('.comment-header'))
.appendTo(frm.timeline.wrapper.find('.comment-header .asset-details'))
.on('click', function() {
var content = $(this).parents('.timeline-item:first').find('.timeline-item-content').html();
var doc = frappe.model.get_new_doc('Help Article');