Merge pull request #1515 from saurabh6790/installer_fixes
[enhancement] Group action button
This commit is contained in:
commit
abce16aaee
7 changed files with 40 additions and 12 deletions
|
|
@ -5,7 +5,7 @@ frappe.ui.form.on("Communication", "refresh", function(frm) {
|
|||
if(frm.doc.reference_doctype && frm.doc.reference_name) {
|
||||
frm.add_custom_button(__(frm.doc.reference_name), function() {
|
||||
frappe.set_route("Form", frm.doc.reference_doctype, frm.doc.reference_name);
|
||||
}, frappe.boot.doctype_icons[frm.doc.reference_doctype]);
|
||||
}, __("View"));
|
||||
} else {
|
||||
// if an unlinked communication, set email field
|
||||
if (frm.doc.sent_or_received==="Received") {
|
||||
|
|
@ -19,12 +19,12 @@ frappe.ui.form.on("Communication", "refresh", function(frm) {
|
|||
frm.add_custom_button(__("Close"), function() {
|
||||
frm.set_value("status", "Closed");
|
||||
frm.save();
|
||||
});
|
||||
}, __("Status"));
|
||||
} else if (frm.doc.status !== "Linked") {
|
||||
frm.add_custom_button(__("Reopen"), function() {
|
||||
frm.set_value("status", "Open");
|
||||
frm.save();
|
||||
});
|
||||
}, __("Status"));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -768,7 +768,7 @@
|
|||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"depends_on": "enabled",
|
||||
"description": "Check / Uncheck roles assigned to the User. Click on the Role to find out what permissions that Role has.",
|
||||
"description": "",
|
||||
"fieldname": "sb1",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
|
|
@ -840,7 +840,7 @@
|
|||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"default": "",
|
||||
"description": "Uncheck modules to hide from user's desktop",
|
||||
"description": "",
|
||||
"fieldname": "modules_access",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@
|
|||
margin-top: 70px;
|
||||
}
|
||||
/* show menu aligned to the right border of the dropdown */
|
||||
.page-actions .dropdown-menu {
|
||||
.page-actions .dropdown-menu,
|
||||
.form-inner-toolbar .dropdown-menu {
|
||||
right: 0px;
|
||||
left: auto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,9 +227,29 @@ frappe.ui.Page = Class.extend({
|
|||
return $('<li class="divider"></li>').appendTo(this.menu);
|
||||
},
|
||||
|
||||
add_inner_button: function(label, action) {
|
||||
return $('<button class="btn btn-default btn-xs" style="margin-left: 10px;">'+__(label)+'</btn>')
|
||||
.on("click", action).appendTo(this.inner_toolbar.removeClass("hide"))
|
||||
get_inner_group_button: function(label) {
|
||||
var $group = this.inner_toolbar.find('.btn-group[data-label="'+label+'"]');
|
||||
if(!$group.length) {
|
||||
$group = $('<div class="btn-group" data-label='+label+' style="margin-left: 10px;">\
|
||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\
|
||||
'+label+' <span class="caret"></span></button>\
|
||||
<ul class="dropdown-menu" style="margin-top: -8px;"></ul></div>').appendTo(this.inner_toolbar.removeClass("hide"));
|
||||
}
|
||||
return $group;
|
||||
},
|
||||
|
||||
set_inner_btn_group_as_primary: function(label) {
|
||||
this.get_inner_group_button(label).find("button").removeClass("btn-default").addClass("btn-primary");
|
||||
},
|
||||
|
||||
add_inner_button: function(label, action, group) {
|
||||
if(group) {
|
||||
var $group = this.get_inner_group_button(group);
|
||||
$('<li><a>'+label+'</a></li>').on('click', action).appendTo($group.find(".dropdown-menu"));
|
||||
} else {
|
||||
return $('<button class="btn btn-default btn-xs" style="margin-left: 10px;">'+__(label)+'</btn>')
|
||||
.on("click", action).appendTo(this.inner_toolbar.removeClass("hide"))
|
||||
}
|
||||
},
|
||||
|
||||
//-- Sidebar --//
|
||||
|
|
|
|||
|
|
@ -834,8 +834,10 @@ _f.Frm.prototype.set_footnote = function(txt) {
|
|||
}
|
||||
|
||||
|
||||
_f.Frm.prototype.add_custom_button = function(label, fn, icon, toolbar_or_class) {
|
||||
return this.page.add_inner_button(label, fn);
|
||||
_f.Frm.prototype.add_custom_button = function(label, fn, group) {
|
||||
// temp! old parameter used to be icon
|
||||
if(group && group.indexOf("icon")!==-1) group = null;
|
||||
return this.page.add_inner_button(label, fn, group);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.clear_custom_buttons = function() {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@
|
|||
}
|
||||
|
||||
/* show menu aligned to the right border of the dropdown */
|
||||
.page-actions .dropdown-menu {
|
||||
.page-actions .dropdown-menu,
|
||||
.form-inner-toolbar .dropdown-menu {
|
||||
right: 0px;
|
||||
left: auto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{% include "templates/includes/breadcrumbs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
{% if create_new %}
|
||||
<div class="pull-right">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue