[views] Add secondary view
authorVincent Michel <vincent.michel@logilab.fr>
Tue, 11 Dec 2012 18:33:44 +0100
changeset 9 9f8abd6d251e
parent 8 776e19aab816
child 10 e73465654ec7
[views] Add secondary view
views/secondary.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/views/secondary.py	Tue Dec 11 18:33:44 2012 +0100
@@ -0,0 +1,21 @@
+from cubicweb.web.views.baseviews import SameETypeListView, ListView
+
+# Redefine the view in order to add the correct css class
+# for Bootstrap
+class OrbuiSameETypeLisView(SameETypeListView):
+
+    def call(self, klass=None, title=None, subvid=None, listid=None, **kwargs):
+        self.w(u"<div class='span9'>")
+        super(OrbuiSameETypeLisView, self).call(**kwargs)
+        self.w(u"</div>")
+
+
+class OrbuiListView(ListView):
+
+    def call(self, klass=None, title=None, subvid=None, listid=None, **kwargs):
+        super(OrbuiListView, self).call(klass="unstyled stripped", title=title, subvid=subvid, listid=listid, **kwargs)
+
+
+def registration_callback(vreg):
+    vreg.register_and_replace(OrbuiSameETypeLisView, SameETypeListView)
+    vreg.register_and_replace(OrbuiListView, ListView)