\
+
\
+
'+wn._("Tags")+'
\
+
\
+
\
\
\
- '+wn._("Assigned To")+': \
-
\
\
\
\
'+wn._("Attachments")+':\
- '+wn._("Add")+'\
\
\
diff --git a/public/js/wn/form/infobar.js b/public/js/wn/form/infobar.js
index fd1fd500ee..cf4be421c8 100644
--- a/public/js/wn/form/infobar.js
+++ b/public/js/wn/form/infobar.js
@@ -4,46 +4,83 @@
wn.ui.form.InfoBar = Class.extend({
init: function(opts) {
$.extend(this, opts);
+ this.make();
this.refresh();
},
- refresh: function() {
+ make: 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 ? ' ' : '')
- + '',
- function() {
- $('html, body').animate({
- scrollTop: $(me.frm.wrapper).find(".form-comments").offset().top
- }, 2000);
+ this.$timestamp = this.appframe.add_to_mini_bar("icon-user", "Creation / Modified By",
+ function() { })
+
+ this.$comments = this.appframe.add_to_mini_bar("icon-comments", "Comments", function() {
+ me.scroll_to(".form-comments");
});
- if(comments) {
- $li1.addClass("bold");
- var last = docinfo.comments[0];
- $li1.find(".comment-text")
+ this.$attachments = this.appframe.add_to_mini_bar("icon-paper-clip", "Attachments", function() {
+ me.scroll_to(".form-attachments");
+ });
+
+ this.$assignments = this.appframe.add_to_mini_bar("icon-flag", "Assignments", function() {
+ me.scroll_to(".form-attachments");
+ });
+
+
+ this.$links = this.appframe.add_to_mini_bar("icon-link", "Linked With",
+ function() { me.frm.toolbar.show_linked_with(); });
+
+ if(!me.frm.meta.allow_print) {
+ this.$print = this.appframe.add_to_mini_bar("icon-print", "Print",
+ function() { me.frm.print_doc(); });
+ }
+
+ if(!me.frm.meta.allow_email) {
+ this.$print = this.appframe.add_to_mini_bar("icon-envelope", "Email",
+ function() { me.frm.email_doc(); });
+ }
+
+ if(!this.frm.meta.issingle) {
+ this.$prev = this.appframe.add_to_mini_bar("icon-arrow-left", "Previous Record",
+ function() { me.go_prev_next(true); });
+
+ this.$next = this.appframe.add_to_mini_bar("icon-arrow-right", "Next Record",
+ function() { me.go_prev_next(false); });
+ }
+
+ },
+
+ refresh: function() {
+ if(this.frm.doc.__islocal) {
+ this.appframe.hide_mini_bar();
+ } else {
+ this.docinfo = wn.model.docinfo[this.frm.doctype][this.frm.docname];
+ this.appframe.show_mini_bar();
+
+ // highlight comments
+ this.highlight_items();
+ }
+ },
+
+ highlight_items: function() {
+ var me = this;
+
+ this.$timestamp
+ .popover("destroy")
+ .popover({
+ title: "Created and Modified By",
+ content: "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),
+ trigger:"hover",
+ html: true,
+ placement: "bottom"
+ })
+
+ if(this.docinfo.comments.length) {
+ var last = this.docinfo.comments[0];
+ this.$comments
+ .popover("destroy")
.popover({
title: "Last Comment",
content: last.comment
@@ -52,65 +89,25 @@ wn.ui.form.InfoBar = Class.extend({
+ " / " + comment_when(last.creation)
+ '',
trigger:"hover",
- html: true
+ html: true,
+ placement: "bottom"
});
}
-
-
- 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");
+ $.each(["comments", "attachments", "assignments"], function(i, v) {
+ if(me.docinfo[v].length)
+ me["$" + v].addClass("appframe-mini-bar-active");
+ else
+ me["$" + v].removeClass("appframe-mini-bar-active");
+ })
},
- 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"));
- }
-
+ scroll_to: function(cls) {
+ $('html, body').animate({
+ scrollTop: $(this.frm.wrapper).find(cls).offset().top
+ }, 1000);
},
+
go_prev_next: function(prev) {
var me = this;
return wn.call({
diff --git a/public/js/wn/form/toolbar.js b/public/js/wn/form/toolbar.js
index b26b3d9a60..01dc1c6c9c 100644
--- a/public/js/wn/form/toolbar.js
+++ b/public/js/wn/form/toolbar.js
@@ -32,11 +32,11 @@ wn.ui.form.Toolbar = Class.extend({
this.make();
},
set_title: function() {
- var title = this.frm.docname;
+ var title = wn._(this.frm.docname);
if(title.length > 30) {
title = title.substr(0,30) + "...";
}
- this.appframe.set_title(title, wn._(this.frm.docname));
+ this.appframe.set_title(title + this.get_lock_status(), wn._(this.frm.docname));
this.appframe.set_sub_title(wn._(this.frm.doctype));
},
show_infobar: function() {
@@ -65,27 +65,18 @@ wn.ui.form.Toolbar = Class.extend({
get_dropdown_menu: function(label) {
return this.appframe.add_dropdown(label);
},
- set_docstatus_label: function() {
- var status_bar_parent = this.frm.appframe.$w.find(".status-bar").empty();
+ get_lock_status: function() {
if(this.frm.meta.is_submittable && !this.frm.doc.__islocal) {
- var status_bar = $("
")
- .css({"margin": "0px", "margin-top": "-10px"})
- .appendTo(status_bar_parent);
-
switch(this.frm.doc.docstatus) {
case 0:
- $(' To Submit')
- .appendTo(status_bar);
- break;
+ return ' ';
case 1:
- $(' Submitted')
- .appendTo(status_bar);
- break;
+ return ' ';
case 2:
- $(' Cancelled')
- .appendTo(status_bar);
- break;
+ return ' ';
}
+ } else {
+ return "";
}
},
make_file_menu: function() {
@@ -121,12 +112,7 @@ wn.ui.form.Toolbar = Class.extend({
// Linked With
if(!me.frm.doc.__islocal && !me.frm.meta.issingle) {
this.appframe.add_dropdown_button("File", wn._('Linked With'), function() {
- if(!me.frm.linked_with) {
- me.frm.linked_with = new wn.ui.form.LinkedWith({
- frm: me.frm
- });
- }
- me.frm.linked_with.show();
+ me.show_linked_with();
}, "icon-link")
}
@@ -150,6 +136,14 @@ wn.ui.form.Toolbar = Class.extend({
}
},
+ show_linked_with: function() {
+ if(!this.frm.linked_with) {
+ this.frm.linked_with = new wn.ui.form.LinkedWith({
+ frm: this.frm
+ });
+ }
+ this.frm.linked_with.show();
+ },
set_title_button: function() {
var me = this;
var docstatus = cint(this.frm.doc.docstatus);
@@ -221,8 +215,8 @@ wn.ui.form.Toolbar = Class.extend({
this.appframe.get_title_area()
.toggleClass("text-warning", this.frm.doc.__unsaved ? true : false);
+ this.set_title();
this.set_title_button();
- this.set_docstatus_label();
},
make_actions_menu: function() {
if(this.actions_setup) return;
diff --git a/public/js/wn/ui/appframe.js b/public/js/wn/ui/appframe.js
index c9098c2096..699209faf4 100644
--- a/public/js/wn/ui/appframe.js
+++ b/public/js/wn/ui/appframe.js
@@ -20,11 +20,10 @@ wn.ui.AppFrame = Class.extend({
\
\
\
-
\
+
\
'+wn._("Comments")+'
\