--- a/web/views/autoform.py Mon Sep 21 19:49:47 2009 +0200
+++ b/web/views/autoform.py Tue Sep 22 09:16:43 2009 +0200
@@ -293,7 +293,27 @@
"""return true if the given relation with entity has role and a
targettype target should be inlined
"""
- return self.rinlined.etype_get(self.edited_entity.id, rschema, role, targettype)
+ return self.rinlined.etype_get(self.edited_entity.id, rschema, role,
+ targettype)
+
+ def display_inline_edition_form(self, w, rschema, targettype, role,
+ i18nctx):
+ """display inline forms for already related entities.
+
+ Return True if some inlined form are actually displayed
+ """
+ existant = False
+ entity = self.edited_entity
+ related = entity.has_eid() and entity.related(rschema, role)
+ if related:
+ # display inline-edition view for all existing related entities
+ for i, relentity in enumerate(related.entities()):
+ if relentity.has_perm('update'):
+ w(self.view('inline-edition', related, row=i, col=0,
+ rtype=rschema, role=role, ptype=entity.e_schema,
+ peid=entity.eid, i18nctx=i18nctx))
+ existant = True
+ return existant
def should_display_inline_creation_form(self, rschema, existant, card):
"""return true if a creation form should be inlined
--- a/web/views/formrenderers.py Mon Sep 21 19:49:47 2009 +0200
+++ b/web/views/formrenderers.py Tue Sep 22 09:16:43 2009 +0200
@@ -491,16 +491,8 @@
__ = self.req.pgettext
i18nctx = 'inlined:%s.%s.%s' % (entity.e_schema, rschema, role)
w(u'<div id="inline%sslot">' % rschema)
- existant = False
- related = entity.has_eid() and entity.related(rschema, role)
- if related:
- # display inline-edition view for all existing related entities
- for i, relentity in enumerate(related.entities()):
- if relentity.has_perm('update'):
- w(form.view('inline-edition', related, row=i, col=0,
- rtype=rschema, role=role, ptype=entity.e_schema,
- peid=entity.eid, i18nctx=i18nctx))
- existant = True
+ existant = form.display_inline_edition_form(w, rschema, targettype,
+ role, i18nctx)
if role == 'subject':
card = rschema.rproperty(entity.e_schema, targettype, 'cardinality')[0]
else: