From 14432af06d74eb7057f71185c8d243e920281928 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 15 Apr 2015 14:14:34 +0530 Subject: [PATCH] [fix] no star for single doctypes fixes frappe/erpnext#3050 --- frappe/public/js/frappe/form/toolbar.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frappe/public/js/frappe/form/toolbar.js b/frappe/public/js/frappe/form/toolbar.js index 59cd055bb4..cf4c67e64b 100644 --- a/frappe/public/js/frappe/form/toolbar.js +++ b/frappe/public/js/frappe/form/toolbar.js @@ -22,11 +22,11 @@ frappe.ui.form.Toolbar = Class.extend({ if(this.frm.doc.__islocal) { this.page.hide_menu(); this.print_icon && this.print_icon.addClass("hide"); - this.star_icon.addClass("hide"); + this.star_icon && this.star_icon.addClass("hide"); } else { this.page.show_menu(); this.print_icon && this.print_icon.removeClass("hide"); - this.star_icon.removeClass("hide"); + this.star_icon && this.star_icon.removeClass("hide"); } } }, @@ -60,8 +60,11 @@ frappe.ui.form.Toolbar = Class.extend({ } }, refresh_star: function() { - this.star_icon.toggleClass("text-extra-muted not-starred", !frappe.ui.is_starred(this.frm.doc)) - .attr("data-doctype", this.frm.doctype).attr("data-name", this.frm.doc.name); + this.star_icon && + this.star_icon.toggleClass("text-extra-muted not-starred", + !frappe.ui.is_starred(this.frm.doc)) + .attr("data-doctype", this.frm.doctype) + .attr("data-name", this.frm.doc.name); }, make_menu: function() { var me = this; @@ -77,9 +80,11 @@ frappe.ui.form.Toolbar = Class.extend({ } // star - this.star_icon = this.page.add_action_icon("icon-star", function() { - frappe.ui.toggle_star(me.star_icon, me.frm.doctype, me.frm.doc.name); - }).removeClass("text-muted").find(".icon-star").addClass("star-action"); + if(!this.frm.meta.issingle) { + this.star_icon = this.page.add_action_icon("icon-star", function() { + frappe.ui.toggle_star(me.star_icon, me.frm.doctype, me.frm.doc.name); + }).removeClass("text-muted").find(".icon-star").addClass("star-action"); + } // email if(frappe.model.can_email(null, me.frm)) {