From 7d457d2dc1b26ed778fb555facac8db71b58bfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 25 Oct 2015 15:47:12 +0100 Subject: [PATCH] Add check for exclude field and synchronize attributes of page --- src/view.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/view.js b/src/view.js index 3faa7da9df..f0bdfd158d 100644 --- a/src/view.js +++ b/src/view.js @@ -1691,19 +1691,20 @@ _parse_page: function(model, node, container, attributes) { var text = attributes.string; if (attributes.name in model.fields) { - // TODO check exclude - // sync attributes - if (!text) { - text = model.fields[attributes.name] - .description.string; + var field = model.fields[attributes.name]; + if (attributes.name == this.screen.exclude_field) { + return; } - } - if (!text) { - text = Sao.i18n.gettext('No String Attr.'); + ['states', 'string'].forEach(function(attr) { + if ((attributes[attr] === undefined) && + (field.description[attr] !== undefined)) { + attributes[attr] = field.description[attr]; + } + }); } var page = this.parse(model, node); - page = new Sao.View.Form.Page(container.add(page.el, text), - attributes); + page = new Sao.View.Form.Page( + container.add(page.el, attributes.string), attributes); this.state_widgets.push(page); }, _parse_field: function(model, node, container, attributes) {