Commit 636ecab1 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Add support for the field hidden property

parent cbe50b0f
......@@ -108,7 +108,7 @@
<value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n
# generated on Mon, 14 Nov 2016 13:00:00 GMT\n
# generated on Thu, 17 Nov 2016 09:00:00 GMT\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
......@@ -366,7 +366,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.17979.44859.41147</string> </value>
<value> <string>955.22033.47737.64221</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -384,7 +384,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1479133193.61</float>
<float>1479376430.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15,7 +15,8 @@
checked: field_json.value || field_json.default,
editable: field_json.editable,
name: field_json.key,
title: field_json.title
title: field_json.title,
hidden: field_json.hidden
};
state_dict.text_content = state_dict.checked ? '' : '';
return this.changeState(state_dict);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.35867.63296.32580</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476274434.41</float>
<float>1479375799.46</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -56,7 +56,8 @@
subfield_day_key: field_json.subfield_day_key,
subfield_timezone_key: field_json.subfield_timezone_key,
start_datetime: field_json.start_datetime,
end_datetime: field_json.end_datetime
end_datetime: field_json.end_datetime,
hidden: field_json.hidden
};
return this.changeState(state_dict);
})
......@@ -84,14 +85,16 @@
name: gadget.state.key + '_input',
editable: gadget.state.editable,
required: gadget.state.required,
type: gadget.state.date_only ? "date" : "datetime-local"
type: gadget.state.date_only ? "date" : "datetime-local",
hidden: gadget.state.hidden
},
select_state = {
name: gadget.state.key + '_select',
value: "+0000",
item_list: ZONE_LIST,
editable: gadget.state.editable,
required: gadget.state.required
required: gadget.state.required,
hidden: gadget.state.hidden
// name: field_json.key,
// title: field_json.title
},
......
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.44614.5572.28040</string> </value>
<value> <string>954.45772.6944.63351</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -242,7 +242,7 @@
</tuple>
<state>
<tuple>
<float>1476799333.29</float>
<float>1479375786.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -13,7 +13,8 @@
value: field_json.value || field_json.default || "",
editable: field_json.editable,
name: field_json.key,
title: field_json.title
title: field_json.title,
hidden: field_json.hidden
};
state_dict.inner_html = state_dict.value;
return this.changeState(state_dict);
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.2248.62859.20377</string> </value>
<value> <string>955.2252.33079.47462</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1478189550.24</float>
<float>1479375938.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,7 +16,8 @@
required: field_json.required,
name: field_json.key,
title: field_json.title,
type: 'email'
type: 'email',
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
return this.changeState(state_dict);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.42781.26559.24780</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476689142.53</float>
<float>1479375741.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15,7 +15,8 @@
editable: field_json.editable,
required: field_json.required,
name: field_json.key,
title: field_json.title
title: field_json.title,
hidden: field_json.hidden
};
return this.changeState(state_dict);
})
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.47126.41874.54613</string> </value>
<value> <string>954.47131.47054.46694</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476950143.07</float>
<float>1479375829.11</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -18,7 +18,8 @@
required: field_json.required,
name: field_json.key,
title: field_json.title,
precision: field_json.precision
precision: field_json.precision,
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
if (field_json.precision) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.34618.13218.7202</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476698259.52</float>
<float>1479375725.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,7 +11,8 @@
value: options.field_json.default,
editable: options.field_json.editable,
url: options.field_json.url,
sandbox: options.field_json.sandbox || undefined
sandbox: options.field_json.sandbox || undefined,
hidden: options.field_json.hidden
});
})
......@@ -57,7 +58,8 @@
return result.render({
key: gadget.state.key,
value: gadget.state.value,
editable: gadget.state.editable
editable: gadget.state.editable,
hidden: gadget.state.hidden
});
});
})
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.59037.54566.52462</string> </value>
<value> <string>954.59038.25329.7150</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1477664543.13</float>
<float>1479375711.35</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -17,7 +17,8 @@
editable: field_json.editable,
required: field_json.required,
name: field_json.key,
title: field_json.title
title: field_json.title,
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
return this.changeState(state_dict);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.42915.19295.27187</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476697168.98</float>
<float>1479375649.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -27,13 +27,21 @@
field_url: options.field_url,
error_text: options.field_json.error_text || '',
options: options,
scope: options.field_json.key
scope: options.field_json.key,
hidden: options.field_json.hidden
};
return this.changeState(state_dict);
})
.onStateChange(function (modification_dict) {
var gadget = this;
if (gadget.state.hidden) {
this.element.hidden = true;
} else {
this.element.hidden = false;
}
if (modification_dict.hasOwnProperty('label_text')) {
this.state.label_text_element.textContent = this.state.label_text;
}
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.44486.54507.19541</string> </value>
<value> <string>955.22025.27821.47377</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476793988.08</float>
<float>1479376095.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -17,7 +17,8 @@
required: field_json.required,
name: field_json.key,
title: field_json.title,
first_item: field_json.first_item
first_item: field_json.first_item,
hidden: field_json.hidden
};
if ((!state_dict.value) && (state_dict.first_item)) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.45675.44850.53452</string> </value>
<value> <string>954.47274.43639.56354</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476958719.91</float>
<float>1479375598.52</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -32,7 +32,8 @@
name: gadget.state.name,
value: item[1],
checked: checked,
editable: true
editable: true,
hidden: gadget.state.hidden
};
return result.render(state_dict);
......@@ -65,7 +66,8 @@
editable: field_json.editable,
name: field_json.key,
item_list: field_json.items,
value_list: field_json.value || field_json.default
value_list: field_json.value || field_json.default,
hidden: field_json.hidden
};
return this.changeState(state_dict);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58934.61981.16162</string> </value>
<value> <string>954.58935.16621.30429</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1477658355.17</float>
<float>1479375555.86</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -20,7 +20,8 @@
// Check requirement globally instead
required: 0,
key: 'sub',
title: gadget.state.title
title: gadget.state.title,
hidden: gadget.state.hidden
};
return result.render({field_json: state});
});
......@@ -38,7 +39,8 @@
name: field_json.key,
title: field_json.title,
sub_select_key: field_json.sub_select_key,
sub_input_key: field_json.sub_input_key
sub_input_key: field_json.sub_input_key,
hidden: field_json.hidden
};
if ((item_list.length === 0) || (item_list[0][0] !== "")) {
item_list.unshift(["", ""]);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.38966.23297.54869</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476460241.48</float>
<float>1479375515.85</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -27,7 +27,8 @@
value_text: value_text,
value_uid: value_uid,
value_portal_type: value_portal_type,
relation_index: index
relation_index: index,
hidden: gadget.state.hidden
});
})
.push(function () {
......@@ -54,7 +55,8 @@
url: field_json.url,
allow_creation: field_json.allow_creation,
portal_types: field_json.portal_types,
relation_field_id: field_json.relation_field_id
relation_field_id: field_json.relation_field_id,
hidden: field_json.hidden
};
if (field_json.default.hasOwnProperty('value_text_list')) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.57699.3960.12356</string> </value>
<value> <string>955.7644.28099.443</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1478513065.68</float>
<float>1479375486.58</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,7 +16,8 @@
required: field_json.required,
name: field_json.key,
title: field_json.title,
type: 'password'
type: 'password',
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
return this.changeState(state_dict);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.42836.22978.32768</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476692631.72</float>
<float>1479375816.46</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,7 +16,8 @@
type: 'radio',
name: gadget.state.name,
value: item[1],
editable: true
editable: true,
hidden: gadget.state.hidden
};
if (item[1] === gadget.state.value) {
state_dict.checked = 1;
......@@ -53,7 +54,8 @@
editable: field_json.editable,
name: field_json.key,
title: field_json.title,
item_list: field_json.items
item_list: field_json.items,
hidden: field_json.hidden
};
//the first item will always be selected if no initial default value is supplied.
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58788.20793.64136</string> </value>
<value> <string>954.58788.30707.10649</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1477649548.1</float>
<float>1479375435.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,7 +11,8 @@
.declareMethod('render', function (options) {
var field_json = options.field_json || {},
state_dict = {
text_content: field_json.value || field_json.default || ""
text_content: field_json.value || field_json.default || "",
hidden: field_json.hidden
};
return this.changeState(state_dict);
})
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.42865.16049.14216</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476694564.13</float>
<float>1479375342.52</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -25,7 +25,8 @@
allow_creation: field_json.allow_creation,
portal_types: field_json.portal_types,
value_relative_url: field_json.relation_item_relative_url[0],
relation_index: 0
relation_index: 0,
hidden: field_json.hidden
};
if (field_json.default.hasOwnProperty('value_text_list')) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.7640.34748.48025</string> </value>
<value> <string>955.7643.7350.21333</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1478512986.68</float>
<float>1479375314.48</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15,7 +15,8 @@
editable: field_json.editable,
required: field_json.required,
name: field_json.key,
title: field_json.title
title: field_json.title,
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
return this.changeState(state_dict);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.35858.57287.35225</string> </value>
<value> <string>955.22003.16805.3003</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476273908.28</float>
<float>1479375148.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -13,7 +13,8 @@
value: field_json.value || field_json.default || "",
editable: field_json.editable,
name: field_json.key,
title: field_json.title
title: field_json.title,
hidden: field_json.hidden
};
state_dict.text_content = state_dict.value;
return this.changeState(state_dict);
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.34595.10317.3037</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1476198249.72</float>
<float>1479375229.95</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -23,7 +23,8 @@
type: options.type || 'text',
title: options.title,
focus: options.focus,
step: options.step
step: options.step,
hidden: options.hidden
};
return this.changeState(state_dict);
})
......@@ -60,6 +61,12 @@
textarea.readonly = false;
}
if (this.state.hidden) {
textarea.hidden = true;
} else {
textarea.hidden = false;
}
if (this.state.focus === true) {
textarea.autofocus = true;
textarea.focus();
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.58784.35206.25787</string> </value>
<value> <string>955.22004.39620.55808</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1477649395.4</float>
<float>1479376608.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -37,7 +37,8 @@
editable: options.editable,
required: options.required,
name: options.name,
title: options.title
title: options.title,
hidden: options.hidden
};
return this.changeState(state_dict);
})
......@@ -67,6 +68,12 @@
select.readonly = false;
}
if (this.state.hidden) {
select.hidden = true;
} else {
select.hidden = false;
}
if (modification_dict.hasOwnProperty('value') ||
modification_dict.hasOwnProperty('item_list')) {
for (i = 0; i < item_list.length; i += 1) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>954.38576.23571.27630</string> </value>
<value> <string>954.45675.44850.53452</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1476437054.93</float>
<float>1479374875.05</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -25,7 +25,8 @@
value: options.value,
editable: options.editable,
name: options.name,
title: options.title
title: options.title,
hidden: options.hidden
};
return this.changeState(state_dict);
})
......@@ -48,6 +49,13 @@
} else {
textarea.setAttribute('readonly', 'readonly');
}
if (this.state.hidden) {
textarea.hidden = true;
} else {
textarea.hidden = false;
}
})
.declareMethod('getContent', function () {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.18001.28212.40413</string> </value>
<value> <string>955.18003.19903.19131</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1479134598.21</float>
<float>1479374797.29</float>
<string>UTC</string>
</tuple>
</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