288 if sortvalue is not None: |
288 if sortvalue is not None: |
289 attrs[u'cubicweb:sortvalue'] = js_dumps(sortvalue) |
289 attrs[u'cubicweb:sortvalue'] = js_dumps(sortvalue) |
290 return attrs |
290 return attrs |
291 |
291 |
292 def render_actions(self, w, actions): |
292 def render_actions(self, w, actions): |
293 box = MenuWidget('', '', _class='tableActionsBox', islist=False) |
293 w(u'<div class="tableactions">') |
294 label = tags.span(self._cw._('action menu')) |
|
295 menu = PopupBoxMenu(label, isitem=False, link_class='actionsBox', |
|
296 ident='%sActions' % self.view.domid) |
|
297 box.append(menu) |
|
298 for action in actions: |
294 for action in actions: |
299 menu.append(action) |
295 w(u'<span>') |
300 box.render(w=w) |
296 action.render(w) |
301 w(u'<div class="clear"></div>') |
297 w(u'</span>') |
|
298 w(u'</div>') |
302 |
299 |
303 def show_hide_filter_actions(self, currentlydisplayed=False): |
300 def show_hide_filter_actions(self, currentlydisplayed=False): |
304 divid = self.view.domid |
301 divid = self.view.domid |
305 showhide = u';'.join(toggle_action('%s%s' % (divid, what))[11:] |
302 showhide = u';'.join(toggle_action('%s%s' % (divid, what))[11:] |
306 for what in ('Form', 'Show', 'Hide', 'Actions')) |
303 for what in ('Form', 'Actions')) |
307 showhide = 'javascript:' + showhide |
304 showhide = 'javascript:' + showhide |
308 self._cw.add_onload(u'''\ |
305 self._cw.add_onload(u'''\ |
309 $(document).ready(function() { |
306 $(document).ready(function() { |
310 if ($('#%(id)sForm[class=\"hidden\"]').length) { |
307 if ($('#%(id)sForm[class=\"hidden\"]').length) { |
311 $('#%(id)sHide').attr('class', 'hidden'); |
308 $('#%(id)sHide').attr('class', 'hidden'); |
312 } else { |
309 } else { |
313 $('#%(id)sShow').attr('class', 'hidden'); |
310 $('#%(id)sShow').attr('class', 'hidden'); |
314 } |
311 } |
315 });''' % {'id': divid}) |
312 });''' % {'id': divid}) |
316 showlabel = self._cw._('show filter form') |
313 showlabel = self._cw._('toggle filter') |
317 hidelabel = self._cw._('hide filter form') |
314 return [component.Link(showhide, showlabel, id='%sToggle' % divid)] |
318 return [component.Link(showhide, showlabel, id='%sShow' % divid), |
|
319 component.Link(showhide, hidelabel, id='%sHide' % divid)] |
|
320 |
315 |
321 |
316 |
322 class AbstractColumnRenderer(object): |
317 class AbstractColumnRenderer(object): |
323 """Abstract base class for column renderer. Interface of a column renderer follows: |
318 """Abstract base class for column renderer. Interface of a column renderer follows: |
324 |
319 |