Add support for expand, height and width attributes

issue7886
review51581002
This commit is contained in:
Cédric Krier
2018-12-22 00:19:20 +01:00
parent e037876bb5
commit ac5b8d5fbd
2 changed files with 24 additions and 2 deletions
+1
View File
@@ -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
+23 -2
View File
@@ -237,7 +237,20 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
return;
}
// TODO yexpand
if (attributes.yexpand) {
cell.css('height', '100%');
}
if (attributes.yfill) {
cell.css('vertical-align', 'top');
}
@@ -1001,6 +1016,7 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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);