[reledit] simplify a bit more stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 16 Jul 2009 13:53:33 +0200
branchstable
changeset 2382 c1dcb5aef4b4
parent 2380 5d980ba57632
child 2388 fddb0fd11321
[reledit] simplify a bit more
web/data/cubicweb.edition.js
web/views/basecontrollers.py
--- a/web/data/cubicweb.edition.js	Thu Jul 16 08:08:11 2009 +0200
+++ b/web/data/cubicweb.edition.js	Thu Jul 16 13:53:33 2009 +0200
@@ -501,8 +501,7 @@
         var relname = rtype + ':' + eid;
         var newtarget = jQuery('[name=' + relname + ']').val();
 	var zipped = formContents(form);
-	var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, role,
-                                eid, vid, default_value, lzone);
+	var d = asyncRemoteExec('validate_form', 'apply', zipped[0], zipped[1]);
     } catch (ex) {
 	log('got exception', ex);
 	return false;
@@ -513,7 +512,7 @@
           document.location.href = result[1];
         } else {
 	  if (result[0]) {
-            var d = asyncRemoteExec('reledit_form', eid, rtype, role, lzone);
+            var d = asyncRemoteExec('reledit_form', eid, rtype, role, default_value, lzone);
             d.addCallback(function (result) {
               jQuery('#'+divid+'-reledit').replaceWith(result);
             });
--- a/web/views/basecontrollers.py	Thu Jul 16 08:08:11 2009 +0200
+++ b/web/views/basecontrollers.py	Thu Jul 16 13:53:33 2009 +0200
@@ -402,18 +402,11 @@
             return (success, args, None)
 
     @jsonize
-    def js_edit_relation(self, action, names, values, rtype,
-                         role, eid, vid, default, lzone):
-        if rtype == 'license_of':
-            print action, names, values, rtype, role, eid, vid, default
-        success, url = self.validate_form(action, names, values)
-        return (success, url)
-
-    @jsonize
-    def js_reledit_form(self, eid, rtype, role, lzone):
+    def js_reledit_form(self, eid, rtype, role, default, lzone):
+        """XXX we should get rid of this and use loadxhtml"""
         entity = self.req.eid_rset(eid).get_entity(0, 0)
         return entity.view('reledit', rtype=rtype, role=role,
-                           landing_zone=lzone)
+                           default=default, landing_zone=lzone)
 
     @jsonize
     def js_i18n(self, msgids):