@@ -107,6 +107,12 @@ a { | |||
font-size: 12px; | |||
} | |||
.slick-header * { | |||
-webkit-box-sizing: content-box; | |||
-moz-box-sizing: content-box; | |||
box-sizing: content-box; | |||
} | |||
.slick-headerrow-column { | |||
background: #87ceeb; | |||
text-overflow: clip; | |||
@@ -364,7 +364,7 @@ function HTMLField() { | |||
this.set_input = function(val) { | |||
me.set_disp(val); | |||
} | |||
this.onrefresh = function() { | |||
this.refresh = function() { | |||
if(me.df.options) | |||
me.set_disp(me.df.options); | |||
} | |||
@@ -316,8 +316,7 @@ _f.Frm.prototype.set_footnote = function(txt) { | |||
_f.Frm.prototype.add_custom_button = function(label, fn, icon) { | |||
this.toolbar.make_actions_menu(); | |||
this.appframe.add_dropdown_button("Actions", label, fn, icon); | |||
this.appframe.add_button(label, fn, icon, true); | |||
} | |||
_f.Frm.prototype.clear_custom_buttons = function() { | |||
this.toolbar.refresh() | |||
@@ -26,44 +26,45 @@ wn.ui.form.Toolbar = Class.extend({ | |||
// New | |||
if(p[CREATE]) { | |||
this.appframe.add_dropdown_button("File", "New " + me.frm.doctype, function() { | |||
this.appframe.add_dropdown_button("File", wn._("New") + " " | |||
+ wn._(me.frm.doctype), function() { | |||
new_doc(me.frm.doctype);}, 'icon-plus'); | |||
} | |||
// Save | |||
if(docstatus==0 && p[WRITE] && !this.read_only) { | |||
this.appframe.add_dropdown_button("File", "Save", function() { | |||
this.appframe.add_dropdown_button("File", wn._("Save"), function() { | |||
me.frm.save('Save', null, this);}, 'icon-save'); | |||
} | |||
if(!(me.frm.doc.__islocal || me.frm.meta.allow_print)) { | |||
this.appframe.add_dropdown_button("File", "Print...", function() { | |||
this.appframe.add_dropdown_button("File", wn._("Print..."), function() { | |||
me.frm.print_doc();}, 'icon-print'); | |||
} | |||
if(!(me.frm.doc.__islocal || me.frm.meta.allow_email)) { | |||
this.appframe.add_dropdown_button("File", "Email...", function() { | |||
this.appframe.add_dropdown_button("File", wn._("Email..."), function() { | |||
me.frm.email_doc();}, 'icon-envelope'); | |||
} | |||
// copy | |||
if(in_list(profile.can_create, me.frm.doctype) && !me.frm.meta.allow_copy) { | |||
this.appframe.add_dropdown_button("File", "Make Copy", function() { | |||
this.appframe.add_dropdown_button("File", wn._("Make Copy"), function() { | |||
me.frm.copy_doc();}, 'icon-file'); | |||
} | |||
// rename | |||
if(me.frm.meta.allow_rename && me.frm.perm[0][WRITE]) { | |||
this.appframe.add_dropdown_button("File", "Rename...", function() { | |||
this.appframe.add_dropdown_button("File", wn._("Rename..."), function() { | |||
me.frm.rename_doc();}, 'icon-retweet'); | |||
} | |||
// delete | |||
if((cint(me.frm.doc.docstatus) != 1) && !me.frm.doc.__islocal | |||
&& wn.model.can_delete(me.frm.doctype)) { | |||
this.appframe.add_dropdown_button("File", "Delete", function() { | |||
this.appframe.add_dropdown_button("File", wn._("Delete"), function() { | |||
me.frm.savetrash();}, 'icon-remove-sign'); | |||
} | |||
@@ -72,20 +73,20 @@ wn.ui.form.Toolbar = Class.extend({ | |||
var me = this; | |||
// Edit | |||
if(this.frm.meta.read_only_onload && !this.frm.doc.__islocal) { | |||
this.appframe.add_dropdown_button("View", 'Print View', function() { | |||
this.appframe.add_dropdown_button("View", wn._('Print View'), function() { | |||
me.frm.last_view_is_edit[me.frm.docname] = 0; | |||
me.frm.refresh(); }, 'icon-print'); | |||
} | |||
if(this.frm.meta.read_only_onload && !this.frm.doc.__islocal) { | |||
this.appframe.add_dropdown_button("View", 'Edit', function() { | |||
this.appframe.add_dropdown_button("View", wn._('Edit'), function() { | |||
me.frm.last_view_is_edit[me.frm.docname] = 1; | |||
me.frm.refresh(); }, 'icon-edit'); | |||
} | |||
// Linked With | |||
if(!me.frm.doc.__islocal && !me.frm.meta.issingle) { | |||
this.appframe.add_dropdown_button("View", 'Linked With', function() { | |||
this.appframe.add_dropdown_button("View", wn._('Linked With'), function() { | |||
if(!me.frm.linked_with) { | |||
me.frm.linked_with = new wn.ui.form.LinkedWith({ | |||
frm: me.frm | |||
@@ -94,6 +95,20 @@ wn.ui.form.Toolbar = Class.extend({ | |||
me.frm.linked_with.show(); | |||
}, "icon-link") | |||
} | |||
if(!this.frm.meta.issingle) { | |||
this.appframe.add_menu_divider("View"); | |||
this.appframe.add_dropdown_button("View", | |||
wn._(this.frm.doctype) + ' ' + wn._('List'), function() { | |||
wn.set_route("List", me.frm.doctype); | |||
}, 'icon-list'); | |||
this.appframe.add_dropdown_button("View", | |||
wn._(this.frm.doctype) + ' ' + wn._('Report View'), function() { | |||
wn.set_route("Report2", me.frm.doctype); | |||
}, 'icon-table'); | |||
} | |||
}, | |||
set_title_button: function() { | |||
var me = this; | |||
@@ -103,20 +118,20 @@ wn.ui.form.Toolbar = Class.extend({ | |||
if(!wn.model.get("Workflow", {document_type: me.frm.doctype}).length) { | |||
if(docstatus==0 && p[SUBMIT] && (!me.frm.doc.__islocal)) { | |||
this.appframe.add_title_button('Submit', function() { | |||
me.frm.savesubmit(this);}, 'icon-lock'); | |||
this.appframe.add_button('Submit', function() { | |||
me.frm.savesubmit(this);}, 'icon-lock', true).addClass("btn-primary"); | |||
} | |||
else if(docstatus==0) { | |||
this.appframe.add_title_button('Save', function() { | |||
me.frm.save('Save', null, this);}, 'icon-save'); | |||
this.appframe.add_button('Save', function() { | |||
me.frm.save('Save', null, this);}, 'icon-save', true).addClass("btn-primary"); | |||
} | |||
else if(docstatus==1 && p[CANCEL]) { | |||
this.appframe.add_title_button('Cancel', function() { | |||
this.appframe.add_dropdown_button("File", 'Cancel', function() { | |||
me.frm.savecancel(this) }, 'icon-remove'); | |||
} | |||
else if(docstatus==2 && p[AMEND]) { | |||
this.appframe.add_title_button('Amend', function() { | |||
me.frm.amend_doc() }, 'icon-pencil'); | |||
this.appframe.add_button('Amend', function() { | |||
me.frm.amend_doc() }, 'icon-pencil', true); | |||
} | |||
} | |||
}, | |||
@@ -127,11 +142,11 @@ wn.ui.form.Toolbar = Class.extend({ | |||
// show update button if unsaved | |||
var docstatus = cint(me.frm.doc.docstatus); | |||
if(docstatus==1 && me.frm.perm[0][SUBMIT]) { | |||
me.appframe.$w.find(".title-button-area").empty(); | |||
me.appframe.add_title_button("Update", function() { | |||
if(docstatus==1 && me.frm.perm[0][SUBMIT] | |||
&& !me.appframe.$w.find(".action-update").length) { | |||
me.appframe.add_button("Update", function() { | |||
me.frm.save('Update', null, me); | |||
}, 'icon-save') | |||
}, 'icon-save', true).addClass("btn-primary action-update"); | |||
} | |||
}) | |||
}, | |||
@@ -173,8 +173,10 @@ $.extend(wn.perm, { | |||
if(explain) console.log("By Submit:" + ret) | |||
// allow on submit | |||
var allow_on_submit = cint(df.allow_on_submit); | |||
var allow_on_submit = df.fieldtype!= "Table" ? | |||
cint(df.allow_on_submit) : | |||
0; | |||
// if(allow_on_submit && doc.parent) { | |||
// parent_df = wn.model.get("DocField", { | |||
// "parent": doc.parenttype, | |||
@@ -17,11 +17,13 @@ wn.ui.AppFrame = Class.extend({ | |||
</ul>\ | |||
</div>\ | |||
<div class="toolbar-area"></div -->\ | |||
<div class="title-button-area pull-right" style="margin-top: 10px;"></div>\ | |||
<div class="title-button-area btn-group pull-right" style="margin-top: 10px;"></div>\ | |||
<div class="title-area"><h3 style="display: inline-block">\ | |||
<span class="title-icon"></span><span class="title-text"></span></h3></div>\ | |||
<div class="sub-title-area text-muted small" \ | |||
style="margin-top: -10px;"></div>\ | |||
<div class="btn-group appframe-toolbar" \ | |||
style="display: none; margin-top: 15px;"></div>\ | |||
<hr>\ | |||
').appendTo(this.$w); | |||
@@ -29,6 +31,8 @@ wn.ui.AppFrame = Class.extend({ | |||
window.history.back(); | |||
}) | |||
this.toolbar = this.$w.find(".appframe-toolbar"); | |||
if(title) | |||
this.set_title(title); | |||
@@ -154,7 +158,6 @@ wn.ui.AppFrame = Class.extend({ | |||
}, | |||
add_help_button: function(txt) { | |||
this.add_toolbar(); | |||
$('<button class="btn" button-type="help">\ | |||
<b>?</b></button>') | |||
.data('help-text', txt) | |||
@@ -163,59 +166,36 @@ wn.ui.AppFrame = Class.extend({ | |||
}, | |||
clear_buttons: function() { | |||
this.toolbar && this.toolbar.empty(); | |||
this.toolbar && this.toolbar.empty().toggle(false); | |||
$(".custom-menu").remove(); | |||
}, | |||
add_toolbar: function() { | |||
if(!this.toolbar) { | |||
this.toolbar = $('<div class="navbar">\ | |||
<div class="navbar-inner">\ | |||
<ul class="nav">\ | |||
</ul>\ | |||
</div>\ | |||
</div>').appendTo(this.$w.find(".toolbar-area")).find(".nav"); | |||
} | |||
}, | |||
add_button: function(label, click, icon) { | |||
this.add_toolbar(); | |||
args = { label: label, icon:'' }; | |||
if(icon) { | |||
args.icon = '<i class="'+icon+'"></i>'; | |||
} | |||
this.buttons[label] = $(repl('<li><a>\ | |||
%(icon)s %(label)s</a></li>', args)) | |||
.appendTo(this.toolbar) | |||
.find("a") | |||
.click(click); | |||
return this.buttons[label]; | |||
}, | |||
add_title_button: function(label, click, icon) { | |||
add_button: function(label, click, icon, title_toolbar) { | |||
!title_toolbar && this.toolbar.toggle(true); | |||
args = { label: label, icon:'' }; | |||
if(icon) { | |||
args.icon = '<i class="'+icon+'"></i>'; | |||
} | |||
this.buttons[label] = $(repl('<button class="btn btn-primary">\ | |||
this.buttons[label] = $(repl('<button class="btn">\ | |||
%(icon)s %(label)s</button>', args)) | |||
.appendTo(this.$w.find(".title-button-area")) | |||
.appendTo(title_toolbar ? this.$w.find(".title-button-area") : this.toolbar) | |||
.click(click); | |||
return this.buttons[label]; | |||
}, | |||
add_dropdown: function(label) { | |||
this.add_toolbar(); | |||
this.buttons[label] = $('<li class="dropdown">\ | |||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">' | |||
+label+' <b class="caret"></b></a>\ | |||
<ul class="dropdown-menu"></ul>') | |||
.appendTo(this.toolbar); | |||
this.buttons[label].find(".dropdown-toggle").dropdown(); | |||
return this.buttons[label]; | |||
get_menu: function(label) { | |||
return $("#navbar-" + label.toLowerCase()); | |||
}, | |||
add_menu_divider: function(menu) { | |||
menu = typeof menu == "string" ? | |||
this.get_menu(menu) : menu; | |||
$('<li class="divider custom-menu"></li>').appendTo(menu); | |||
}, | |||
add_dropdown_button: function(parent, label, click, icon) { | |||
var menu = $("#navbar-" + parent.toLowerCase()); | |||
var menu = this.get_menu(parent); | |||
if(menu.find("li:not(.custom-menu)").length && !menu.find(".divider").length) { | |||
$('<li class="divider custom-menu"></li>').appendTo(menu); | |||
this.add_menu_divider(menu); | |||
} | |||
return $('<li class="custom-menu"><a><i class="' | |||
@@ -27,7 +27,7 @@ wn.ui.toolbar.Toolbar = Class.extend({ | |||
this.make_erpnext(); | |||
this.make_file(); | |||
this.make_view(); | |||
this.make_actions(); | |||
//this.make_actions(); | |||
wn.ui.toolbar.recent = new wn.ui.toolbar.RecentDocs(); | |||
wn.ui.toolbar.bookmarks = new wn.ui.toolbar.Bookmarks(); | |||
this.make_tools(); | |||
@@ -144,15 +144,15 @@ wn.ui.toolbar.Toolbar = Class.extend({ | |||
</li>'); | |||
}, | |||
make_actions: function() { | |||
$('.navbar .nav:first').append('<li class="dropdown">\ | |||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \ | |||
title="'+wn._("Actions")+'"\ | |||
onclick="return false;">'+wn._("Actions")+'</a>\ | |||
<ul class="dropdown-menu" id="navbar-actions">\ | |||
</ul>\ | |||
</li>'); | |||
}, | |||
// make_actions: function() { | |||
// $('.navbar .nav:first').append('<li class="dropdown">\ | |||
// <a class="dropdown-toggle" data-toggle="dropdown" href="#" \ | |||
// title="'+wn._("Actions")+'"\ | |||
// onclick="return false;">'+wn._("Actions")+'</a>\ | |||
// <ul class="dropdown-menu" id="navbar-actions">\ | |||
// </ul>\ | |||
// </li>'); | |||
// }, | |||
make_tools: function() { | |||
$('.navbar .nav:first').append('<li class="dropdown">\ | |||