diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-04-25 13:16:25 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-04-25 13:16:25 +0200 |
| commit | e1c042f2d30f79bd3b008dbbbadeb389cf11cf6e (patch) | |
| tree | a522853a4300d14de69e4a90f4562757d75756bf /addons/crm/static/src/js | |
| parent | e9fb05e90874c41f76e431b0cca1f5c755d3e42b (diff) | |
[IMP] salesteams: display input is function of click/blur event on gage
bzr revid: chm@openerp.com-20130425111625-537q0ktfcsoewbv2
Diffstat (limited to 'addons/crm/static/src/js')
| -rw-r--r-- | addons/crm/static/src/js/crm_case_section.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/addons/crm/static/src/js/crm_case_section.js b/addons/crm/static/src/js/crm_case_section.js index 05b71ade809..22d042c4f3e 100644 --- a/addons/crm/static/src/js/crm_case_section.js +++ b/addons/crm/static/src/js/crm_case_section.js @@ -32,18 +32,18 @@ openerp.crm = function(openerp) { ], }); + var flag_open = false; if ($el.data('action')) { $el.click(function (event) { event.stopPropagation(); + flag_open = false; if (!self.view.is_action_enabled('edit')) { return; } - if ($el.find(".oe_justgage_edit").size()) { - $el.find(".oe_justgage_edit").remove(); - } else { + if (!$el.find(".oe_justgage_edit").size()) { var $svg = $el.find('svg'); - $div = $('<div class="oe_justgage_edit" style="z-index: 1; position: absolute; width: ' + $svg.width() + 'px; top: ' + ($svg.height()/2-5) + 'px;"/>'); - $input = $('<input style="text-align: center; width: ' + ($svg.width()-40) + 'px; margin: auto;"/>').val($el.data('value')); + $div = $('<div class="oe_justgage_edit" style="text-align: center; z-index: 1; position: absolute; width: ' + $svg.outerWidth() + 'px; top: ' + ($svg.outerHeight()/2-5) + 'px;"/>'); + $input = $('<input style="text-align: center; width: ' + ($svg.outerWidth()-40) + 'px; margin: auto;"/>').val($el.data('value')); $div.append($input); $el.prepend($div) $input.focus() @@ -59,8 +59,21 @@ openerp.crm = function(openerp) { } } }) - .click(function (event) {event.stopPropagation();}); + .click(function (event) { + event.stopPropagation(); + flag_open = false; + }) + .blur(function (event) { + if(!flag_open) { + $el.find(".oe_justgage_edit").remove(); + } else { + flag_open = false; + setTimeout(function () {$input.focus();}, 0); + } + }); } + }).mousedown(function () { + flag_open = true; }); } }); |
