header view and style
authorJuliette Belin <juliette.belin@logilab.fr>
Thu, 19 Jan 2017 13:04:04 +0100
changeset 33 bad15363460e
parent 32 0fe30d75174c
child 34 0169177c1f15
header view and style
data/cubes.sherpa.css
uiprops.py
views/__init__.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/cubes.sherpa.css	Thu Jan 19 13:04:04 2017 +0100
@@ -0,0 +1,77 @@
+/* Font face & icon */
+
+@font-face {
+  font-family: 'OpenSans';
+  src: url('fonts/Open_Sans/OpenSans-Regular.ttf') format('truetype');
+  font-weight: 400;
+  font-style: normal;
+}
+
+a, a:visited, a:hover, a:focus {
+  text-decoration: none;
+}
+
+a, p , h1, h2, h3, h4, h5 {
+  font-family: 'OpenSans';
+}
+
+/* nav bar */
+
+.nav .open > a,
+.nav .open > a:focus,
+.nav .open > a:hover {
+  background-color: #fff;
+  border: none;
+  border-color: #fff
+}
+
+.navbar-sherpa {
+  background-color: #ffffff;
+  border-radius: 0;
+  border-bottom: 1.2em solid #0b6ba8;
+}
+
+.navbar-sherpa .logoSHERPA {
+  margin: auto;
+  display: block;
+  height: 8em;
+  padding: 5px;
+  box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.3);
+}
+
+.navbar-sherpa .logoSIAF {
+  margin: auto;
+  display: block;
+  height: 8em;
+}
+
+.navbar-sherpa a {
+  display: block;
+}
+
+.navbar-sherpa h1 {
+  text-transform: uppercase;
+  margin-bottom: 0px;
+  width: 100%;
+  padding: 15px;
+  color: #626262;
+  font-size: 2em;
+}
+
+.navbar-sherpa #search_box input {
+  border-radius: 0;
+}
+
+
+/*breadcrumbs */
+
+#breadcrumbs{
+  background-color: #0b6ba8;
+  color: #fff;
+  padding: 0;
+  border-radius: 0;
+  list-style: none;
+  text-align: center;
+  font-size: 1.3em;
+  padding-bottom: 0.8em;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiprops.py	Thu Jan 19 13:04:04 2017 +0100
@@ -0,0 +1,4 @@
+# flake8: noqa
+STYLESHEETS.extend([
+    data('cubes.sherpa.css')
+])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/views/__init__.py	Thu Jan 19 13:04:04 2017 +0100
@@ -0,0 +1,52 @@
+# copyright 2015-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr -- mailto:contact@logilab.fr
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from logilab.common.decorators import monkeypatch
+from cubes.squareui.views.basetemplates import basetemplates
+
+# Bootstrap configuration.
+basetemplates.TheMainTemplate.twbs_container_cls = 'container'
+
+# Display header-right components in a specific div, not using 'nav' bootstrap style and handle an
+# 'active' class in the nav component (main-navigation)
+
+@monkeypatch(basetemplates.HTMLPageHeader)
+def main_header(self, view):
+    w = self.w
+    w(u'''<nav class="navbar navbar-default navbar-sherpa" role="banner">
+    <div class="container-fluid">
+        <div class="col-md-2 hidden-xs hidden-sm">
+            <a href="/"><img src="{logo_SIAF}" class="logoSIAF" /></a>
+        </div>
+        <div class="col-md-7 col-xs-8">
+            <a href="/">
+                <div class='col-md-6 col-md-offset-3 col-xs-12 col-sm-12'>
+                    <h1>Service Heberg&eacute; pour la R&eacute;daction de Profils d&#39;Archivage</h1>
+                </div>
+                <div class='col-md-2  hidden-xs hidden-sm'>
+                    <img src="{logo_SHERPA}" class="logoSHERPA"/>
+                </div>
+            </a>
+        </div>'''.format(logo_SIAF=self._cw.data_url('images/logo_SIAF.png'),
+                    logo_SHERPA=self._cw.data_url('images/logo_SHERPA.png')
+            ))
+    w(u'''<div class="col-md-2 col-md-offset-1 col-xs-4">
+    <div class="pull-left dropdown col-md-12">''')
+    components = self.get_components(view, context='header-right')
+    for comp in components:
+        comp.render(w=w)
+    w(u'''</div></div>
+    </nav>''')