[views] Display only on <button> for drop-down menus
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 19 Feb 2018 16:43:56 +0100
changeset 2942 c952e0143549
parent 2941 241e87a8ba9e
child 2947 aa9acf6aa53a
[views] Display only on <button> for drop-down menus I.e. instead of having two (clickable) buttons, one with the action text (e.g. "add") and one with the caret and only the latter with the effect of toggling the menu, we now only produce one button with both the action text and the caret as content. This way, the user won't get confused when clicking on the text as the menu will toggle.
cubicweb_seda/views/__init__.py
--- a/cubicweb_seda/views/__init__.py	Tue Feb 20 08:28:39 2018 +0100
+++ b/cubicweb_seda/views/__init__.py	Mon Feb 19 16:43:56 2018 +0100
@@ -170,9 +170,8 @@
     data = UStringIO()
     w = data.write
     w(u'<div class="btn-group pull-right clearfix">')
-    w(tags.button(text, klass='btn btn-success'))
     w(tags.button(
-        tags.span(klass='caret'),
+        u' '.join([text, tags.span(klass='caret')]),
         escapecontent=False,
         klass='btn btn-success dropdown-toggle',
         **{'data-toggle': 'dropdown', 'aria-expanded': 'false'}))