[web/views] Fix PropertyKeyField widget (closes #5087413)
CWProperties don't have unittests, this will likely break again.
--- a/web/data/cubicweb.edition.js Tue Mar 17 12:35:45 2015 +0100
+++ b/web/data/cubicweb.edition.js Tue Mar 17 12:34:07 2015 +0100
@@ -21,14 +21,14 @@
*/
function setPropValueWidget(varname, tabindex) {
- var key = firstSelected(document.getElementById('pkey:' + varname));
+ var key = firstSelected(document.getElementById('pkey-subject:' + varname));
if (key) {
var args = {
fname: 'prop_widget',
pageid: pageid,
- arg: $.map([key, varname, tabindex], JSON.stringify)
+ arg: $.map([key.value, varname, tabindex], JSON.stringify)
};
- cw.jqNode('div:value:' + varname).loadxhtml(AJAX_BASE_URL, args, 'post');
+ cw.jqNode('div:value-subject:' + varname).loadxhtml(AJAX_BASE_URL, args, 'post');
}
}
--- a/web/views/cwproperties.py Tue Mar 17 12:35:45 2015 +0100
+++ b/web/views/cwproperties.py Tue Mar 17 12:34:07 2015 +0100
@@ -426,10 +426,10 @@
"""specific method for CWProperty handling"""
entity = self._cw.vreg['etypes'].etype_class('CWProperty')(self._cw)
entity.eid = varname
- entity['pkey'] = propkey
+ entity.pkey = propkey
form = self._cw.vreg['forms'].select('edition', self._cw, entity=entity)
form.build_context()
- vfield = form.field_by_name('value')
+ vfield = form.field_by_name('value', 'subject')
renderer = formrenderers.FormRenderer(self._cw)
return vfield.render(form, renderer, tabindex=tabindex) \
+ renderer.render_help(form, vfield)