--- a/web/views/boxes.py Wed Aug 01 10:30:48 2012 +0200
+++ b/web/views/boxes.py Thu Mar 21 18:13:31 2013 +0100
@@ -36,7 +36,7 @@
from logilab.common.deprecation import class_deprecated
from cubicweb import Unauthorized
-from cubicweb.selectors import (match_user_groups, match_kwargs,
+from cubicweb.predicates import (match_user_groups, match_kwargs,
non_final_entity, nonempty_rset,
match_context, contextual)
from cubicweb.utils import wrap_on_write
@@ -48,17 +48,17 @@
BoxTemplate = box.BoxTemplate
BoxHtml = htmlwidgets.BoxHtml
-class EditBox(component.CtxComponent): # XXX rename to ActionsBox
+class EditBox(component.CtxComponent):
"""
box with all actions impacting the entity displayed: edit, copy, delete
change state, add related entities...
"""
__regid__ = 'edit_box'
- __select__ = component.CtxComponent.__select__ & non_final_entity()
title = _('actions')
order = 2
contextual = True
+ __select__ = component.CtxComponent.__select__ & non_final_entity()
def init_rendering(self):
super(EditBox, self).init_rendering()
@@ -136,13 +136,13 @@
title = _('search')
order = 0
- formdef = u"""<form action="%s">
-<table id="tsearch"><tr><td>
-<input id="norql" type="text" accesskey="q" tabindex="%s" title="search text" value="%s" name="rql" />
+ formdef = u"""<form action="%(action)s">
+<table id="%(id)s"><tr><td>
+<input class="norql" type="text" accesskey="q" tabindex="%(tabindex1)s" title="search text" value="%(value)s" name="rql" />
<input type="hidden" name="__fromsearchbox" value="1" />
<input type="hidden" name="subvid" value="tsearch" />
</td><td>
-<input tabindex="%s" type="submit" id="rqlboxsubmit" class="rqlsubmit" value="" />
+<input tabindex="%(tabindex2)s" type="submit" class="rqlsubmit" value="" />
</td></tr></table>
</form>"""
@@ -155,8 +155,13 @@
rql = self._cw.form.get('rql', '')
else:
rql = ''
- w(self.formdef % (self._cw.build_url('view'), self._cw.next_tabindex(),
- xml_escape(rql), self._cw.next_tabindex()))
+ tabidx1 = self._cw.next_tabindex()
+ tabidx2 = self._cw.next_tabindex()
+ w(self.formdef % {'action': self._cw.build_url('view'),
+ 'value': xml_escape(rql),
+ 'id': self.cw_extra_kwargs.get('domid', 'tsearch'),
+ 'tabindex1': tabidx1,
+ 'tabindex2': tabidx2})
# boxes disabled by default ###################################################