reledit: stuff the value into its own div and properly hide it when necessary (but dont lump it with the landingzone div for it switches the form on when one clicks on a value to traverse it) stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 21 Oct 2009 11:34:11 +0200
branchstable
changeset 3767 03924de0014d
parent 3766 9e5dc4b1ada4
child 3770 957e7cffdefb
reledit: stuff the value into its own div and properly hide it when necessary (but dont lump it with the landingzone div for it switches the form on when one clicks on a value to traverse it)
web/data/cubicweb.edition.js
web/data/cubicweb.form.css
web/views/editforms.py
--- a/web/data/cubicweb.edition.js	Wed Oct 21 11:21:58 2009 +0200
+++ b/web/data/cubicweb.edition.js	Wed Oct 21 11:34:11 2009 +0200
@@ -503,14 +503,16 @@
 
 function showInlineEditionForm(eid, rtype, divid) {
     jQuery('#' + divid).hide();
-    jQuery('#' + divid+'-form').show();
+    jQuery('#' + divid + '-value' ).hide();
+    jQuery('#' + divid+ '-form').show();
 }
 
 function hideInlineEdit(eid, rtype, divid) {
     jQuery('#appMsg').hide();
     jQuery('div.errorMessage').remove();
     jQuery('#' + divid).show();
-    jQuery('#' + divid+'-form').hide();
+    jQuery('#' + divid + '-value').show();
+    jQuery('#' + divid +'-form').hide();
 }
 
 CubicWeb.provide('edition.js');
--- a/web/data/cubicweb.form.css	Wed Oct 21 11:21:58 2009 +0200
+++ b/web/data/cubicweb.form.css	Wed Oct 21 11:34:11 2009 +0200
@@ -184,6 +184,10 @@
   display: inline;
 }
 
+div.editableFieldValue {
+  display: inline;
+}
+
 div.editableField:hover,
 div.editableField p:hover {
   background-color: #eeedd9;
--- a/web/views/editforms.py	Wed Oct 21 11:21:58 2009 +0200
+++ b/web/views/editforms.py	Wed Oct 21 11:34:11 2009 +0200
@@ -193,17 +193,18 @@
         """xxx-reledit div (class=field)
               +-xxx div (class="editableField")
               |   +-landing zone
-              +   +-value
-              +-form-xxx div
+              +-xxx-value div
+              +-xxx-form div
         """
         w = self.w
+        divid = form.event_args['divid']
         w(u'<div id="%s-reledit" class="field">' % form.event_args['divid'])
         w(u'<div id="%s" class="editableField" onclick="%s" title="%s">' % (
-                form.event_args['divid'], xml_escape(self._onclick % form.event_args),
+                divid, xml_escape(self._onclick % form.event_args),
                 self.req._(self._landingzonemsg)))
         w(lzone)
-        w(value)
         w(u'</div>')
+        w(u'<div id="%s-value" class="editableFieldValue">%s</div>' % (divid, value))
         w(form.form_render(renderer=renderer))
         w(u'</div>')