cleaned up profile settings
diff --git a/home/page/profile_settings/profile_settings.js b/home/page/profile_settings/profile_settings.js
index 795acb2..429ef70 100644
--- a/home/page/profile_settings/profile_settings.js
+++ b/home/page/profile_settings/profile_settings.js
@@ -25,11 +25,32 @@
this.make = function() {
this.wrapper.appframe = new wn.ui.AppFrame($(this.wrapper).find('.layout-appframe'), 'Profile Settings');
+ this.wrapper.appframe.add_button('Update', this.update_profile);
+ this.wrapper.appframe.buttons["Update"].addClass("btn-info");
this.wrapper.appframe.add_button('Change Password', this.change_password);
- this.wrapper.appframe.add_button('Change Background', this.change_background);
- this.wrapper.appframe.add_label("Set Theme:");
- this.wrapper.appframe.add_select("Theme",
- keys(erpnext.themes).sort())
+
+ $(this.wrapper).find('.layout-main').html("<h4>Personal</h4>\
+ <div class='personal-settings' style='margin-left: 15px;'></div>\
+ <hr>\
+ <!--<h4>Email</h4>\
+ <div class='email-settings' style='margin-left: 15px;'></div>\
+ <hr>-->\
+ <h4>Display</h4>\
+ <div class='display-settings' style='margin-left: 15px;'>\
+ <p>Change Background: <button class='btn btn-small change-background'>Upload</button></p>\
+ <br><p>Change Theme: <select class='change-theme'></select></p>\
+ </div>");
+
+ this.make_display();
+ this.make_personal();
+ }
+
+ this.make_display = function() {
+ $(this.wrapper).find(".change-background")
+ .click(me.change_background)
+
+ $(this.wrapper).find(".change-theme")
+ .add_options(keys(erpnext.themes).sort())
.change(function() {
erpnext.set_theme($(this).val());
}).val(wn.boot.profile.defaults.theme ?
@@ -42,16 +63,20 @@
args: {theme: $(this).val() }
})
});
+ }
+
+ this.make_personal = function() {
+ this.personal = $(this.wrapper).find('.personal-settings').html('<div \
+ class="pull-left" style="width: 300px;">\
+ <img style="max-width: 200px;" src='+wn.user_info(user).image+'><br><br>\
+ <button class="btn btn-small">Change Image</button><br><br>\
+ </div><div class="pull-left profile-form" style="width: 45%; margin-top: -11px;">\
+ <div class="clear"></div>\
+ </div>')
- this.tab = make_table($a($(this.wrapper).find('.layout-main').get(0), 'div', '', {marginTop:'19px'}),
- 1, 2, '90%', ['50%', '50%'], {padding:'11px'})
- this.img = $a($td(this.tab, 0, 0), 'img', '', {width: '120px', maxHeight:'200px'});
- this.img.src = wn.user_info(user).image;
-
- $btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image);
-
+ this.personal.find("button").click(this.change_image);
this.make_form();
- this.load_details();
+ this.load_details();
}
this.load_details = function() {
@@ -64,34 +89,30 @@
// form
//
this.make_form = function() {
- var div = $a($td(this.tab, 0, 1), 'div');
+ var div = this.personal.find(".profile-form").get(0);
this.form = new wn.ui.FieldGroup({
parent: div,
fields: [
{fieldname:'first_name', fieldtype:'Data',label:'First Name',reqd:1},
{fieldname:'last_name', fieldtype:'Data',label:'Last Name'},
- {fieldname:'email_signature', fieldtype:'Text',label:'Email Signature',
+ {fieldname:'email_signature', fieldtype:'Small Text',label:'Email Signature',
decription:'Will be appended to outgoing mail'},
- {fieldname:'bio', fieldtype:'Text',label:'Bio'},
- {fieldname:'update', fieldtype:'Button',label:'Update'}
]
});
-
- this.form.fields_dict.update.input.onclick = function() {
- var v = me.form.get_values();
- if(v) {
- this.set_working();
- var btn = this;
- $c_page('home','profile_settings','set_user_details',v,function(r, rt) {
- btn.done_working();
- })
- }
- }
+
}
- //
- // change password
- //
+ this.update_profile = function() {
+ var v = me.form.get_values();
+ if(v) {
+ $(this).set_working();
+ var btn = this;
+ $c_page('home','profile_settings','set_user_details',v,function(r, rt) {
+ $(btn).done_working();
+ })
+ }
+ }
+
this.change_password = function() {
var d = new wn.ui.Dialog({
title:'Change Password',
@@ -137,7 +158,7 @@
if(fid) {
d.hide();
wn.boot.user_info[user].image = 'files/' + fid;
- pscript.myprofile.img.src = 'files/' + fid;
+ me.personal.find("img").attr("src", 'files/' + fid);
}
}
});
diff --git a/home/page/profile_settings/profile_settings.py b/home/page/profile_settings/profile_settings.py
index 0dbd10d..58fcf95 100644
--- a/home/page/profile_settings/profile_settings.py
+++ b/home/page/profile_settings/profile_settings.py
@@ -49,7 +49,8 @@
"""
Returns user first name, last name and bio
"""
- return webnotes.conn.sql("select first_name, last_name, bio from tabProfile where name=%s", webnotes.user.name, as_dict=1)[0]
+ return webnotes.conn.sql("""select first_name, last_name, bio, email_signature
+ from tabProfile where name=%s""", webnotes.user.name, as_dict=1)[0]
@webnotes.whitelist()
def set_user_details(arg=None):
diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js
index 97ed89a..697d894 100644
--- a/support/doctype/support_ticket/support_ticket.js
+++ b/support/doctype/support_ticket/support_ticket.js
@@ -133,7 +133,9 @@
this.comm_list[0].find('.comm-content').toggle(true);
},
make_body: function() {
- this.body = $("<table class='table table-bordered table-hover table-striped'>").appendTo(this.parent);
+ this.wrapper = $("<div><h4>Communication History</h4></div>").appendTo(this.parent);
+ this.body = $("<table class='table table-bordered table-hover table-striped'>")
+ .appendTo(this.body);
},
prepare: function(doc) {
//doc.when = comment_when(this.doc.modified);