From 45192ca4bca21262236e58c170118d676aa9dfa2 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Wed, 4 Feb 2015 09:27:07 +0100 Subject: [PATCH] [gen] Ajaxified query result and tied object rows. --- fields/__init__.py | 24 ++++++++++- fields/action.py | 17 ++++---- fields/ref.py | 90 +++++++++++++++++++--------------------- fields/workflow.py | 2 +- gen/mixins/__init__.py | 2 +- gen/ui/appy.js | 26 +++++++----- gen/wrappers/__init__.py | 52 ++++++++++++++++++++++- 7 files changed, 142 insertions(+), 71 deletions(-) diff --git a/fields/__init__.py b/fields/__init__.py index 1602b41..48abca7 100644 --- a/fields/__init__.py +++ b/fields/__init__.py @@ -97,6 +97,28 @@ class Field: context[k] = ctx[k] return self.pxRender(context).encode('utf-8') + # Show the field content for some object on a list of referred objects + pxRenderAsTied = Px(''' + + + + :field.pxObjectTitle + :tied.title + :field.pxObjectActions + +
+ + :_('unauthorized')
+
+ + + :field.pxRender + ''') + # Show the field content for some object on a list of results pxRenderAsResult = Px(''' @@ -118,7 +140,7 @@ class Field:
+ var2="layoutType='buttons'"> - - + onclick=":'submitForm(%s,%s,%s,%s)' % (q(formId), q(textConfirm), \ + showComment, back)"/> ''') # It is not possible to edit an action, not to search it @@ -145,6 +144,8 @@ class Action(Field): suffix = successfull and 'done' or 'ko' msg = obj.translate('action_%s' % suffix) if (self.result == 'computation') or not successfull: + # If we are called from an Ajax request, simply return msg + if hasattr(rq, 'pxContext') and rq.pxContext['ajax']: return msg obj.say(msg) return obj.goto(obj.getUrl(rq['HTTP_REFERER'])) elif self.result == 'file': diff --git a/fields/ref.py b/fields/ref.py index 736ccfb..847b6cf 100644 --- a/fields/ref.py +++ b/fields/ref.py @@ -38,7 +38,7 @@ class Ref(Field): # defined. If we are on a forward reference, the "nav" parameter is added to # the URL for allowing to navigate from one object to the next/previous one. pxObjectTitle = Px(''' - ::tied.o.getSupTitle(navInfo) @@ -106,7 +106,7 @@ class Ref(Field): ''') - # Shows the object number in a numbered list of tied objects. + # Shows the object number in a numbered list of tied objects pxNumber = Px(''' :objectIndex+1