mirror of https://github.com/OCA/web.git
ADD web_datetime_options
parent
825443eace
commit
34232639da
|
@ -0,0 +1,37 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
{
|
||||
"name": 'web_datetime_options',
|
||||
"version": "0.1",
|
||||
"description": """
|
||||
===========================================
|
||||
Allow passing options to datepicker widgets
|
||||
===========================================
|
||||
|
||||
This will set all options specified in the "datepicker" option of datetime
|
||||
fields to the datepicker.
|
||||
|
||||
See http://api.jqueryui.com/datepicker/ for options
|
||||
|
||||
Example:
|
||||
--------
|
||||
|
||||
<field name="birthdate" options="{'datepicker':{'yearRange': 'c-100:c+0'}}"/>
|
||||
|
||||
Contributors:
|
||||
-------------
|
||||
|
||||
- Vincent vinet <vincent.vinet@savoirfairelinux.com>
|
||||
|
||||
""",
|
||||
"depends": [
|
||||
'base',
|
||||
'web',
|
||||
],
|
||||
"js": [
|
||||
'static/src/js/datepicker.js',
|
||||
],
|
||||
"author": "Vincent Vinet",
|
||||
"installable": True,
|
||||
"active": False,
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*global openerp, _, $ */
|
||||
|
||||
openerp.web_datetime_options = function (instance) {
|
||||
|
||||
"use strict";
|
||||
|
||||
instance.web.form.FieldDatetime = instance.web.form.FieldDatetime.extend({
|
||||
initialize_content: function() {
|
||||
this._super();
|
||||
var self = this;
|
||||
if (this.datewidget) {
|
||||
if (typeof this.options.datepicker === 'object') {
|
||||
$.map(this.options.datepicker, function(value, key) {
|
||||
self.datewidget.picker('option', key, value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
instance.web.form.FieldDate = instance.web.form.FieldDate.extend({
|
||||
initialize_content: function() {
|
||||
this._super();
|
||||
var self = this;
|
||||
if (this.datewidget) {
|
||||
if (typeof this.options.datepicker === 'object') {
|
||||
$.map(this.options.datepicker, function(value, key) {
|
||||
self.datewidget.picker('option', key, value);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue