views/__init__.py
author Juliette Belin <juliette.belin@logilab.fr>
Thu, 19 Jan 2017 13:04:04 +0100
changeset 33 bad15363460e
child 35 ff97c5bd6509
permissions -rw-r--r--
header view and style

# 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>''')