diff --git a/home/page/profile_settings/profile_settings.js b/home/page/profile_settings/profile_settings.js index 795acb2e6b..429ef70a22 100644 --- a/home/page/profile_settings/profile_settings.js +++ b/home/page/profile_settings/profile_settings.js @@ -25,11 +25,32 @@ MyProfile = function(wrapper) { 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("

Personal

\ +
\ +
\ + \ +

Display

\ +
\ +

Change Background:

\ +

Change Theme:

\ +
"); + + 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 @@ MyProfile = function(wrapper) { args: {theme: $(this).val() } }) }); + } + + this.make_personal = function() { + this.personal = $(this.wrapper).find('.personal-settings').html('
\ +

\ +

\ +
\ +
\ +
') - 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 @@ MyProfile = function(wrapper) { // 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 @@ MyProfile = function(wrapper) { 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 0dbd10d891..58fcf95585 100644 --- a/home/page/profile_settings/profile_settings.py +++ b/home/page/profile_settings/profile_settings.py @@ -49,7 +49,8 @@ def get_user_details(arg=None): """ 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 97ed89a6aa..697d894ade 100644 --- a/support/doctype/support_ticket/support_ticket.js +++ b/support/doctype/support_ticket/support_ticket.js @@ -133,7 +133,9 @@ erpnext.CommunicationView = Class.extend({ this.comm_list[0].find('.comm-content').toggle(true); }, make_body: function() { - this.body = $("").appendTo(this.parent); + this.wrapper = $("

Communication History

").appendTo(this.parent); + this.body = $("
") + .appendTo(this.body); }, prepare: function(doc) { //doc.when = comment_when(this.doc.modified);