diff --git a/public/build.json b/public/build.json index bb60803a6e..61de9c7772 100644 --- a/public/build.json +++ b/public/build.json @@ -113,6 +113,7 @@ "lib/public/js/legacy/widgets/form/clientscriptAPI.js", "lib/public/js/wn/form/toolbar.js", + "lib/public/js/wn/form/infobar.js", "lib/public/js/wn/form/layout.js", "lib/public/js/wn/form/dashboard.js", "lib/public/js/wn/form/script_manager.js", diff --git a/public/css/tag-it.css b/public/css/tag-it.css index 99432989cb..f3c0b70cdc 100644 --- a/public/css/tag-it.css +++ b/public/css/tag-it.css @@ -26,7 +26,7 @@ ul.tagit li.tagit-choice { border: none; box-shadow: none; border-radius: 4px; - background-color: #ddd; + background-color: #bbb; } ul.tagit li.tagit-new { @@ -76,14 +76,6 @@ ul.tagit input[type="text"] { /* in list */ -.list-tag ul.tagit li.tagit-choice { - background-color: transparent; - text-decoration: underline; - color: #aaa; - cursor: pointer; - font-size: 90%; -} - .list-tag ul.tagit { margin-top: -5px; margin-left: -4px; diff --git a/public/js/wn/form/infobar.js b/public/js/wn/form/infobar.js new file mode 100644 index 0000000000..003f5c1f0c --- /dev/null +++ b/public/js/wn/form/infobar.js @@ -0,0 +1,111 @@ +wn.ui.form.InfoBar = Class.extend({ + init: function(opts) { + $.extend(this, opts); + this.refresh(); + }, + refresh: function() { + var me = this; + this.appframe.clear_infobar(); + if(this.frm.doc.__islocal) + return; + + this.appframe.add_infobar( + wn.user.full_name(this.frm.doc.modified_by) + " / " + comment_when(this.frm.doc.modified), function() { + msgprint("Created By: " + wn.user.full_name(me.frm.doc.owner) + "
" + + "Created On: " + dateutil.str_to_user(me.frm.doc.creation) + "
" + + "Last Modified By: " + wn.user.full_name(me.frm.doc.modified_by) + "
" + + "Last Modifed On: " + dateutil.str_to_user(me.frm.doc.modified), "History"); + }) + this.make_links(); + this.make_side_icons(); + }, + make_links: function() { + + var me = this, + docinfo = wn.model.docinfo[this.frm.doctype][this.frm.docname], + comments = docinfo.comments.length, + attachments = keys(docinfo.attachments).length, + assignments = docinfo.assignments.length; + + var $li1 = this.appframe.add_infobar( + (comments ? ' ' : '') + + '' + comments + " " + + (comments===1 ? wn._("Comment") : wn._("Comments")) + '', + function() { + $('html, body').animate({ + scrollTop: $(me.frm.wrapper).find(".form-comments").offset().top + }, 2000); + }); + + if(comments) { + $li1.addClass("bold"); + var last = docinfo.comments[0]; + $li1.find(".comment-text") + .popover({ + title: "Last Comment", + content: last.comment + + '

By ' + + wn.user_info(last.comment_by).fullname + + " / " + comment_when(last.creation) + + '

', + trigger:"hover", + html: true + }); + } + + + var $li2 = this.appframe.add_infobar(attachments + " " + (attachments===1 ? + wn._("Attachment") : wn._("Attachments")), + function() { + $('html, body').animate({ + scrollTop: $(me.frm.wrapper).find(".form-attachments").offset().top + }, 2000); + }); + attachments > 0 && $li2.addClass("bold"); + + var $li3 = this.appframe.add_infobar(assignments + " " + (assignments===1 ? + wn._("Assignment") : wn._("Assignments")), + function() { + $('html, body').animate({ + scrollTop: $(me.frm.wrapper).find(".form-assignments").offset().top + }, 2000); + }) + assignments > 0 && $li3.addClass("bold"); + + }, + make_side_icons: function() { + var me = this; + this.appframe.$w.find(".form-icon").remove(); + + if(!this.frm.meta.issingle) { + $('') + .click(function() { + me.go_prev_next(false); + }) + .appendTo(this.appframe.$w.find(".info-bar")); + + $('') + .click(function() { + me.go_prev_next(true); + }) + .appendTo(this.appframe.$w.find(".info-bar")); + } + + if(!me.frm.meta.allow_print) { + $('') + .click(function() { + me.frm.print_doc(); + }) + .appendTo(this.appframe.$w.find(".info-bar")); + } + + if(!me.frm.meta.allow_email) { + $('') + .click(function() { + me.frm.email_doc(); + }) + .appendTo(this.appframe.$w.find(".info-bar")); + } + + }, +}) \ No newline at end of file diff --git a/public/js/wn/form/toolbar.js b/public/js/wn/form/toolbar.js index 416bf371c5..6e7907e786 100644 --- a/public/js/wn/form/toolbar.js +++ b/public/js/wn/form/toolbar.js @@ -41,93 +41,10 @@ wn.ui.form.Toolbar = Class.extend({ Render info bar that shows timestamp, # of comments, # of attachments etc. only if saved doc. (doc.__islocal is falsy) */ - var me = this; - this.appframe.clear_infobar(); - if(this.frm.doc.__islocal) - return; - - this.appframe.add_infobar( - wn.user.full_name(this.frm.doc.modified_by) + " / " + comment_when(this.frm.doc.modified), function() { - msgprint("Created By: " + wn.user.full_name(me.frm.doc.owner) + "
" + - "Created On: " + dateutil.str_to_user(me.frm.doc.creation) + "
" + - "Last Modified By: " + wn.user.full_name(me.frm.doc.modified_by) + "
" + - "Last Modifed On: " + dateutil.str_to_user(me.frm.doc.modified), "History"); - }) - - this.make_infobar_docinfo_links(); - this.make_infobar_side_icons(); - }, - make_infobar_docinfo_links: function() { - var me = this, - docinfo = wn.model.docinfo[this.frm.doctype][this.frm.docname], - comments = docinfo.comments.length, - attachments = keys(docinfo.attachments).length, - assignments = docinfo.assignments.length; - - var $li1 = this.appframe.add_infobar( - (comments ? ' ' : '') - + comments + " " - + (comments===1 ? wn._("Comment") : wn._("Comments")), - function() { - $('html, body').animate({ - scrollTop: $(me.frm.wrapper).find(".form-comments").offset().top - }, 2000); - }); - comments > 0 && $li1.addClass("bold"); - - var $li2 = this.appframe.add_infobar(attachments + " " + (attachments===1 ? - wn._("Attachment") : wn._("Attachments")), - function() { - $('html, body').animate({ - scrollTop: $(me.frm.wrapper).find(".form-attachments").offset().top - }, 2000); - }); - attachments > 0 && $li2.addClass("bold"); - - var $li3 = this.appframe.add_infobar(assignments + " " + (assignments===1 ? - wn._("Assignment") : wn._("Assignments")), - function() { - $('html, body').animate({ - scrollTop: $(me.frm.wrapper).find(".form-assignments").offset().top - }, 2000); - }) - assignments > 0 && $li3.addClass("bold"); - - }, - make_infobar_side_icons: function() { - var me = this; - this.appframe.$w.find(".form-icon").remove(); - - if(!this.frm.meta.issingle) { - $('') - .click(function() { - me.go_prev_next(false); - }) - .appendTo(this.appframe.$w.find(".info-bar")); - - $('') - .click(function() { - me.go_prev_next(true); - }) - .appendTo(this.appframe.$w.find(".info-bar")); - } - - if(!me.frm.meta.allow_print) { - $('') - .click(function() { - me.frm.print_doc(); - }) - .appendTo(this.appframe.$w.find(".info-bar")); - } - - if(!me.frm.meta.allow_email) { - $('') - .click(function() { - me.frm.email_doc(); - }) - .appendTo(this.appframe.$w.find(".info-bar")); - } - + if(this.infobar) + this.infobar.refresh(); + else + this.infobar = new wn.ui.form.InfoBar({appframe:this.appframe, frm:this.frm}); }, show_print_toolbar: function() { var me = this;