Commit 510617cd authored by Tomáš Peterka's avatar Tomáš Peterka

[renderjs_ui] Show title of Form

parent f1d41a8c
...@@ -170,12 +170,29 @@ ...@@ -170,12 +170,29 @@
form_definition = this.state.form_definition, form_definition = this.state.form_definition,
rendered_document = erp5_document._embedded._view, rendered_document = erp5_document._embedded._view,
group_list = form_definition.group_list, group_list = form_definition.group_list,
form_gadget = this; form_gadget = this,
tmp;
if (modification_dict.hasOwnProperty('hash')) { if (modification_dict.hasOwnProperty('hash')) {
form_gadget.props.gadget_list = []; form_gadget.props.gadget_list = [];
} }
/* Update or remove h3 element based on value of `title` */
if (modification_dict.hasOwnProperty('title')) {
tmp = this.element.querySelector("h3");
if(modification_dict.title) {
if (tmp === null) {
// create new title element for existing title
tmp = document.createElement("h3");
this.element.insertBefore(tmp, this.element.firstChild);
}
tmp.textContent = modification_dict.title;
}
if (modification_dict.title === null || modification_dict.title === "" ) {
// user tends to remove the title
if(tmp !== null) {tmp.remove(); }
}
tmp = undefined;
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all(group_list.map(function (group) { return RSVP.all(group_list.map(function (group) {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.37896.39526.64290</string> </value> <value> <string>962.57107.2774.15257</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1503478842.83</float> <float>1508401412.29</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
"use strict"; "use strict";
function isGoodNonEditableField(field) { function isGoodNonEditableField(field) {
// First catch input value errors
if (field == undefined || field == null) {return false; }
if (!field.hasOwnProperty("type")) {
return false;
}
// ListBox and FormBox should always get a chance to render // ListBox and FormBox should always get a chance to render
if (field.type === "ListBox") {return true; } if (field.type === "ListBox") {return true; }
if (field.type === "FormBox") {return true; } if (field.type === "FormBox") {return true; }
...@@ -45,6 +50,7 @@ ...@@ -45,6 +50,7 @@
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var state_dict = { var state_dict = {
jio_key: options.jio_key, jio_key: options.jio_key,
title: options.title,
view: options.view, view: options.view,
editable: options.editable, editable: options.editable,
erp5_document: options.erp5_document, erp5_document: options.erp5_document,
...@@ -76,6 +82,7 @@ ...@@ -76,6 +82,7 @@
form_options.erp5_document = gadget.state.erp5_document; form_options.erp5_document = gadget.state.erp5_document;
form_options.form_definition = gadget.state.form_definition; form_options.form_definition = gadget.state.form_definition;
form_options.view = gadget.state.view; form_options.view = gadget.state.view;
form_options.title = gadget.state.title;
form_options.jio_key = gadget.state.jio_key; form_options.jio_key = gadget.state.jio_key;
form_options.editable = 0; // because for editable=1 there is a special form_options.editable = 0; // because for editable=1 there is a special
// page template 'pt_form_editable'. Once it is // page template 'pt_form_editable'. Once it is
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.35930.39344.6741</string> </value> <value> <string>962.63166.28788.921</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507809117.8</float> <float>1508765414.5</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
}; };
return form_gadget.render({erp5_document: erp5_document, return form_gadget.render({erp5_document: erp5_document,
form_definition: form_definition, form_definition: form_definition,
editable: 0}); editable: 0, title: report_section.title});
}); });
} }
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.16421.12334.2201</string> </value> <value> <string>962.56167.53905.31470</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502116518.17</float> <float>1508400391.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment