From 08f1bb4cee8a172bba544f558bb1e9e929555970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Apr 2013 17:01:23 +0200 Subject: [PATCH] Fix Date widget to open picker only with button --- src/view.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/view.js b/src/view.js index f31d84fcec..4191385343 100644 --- a/src/view.js +++ b/src/view.js @@ -927,24 +927,35 @@ init: function(field_name, model, attributes) { Sao.View.Form.Date._super.init.call(this, field_name, model, attributes); - this.el = jQuery('', { - 'type': 'input', + this.el = jQuery('
', { 'class': 'form-date' }); - this.el.datepicker(); - this.el.change(this.focus_out.bind(this)); + this.date = jQuery('', { + 'type': 'input' + }); + this.el.append(this.date); + this.date.datepicker({ + showOn: 'button' + }); + this.date.next('button').text('').button({ + icons: { + primary: 'ui-icon-calendar' + }, + text: false + }); + this.date.change(this.focus_out.bind(this)); }, display: function(record, field) { Sao.View.Form.Date._super.display.call(this, record, field); if (record) { var value = record.field_get_client(this.field_name); - this.el.datepicker('setDate', value); + this.date.datepicker('setDate', value); } else { - this.el.datepicker('setDate', null); + this.date.datepicker('setDate', null); } }, set_value: function(record, field) { - var value = this.el.datepicker('getDate'); + var value = this.date.datepicker('getDate'); field.set_client(record, value); } });