diff --git a/public/css/ui/common.css b/public/css/ui/common.css index 270eefa53f..76c6ad9be0 100644 --- a/public/css/ui/common.css +++ b/public/css/ui/common.css @@ -1,3 +1,7 @@ +a { + cursor: pointer; +} + .navbar-icon-home { vertical-align: middle; opacity: 0.4; diff --git a/public/js/wn/model.js b/public/js/wn/model.js index 4cceed11a3..5823602115 100644 --- a/public/js/wn/model.js +++ b/public/js/wn/model.js @@ -96,6 +96,18 @@ wn.model = { return txt.replace(/ /g, "_").toLowerCase(); }, + can_create: function(doctype) { + return wn.boot.profile.can_create.indexOf(doctype)!=-1; + }, + + can_read: function(doctype) { + return wn.boot.profile.can_read.indexOf(doctype)!=-1; + }, + + can_write: function(doctype) { + return wn.boot.profile.can_write.indexOf(doctype)!=-1; + }, + can_delete: function(doctype) { if(!doctype) return false; return wn.boot.profile.can_cancel.indexOf(doctype)!=-1; @@ -168,7 +180,7 @@ wn.model = { }) }, - rename_doc: function(doctype, docname) { + rename_doc: function(doctype, docname, callback) { var d = new wn.ui.Dialog({ title: "Rename " + docname, fields: [ @@ -195,6 +207,8 @@ wn.model = { if(locals[doctype] && locals[doctype][docname]) delete locals[doctype][docname]; d.hide(); + if(callback) + callback(r.message); } } }); diff --git a/public/js/wn/ui/tree.js b/public/js/wn/ui/tree.js index 60132b9ad5..8729238d69 100644 --- a/public/js/wn/ui/tree.js +++ b/public/js/wn/ui/tree.js @@ -30,7 +30,7 @@ wn.ui.TreeNode = Class.extend({ this.loaded = false; this.expanded = false; this.tree.nodes[this.label] = this; - this.$a = $('') + this.$a = $('') .click(function() { if(me.expandable && me.tree.method && !me.loaded) { me.load() @@ -44,11 +44,12 @@ wn.ui.TreeNode = Class.extend({ .appendTo(this.parent); // label with icon + var icon_html = ''; if(this.expandable) { - this.$a.append(' ' + this.label); - } else { - this.$a.append(' ' + this.label); + icon_html = ''; } + $(icon_html + ' ' + this.label + ""). + appendTo(this.$a); if(this.tree.onrender) { this.tree.onrender(this); @@ -69,7 +70,7 @@ wn.ui.TreeNode = Class.extend({ } // select this link - this.tree.$w.find('a.selected') + this.tree.$w.find('.selected') .removeClass('selected'); this.$a.toggleClass('selected'); this.expanded = !this.expanded; diff --git a/webnotes/__init__.py b/webnotes/__init__.py index b79325f7e5..68d1efc618 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -305,7 +305,9 @@ def clear_perms(doctype): def reload_doc(module, dt=None, dn=None): import webnotes.modules return webnotes.modules.reload_doc(module, dt, dn) - + +from webnotes.model.rename_doc import rename_doc + def insert(doclist): import webnotes.model return webnotes.model.insert(doclist) \ No newline at end of file