diff -r e4d71fc0b701 -r dcd9bc1d1bca web/views/basecomponents.py --- a/web/views/basecomponents.py Tue Jul 24 17:51:00 2012 +0200 +++ b/web/views/basecomponents.py Tue Jul 24 18:30:36 2012 +0200 @@ -59,6 +59,14 @@ # display multilines query as one line rql = rset is not None and rset.printable_rql(encoded=False) or req.form.get('rql', '') rql = rql.replace(u"\n", u" ") + rql_suggestion_comp = self._cw.vreg['components'].select_or_none('rql.suggestions', self._cw) + if rql_suggestion_comp is not None: + # enable autocomplete feature only if the rql + # suggestions builder is available + self._cw.add_css('jquery.ui.css') + self._cw.add_js(('cubicweb.ajax.js', 'jquery.ui.js')) + self._cw.add_onload('$("#rql").autocomplete({source: "%s"});' + % (req.build_url('json', fname='rql_suggest'))) self.w(u'''
''' % (not self.cw_propval('visible') and 'hidden' or '',