[gen] For Strings with validator=String.URL, an HTML link is rendered in view layouts; added a 'real' 'state' field to any Appy class, allowing to use it in search screens for example; added 2 hook methods: getIcons and getSubTitles, allowing to add, in lists of objects (Refs or queries), icons besides the title and anything below it; optimized query.pt: for every new query, 1 server request is done (previously, one standard request + one ajax request were done); removed columns 'actions' (Refs, query): action icons are not included in the column containing the title (we avoid having empty columns whhen no action is available).

This commit is contained in:
Gaetan Delannay 2012-10-31 21:17:31 +01:00
parent 7240561f7f
commit 4a69a3beb2
20 changed files with 142 additions and 131 deletions

View file

@ -545,6 +545,11 @@ class ToolMixin(BaseMixin):
appyType = self.getAppyType(name, className=className)
if appyType: return appyType.isSortable(usage=usage)
def subTitleIsUsed(self, className):
'''Does class named p_className define a method "getSubTitle"?'''
klass = self.getAppyClass(className)
return hasattr(klass, 'getSubTitle')
def _searchValueIsEmpty(self, key):
'''Returns True if request value in key p_key can be considered as
empty.'''

View file

@ -687,17 +687,11 @@ class BaseMixin:
'''Gets the Appy types named p_fieldNames.'''
res = []
for name in fieldNames:
if name == 'state':
# We do not return a appyType if the attribute is not a *real*
# attribute, but the workfow state.
res.append({'name': name, 'labelId': 'workflow_state',
'filterable': False})
appyType = self.getAppyType(name, asDict)
if appyType: res.append(appyType)
else:
appyType = self.getAppyType(name, asDict)
if appyType: res.append(appyType)
else:
self.log('Field "%s", used as shownInfo in a Ref, ' \
'was not found.' % name, type='warning')
self.log('Field "%s", used as shownInfo in a Ref, ' \
'was not found.' % name, type='warning')
return res
def getAppyStates(self, phase, currentOnly=False):
@ -820,6 +814,18 @@ class BaseMixin:
else:
return res
def getIcons(self):
'''Gets the icons that can be shown besides the title of an object.'''
appyObj = self.appy()
if hasattr(appyObj, 'getIcons'): return appyObj.getIcons()
return ''
def getSubTitle(self):
'''Gets the content that must appear below the title of an object.'''
appyObj = self.appy()
if hasattr(appyObj, 'getSubTitle'): return appyObj.getSubTitle()
return ''
def getPreviousPage(self, phase, page):
'''Returns the page that precedes p_page which is in p_phase.'''
try: