changeset 2fad51eb6811 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=2fad51eb6811
description:
Add support for expand, height and width attributes
issue7886
review51581002
diffstat:
CHANGELOG | 1 +
src/view/form.js | 25 +++++++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diffs (92 lines):
diff -r 6d9ad60d2da2 -r 2fad51eb6811 CHANGELOG
--- a/CHANGELOG Fri Dec 21 23:41:56 2018 +0100
+++ b/CHANGELOG Sat Dec 22 00:19:20 2018 +0100
@@ -1,3 +1,4 @@
+* Add support for expand, height and width attributes
* Add drag & drop support on attachment button
Version 5.0.0 - 2018-10-01
diff -r 6d9ad60d2da2 -r 2fad51eb6811 src/view/form.js
--- a/src/view/form.js Fri Dec 21 23:41:56 2018 +0100
+++ b/src/view/form.js Sat Dec 22 00:19:20 2018 +0100
@@ -237,7 +237,20 @@
var widget = new WidgetFactory(name, model, attributes);
widget.position = this.widget_id += 1;
widget.view = this;
- // TODO expand, fill, height, width
+ if (WidgetFactory.prototype.expand) {
+ if (attributes.yexpand === undefined) {
+ attributes.yexpand = true;
+ }
+ if (attributes.yfill === undefined) {
+ attributes.yfill = true;
+ }
+ }
+ if (attributes.height) {
+ widget.el.css('min-height', attributes.height + 'px');
+ }
+ if (attributes.width !== undefined) {
+ widget.el.css('min-width', attributes.width + 'px');
+ }
container.add(attributes, widget);
if (this.widgets[name] === undefined) {
this.widgets[name] = [];
@@ -536,7 +549,9 @@
return;
}
- // TODO yexpand
+ if (attributes.yexpand) {
+ cell.css('height', '100%');
+ }
if (attributes.yfill) {
cell.css('vertical-align', 'top');
}
@@ -1001,6 +1016,7 @@
Sao.View.Form.Widget = Sao.class_(Object, {
+ expand: false,
init: function(field_name, model, attributes) {
this.field_name = field_name;
this.model = model;
@@ -1839,6 +1855,7 @@
Sao.View.Form.Text = Sao.class_(Sao.View.Form.Widget, {
class_: 'form-text',
+ expand: true,
init: function(field_name, model, attributes) {
Sao.View.Form.Text._super.init.call(this, field_name, model,
attributes);
@@ -1897,6 +1914,7 @@
Sao.View.Form.RichText = Sao.class_(Sao.View.Form.Widget, {
class_: 'form-richtext',
+ expand: true,
init: function(field_name, model, attributes) {
Sao.View.Form.RichText._super.init.call(
this, field_name, model, attributes);
@@ -2709,6 +2727,7 @@
Sao.View.Form.One2Many = Sao.class_(Sao.View.Form.Widget, {
class_: 'form-one2many',
+ expand: true,
init: function(field_name, model, attributes) {
Sao.View.Form.One2Many._super.init.call(this, field_name, model,
attributes);
@@ -3236,6 +3255,7 @@
Sao.View.Form.Many2Many = Sao.class_(Sao.View.Form.Widget, {
class_: 'form-many2many',
+ expand: true,
init: function(field_name, model, attributes) {
Sao.View.Form.Many2Many._super.init.call(this, field_name, model,
attributes);
@@ -3931,6 +3951,7 @@
Sao.View.Form.Dict = Sao.class_(Sao.View.Form.Widget, {
class_: 'form-dict',
+ expand: true,
init: function(field_name, model, attributes) {
Sao.View.Form.Dict._super.init.call(
this, field_name, model, attributes);