Ejemplo n.º 1
2
def loader_meta(app=None):

    from .views import core
    app.register_blueprint(core)

    from flask_bootstrap import Bootstrap
    bootstrap = Bootstrap()
    bootstrap.init_app(app)

    from flask_menu import Menu
    menu = Menu()
    menu.init_app(app)

    from flask import render_template
    app.errorhandler(404)(lambda e: (render_template('core/404.html'), 404))
    app.errorhandler(500)(lambda e: (render_template('core/404.html'), 500))
Ejemplo n.º 2
0
class INSPIRETheme(object):
    """Invenio theme extension."""

    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)
            self.setup_app(app)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        app.register_blueprint(blueprint)

        # Configure Jinja2 environment.
        app.jinja_env.add_extension('jinja2.ext.do')
        app.jinja_env.lstrip_blocks = True
        app.jinja_env.trim_blocks = True

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        user_logged_in.connect(load_user_collections, app)

        # Save reference to self on object
        app.extensions['inspire-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        # Set JS bundles to exclude for purpose of avoiding double jQuery etc.
        # when other modules are building their JS bundles.
        config.setdefault("THEME_BASE_BUNDLES_EXCLUDE_JS", [js])
        config.setdefault("BASE_TEMPLATE", "inspirehep_theme/page.html")

    def setup_app(self, app):
        """Initialize Gravatar extension."""
        gravatar = Gravatar(app,
                            size=app.config.get('GRAVATAR_SIZE', 100),
                            rating=app.config.get('GRAVATAR_RATING', 'g'),
                            default=app.config.get(
                                'GRAVATAR_DEFAULT', 'retro'),
                            force_default=False,
                            force_lower=False)
        del gravatar
        return app
Ejemplo n.º 3
0
class INSPIRETheme(object):
    """Invenio theme extension."""
    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)
            self.setup_app(app)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        app.register_blueprint(blueprint)

        # Configure Jinja2 environment.
        app.jinja_env.add_extension('jinja2.ext.do')
        app.jinja_env.lstrip_blocks = True
        app.jinja_env.trim_blocks = True

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        user_logged_in.connect(load_user_collections, app)

        # Save reference to self on object
        app.extensions['inspire-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        # Set JS bundles to exclude for purpose of avoiding double jQuery etc.
        # when other modules are building their JS bundles.
        config.setdefault("THEME_BASE_BUNDLES_EXCLUDE_JS", [js])
        config.setdefault("BASE_TEMPLATE", "inspirehep_theme/page.html")

    def setup_app(self, app):
        """Initialize Gravatar extension."""
        gravatar = Gravatar(app,
                            size=app.config.get('GRAVATAR_SIZE', 100),
                            rating=app.config.get('GRAVATAR_RATING', 'g'),
                            default=app.config.get('GRAVATAR_DEFAULT',
                                                   'retro'),
                            force_default=False,
                            force_lower=False)
        del gravatar
        return app
Ejemplo n.º 4
0
class InvenioTheme(object):
    """Invenio theme extension."""

    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        # Register blueprint in order to register template and static folder.
        blueprint = Blueprint(
            'invenio_theme',
            __name__,
            template_folder='templates',
            static_folder='static',
        )
        app.register_blueprint(blueprint)

        # Save reference to self on object
        app.extensions['invenio-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        config.setdefault("THEME_SITENAME", _("Invenio"))
        config.setdefault("THEME_GOOGLE_SITE_VERIFICATION", [])
        config.setdefault('BASE_TEMPLATE', 'invenio_theme/page.html')
        config.setdefault(
            'THEME_BASE_TEMPLATE', config['BASE_TEMPLATE'])
        config.setdefault(
            'THEME_ERROR_TEMPLATE', 'invenio_theme/error.html')
Ejemplo n.º 5
0
class MenuManager(object):
    def __init__(self):
        self.menu = Menu()

    def init_app(self, app):
        self.menu.init_app(app)
        # app.cli.add_command(do_work)
        app.before_first_request_funcs.append(register_external_menu_items)

        app.register_blueprint(menu, url_prefix='/')

        @user_logged_in.connect_via(app)
        def _after_login_hook(sender, **extra):
            tt = current_menu.submenu("user")
            tt._text = current_user.username

        @user_logged_out.connect_via(app)
        def _after_logout_hook(sender, **extra):
            tt = current_menu.submenu("user")
            tt._text = "User"
Ejemplo n.º 6
0
 def _configure_menu(self):
     menu = Menu()
     menu.init_app(app)
Ejemplo n.º 7
0
class InvenioTheme(object):
    """Invenio theme extension."""
    def __init__(self, app=None, **kwargs):
        r"""Extension initialization.

        :param app: An instance of :class:`~flask.Flask`.
        :param \**kwargs: Keyword arguments are passed to ``init_app`` method.
        """
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)

    def init_app(self, app, **kwargs):
        """Initialize application object.

        :param app: An instance of :class:`~flask.Flask`.
        """
        self.init_config(app)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        # Register blueprint in order to register template and static folder.
        app.register_blueprint(
            Blueprint(
                'invenio_theme',
                __name__,
                template_folder='templates',
                static_folder='static',
            ))

        # Register frontpage blueprint if enabled.
        if app.config['THEME_FRONTPAGE']:
            app.register_blueprint(blueprint)

        # Initialize breadcrumbs.
        item = self.menu.submenu('breadcrumbs')
        item.register(app.config['THEME_BREADCRUMB_ROOT_ENDPOINT'], _('Home'))

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(429, too_many_requests)
        app.register_error_handler(500, internal_error)

        # Register context processor
        @app.context_processor
        def _theme_icon_ctx_processor():
            from invenio_theme.proxies import current_theme_icons
            return dict(current_theme_icons=current_theme_icons)

        # Save reference to self on object
        app.extensions['invenio-theme'] = self

    def init_config(self, app):
        """Initialize configuration.

        :param app: An instance of :class:`~flask.Flask`.
        """
        _vars = ['BASE_TEMPLATE', 'COVER_TEMPLATE', 'SETTINGS_TEMPLATE']

        for k in dir(config):
            if k.startswith('THEME_') or k in _vars:
                app.config.setdefault(k, getattr(config, k))

        # Set THEME_<name>_TEMPLATE from <name>_TEMPLATE variables if not
        # already set.
        for varname in _vars:
            theme_varname = 'THEME_{}'.format(varname)
            if app.config[theme_varname] is None:
                app.config[theme_varname] = app.config[varname]

        app.config.setdefault('ADMIN_BASE_TEMPLATE',
                              config.ADMIN_BASE_TEMPLATE)
Ejemplo n.º 8
0
class INSPIRETheme(object):
    """Invenio theme extension."""
    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()
        self.weblinks = self.init_weblinks_dictionary()

        if app:
            self.init_app(app, **kwargs)
            self.setup_app(app)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        app.register_blueprint(blueprint)

        # Add Jinja2 extensions.
        app.jinja_env.add_extension('jinja2.ext.do')

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        # Save reference to self on object
        app.extensions['inspire-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        from .bundles import js
        # Set JS bundles to exclude for purpose of avoiding double jQuery etc.
        # when other modules are building their JS bundles.
        config.setdefault("THEME_BASE_BUNDLES_EXCLUDE_JS", [js])
        config.setdefault("BASE_TEMPLATE", "inspirehep_theme/page.html")

    def setup_app(self, app):
        """Initialize Gravatar extension."""
        from flask_gravatar import Gravatar
        gravatar = Gravatar(app,
                            size=app.config.get('GRAVATAR_SIZE', 100),
                            rating=app.config.get('GRAVATAR_RATING', 'g'),
                            default=app.config.get('GRAVATAR_DEFAULT',
                                                   'retro'),
                            force_default=False,
                            force_lower=False)
        del gravatar
        return app

    def init_weblinks_dictionary(self):
        """Initialize the dictionary for HEP detailed record external links."""
        weblinks_dictionary = {}
        with open(resource_filename('inspirehep', 'kbs/weblinks.kb'),
                  'r') as kb_file:
            for line in kb_file:
                (key, val) = line.split('---')
                weblinks_dictionary[key] = val
            return weblinks_dictionary
Ejemplo n.º 9
0
class InvenioTheme(object):
    """Invenio theme extension."""

    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        # Register blueprint in order to register template and static folder.
        blueprint = Blueprint(
            'invenio_theme',
            __name__,
            template_folder='templates',
            static_folder='static',
        )
        app.register_blueprint(blueprint)

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        # Save reference to self on object
        app.extensions['invenio-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        config.setdefault('SASS_BIN', 'node-sass')
        config.setdefault("THEME_SITENAME", _("Invenio"))
        config.setdefault("THEME_LOGO", "images/invenio-color.svg")
        config.setdefault("REQUIREJS_CONFIG", 'js/build.js')
        config.setdefault("THEME_GOOGLE_SITE_VERIFICATION", [])
        config.setdefault('BASE_TEMPLATE', 'invenio_theme/page.html')
        config.setdefault(
            'COVER_TEMPLATE', 'invenio_theme/page_cover.html')
        config.setdefault(
            'SETTINGS_TEMPLATE', 'invenio_theme/page_settings.html')
        config.setdefault(
            'THEME_BASE_TEMPLATE', config['BASE_TEMPLATE'])
        config.setdefault(
            'THEME_COVER_TEMPLATE', config['COVER_TEMPLATE'])
        config.setdefault(
            'THEME_SETTINGS_TEMPLATE', config['SETTINGS_TEMPLATE'])
        config.setdefault(
            'THEME_ERROR_TEMPLATE', 'invenio_theme/error.html')
        config.setdefault(
            'THEME_401_TEMPLATE', 'invenio_theme/401.html')
        config.setdefault(
            'THEME_403_TEMPLATE', 'invenio_theme/403.html')
        config.setdefault(
            'THEME_404_TEMPLATE', 'invenio_theme/404.html')
        config.setdefault(
            'THEME_500_TEMPLATE', 'invenio_theme/500.html')
Ejemplo n.º 10
0
class INSPIRETheme(object):
    """Invenio theme extension."""

    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()
        self.weblinks = self.init_weblinks_dictionary()

        if app:
            self.init_app(app, **kwargs)
            self.setup_app(app)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        app.register_blueprint(blueprint)

        # Add Jinja2 extensions.
        app.jinja_env.add_extension('jinja2.ext.do')

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        # Save reference to self on object
        app.extensions['inspire-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        from .bundles import js
        # Set JS bundles to exclude for purpose of avoiding double jQuery etc.
        # when other modules are building their JS bundles.
        config.setdefault("THEME_BASE_BUNDLES_EXCLUDE_JS", [js])
        config.setdefault("BASE_TEMPLATE", "inspirehep_theme/page.html")

    def setup_app(self, app):
        """Initialize Gravatar extension."""
        from flask_gravatar import Gravatar
        gravatar = Gravatar(app,
                            size=app.config.get('GRAVATAR_SIZE', 100),
                            rating=app.config.get('GRAVATAR_RATING', 'g'),
                            default=app.config.get(
                                'GRAVATAR_DEFAULT', 'retro'),
                            force_default=False,
                            force_lower=False)
        del gravatar
        return app

    def init_weblinks_dictionary(self):
        """Initialize the dictionary for HEP detailed record external links."""
        weblinks_dictionary = {}
        with open(resource_filename('inspirehep', 'kbs/weblinks.kb'), 'r') as kb_file:
            for line in kb_file:
                (key, val) = line.split('---')
                weblinks_dictionary[key] = val
            return weblinks_dictionary
Ejemplo n.º 11
0
class InvenioTheme(object):
    """Invenio theme extension."""
    def __init__(self, app=None, **kwargs):
        r"""Extension initialization.

        :param app: An instance of :class:`~flask.Flask`.
        :param \**kwargs: Keyword arguments are passed to ``init_app`` method.
        """
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)

    def init_app(self, app, **kwargs):
        """Initialize application object.

        :param app: An instance of :class:`~flask.Flask`.
        """
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        # Register blueprint in order to register template and static folder.
        blueprint = Blueprint(
            'invenio_theme',
            __name__,
            template_folder='templates',
            static_folder='static',
        )
        app.register_blueprint(blueprint)

        # Initialize breadcrumbs.
        item = self.menu.submenu('breadcrumbs')
        item.register(app.config['THEME_BREADCRUMB_ROOT_ENDPOINT'], _('Home'))

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        # Save reference to self on object
        app.extensions['invenio-theme'] = self

    def init_config(self, config):
        """Initialize configuration.

        :param config: A dict like object where default values should be set.
        """
        config.setdefault('SASS_BIN', 'node-sass')
        config.setdefault('THEME_SITENAME', 'Invenio')
        config.setdefault('THEME_LOGO', 'images/invenio-color.svg')
        config.setdefault('THEME_LOGO_ADMIN', 'images/invenio-white.svg')
        config.setdefault('REQUIREJS_CONFIG', 'js/build.js')
        config.setdefault('THEME_GOOGLE_SITE_VERIFICATION', [])
        config.setdefault('BASE_TEMPLATE', 'invenio_theme/page.html')
        config.setdefault('COVER_TEMPLATE', 'invenio_theme/page_cover.html')
        config.setdefault('SETTINGS_TEMPLATE',
                          'invenio_theme/page_settings.html')
        config.setdefault('HEADER_TEMPLATE', 'invenio_theme/header.html')
        config.setdefault('THEME_BASE_TEMPLATE', config['BASE_TEMPLATE'])
        config.setdefault('THEME_COVER_TEMPLATE', config['COVER_TEMPLATE'])
        config.setdefault('THEME_SETTINGS_TEMPLATE',
                          config['SETTINGS_TEMPLATE'])
        config.setdefault('THEME_ERROR_TEMPLATE', 'invenio_theme/error.html')
        config.setdefault('THEME_401_TEMPLATE', 'invenio_theme/401.html')
        config.setdefault('THEME_403_TEMPLATE', 'invenio_theme/403.html')
        config.setdefault('THEME_404_TEMPLATE', 'invenio_theme/404.html')
        config.setdefault('THEME_500_TEMPLATE', 'invenio_theme/500.html')

        config.setdefault('THEME_SEARCHBAR', True)
        config.setdefault('THEME_SEARCH_ENDPOINT', '/search')
        config.setdefault('THEME_BREADCRUMB_ROOT_ENDPOINT', '')
        # Integration with Invenio-Admin:
        config.setdefault('ADMIN_BASE_TEMPLATE', 'invenio_theme/admin.html')
Ejemplo n.º 12
0
class InvenioTheme(object):
    """Invenio theme extension."""
    def __init__(self, app=None, **kwargs):
        """Extension initialization."""
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)

    def init_app(self, app, assets=None, **kwargs):
        """Initialize application object."""
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        # Register blueprint in order to register template and static folder.
        blueprint = Blueprint(
            'invenio_theme',
            __name__,
            template_folder='templates',
            static_folder='static',
        )
        app.register_blueprint(blueprint)

        # Initialize brea
        item = self.menu.submenu('breadcrumbs')
        item.register(app.config['THEME_BREADCRUMB_ROOT_ENDPOINT'], _('Home'))

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        # Save reference to self on object
        app.extensions['invenio-theme'] = self

    def init_config(self, config):
        """Initialize configuration."""
        config.setdefault('SASS_BIN', 'node-sass')
        config.setdefault("THEME_SITENAME", _("Invenio"))
        config.setdefault("THEME_LOGO", "images/invenio-color.svg")
        config.setdefault("REQUIREJS_CONFIG", 'js/build.js')
        config.setdefault("THEME_GOOGLE_SITE_VERIFICATION", [])
        config.setdefault('BASE_TEMPLATE', 'invenio_theme/page.html')
        config.setdefault('COVER_TEMPLATE', 'invenio_theme/page_cover.html')
        config.setdefault('SETTINGS_TEMPLATE',
                          'invenio_theme/page_settings.html')
        config.setdefault('HEADER_TEMPLATE', 'invenio_theme/header.html')
        config.setdefault('THEME_BASE_TEMPLATE', config['BASE_TEMPLATE'])
        config.setdefault('THEME_COVER_TEMPLATE', config['COVER_TEMPLATE'])
        config.setdefault('THEME_SETTINGS_TEMPLATE',
                          config['SETTINGS_TEMPLATE'])
        config.setdefault('THEME_ERROR_TEMPLATE', 'invenio_theme/error.html')
        config.setdefault('THEME_401_TEMPLATE', 'invenio_theme/401.html')
        config.setdefault('THEME_403_TEMPLATE', 'invenio_theme/403.html')
        config.setdefault('THEME_404_TEMPLATE', 'invenio_theme/404.html')
        config.setdefault('THEME_500_TEMPLATE', 'invenio_theme/500.html')

        config.setdefault('THEME_SEARCHBAR', True)
        config.setdefault('THEME_SEARCH_ENDPOINT', '/search')
        config.setdefault('THEME_BREADCRUMB_ROOT_ENDPOINT', '')
Ejemplo n.º 13
0
class InvenioTheme(object):
    """Invenio theme extension."""

    def __init__(self, app=None, **kwargs):
        r"""Extension initialization.

        :param app: An instance of :class:`~flask.Flask`.
        :param \**kwargs: Keyword arguments are passed to ``init_app`` method.
        """
        self.menu_ext = Menu()
        self.menu = None
        self.breadcrumbs = Breadcrumbs()

        if app:
            self.init_app(app, **kwargs)

    def init_app(self, app, **kwargs):
        """Initialize application object.

        :param app: An instance of :class:`~flask.Flask`.
        """
        self.init_config(app.config)

        # Initialize extensions
        self.menu_ext.init_app(app)
        self.menu = app.extensions['menu']
        self.breadcrumbs.init_app(app)

        # Register blueprint in order to register template and static folder.
        blueprint = Blueprint(
            'invenio_theme',
            __name__,
            template_folder='templates',
            static_folder='static',
        )
        app.register_blueprint(blueprint)

        # Initialize breadcrumbs.
        item = self.menu.submenu('breadcrumbs')
        item.register(app.config['THEME_BREADCRUMB_ROOT_ENDPOINT'], _('Home'))

        # Register errors handlers.
        app.register_error_handler(401, unauthorized)
        app.register_error_handler(403, insufficient_permissions)
        app.register_error_handler(404, page_not_found)
        app.register_error_handler(500, internal_error)

        # Save reference to self on object
        app.extensions['invenio-theme'] = self

    def init_config(self, config):
        """Initialize configuration.

        :param config: A dict like object where default values should be set.
        """
        config.setdefault('SASS_BIN', 'node-sass')
        config.setdefault('THEME_SITENAME', 'Invenio')
        config.setdefault('THEME_LOGO', 'images/invenio-color.svg')
        config.setdefault('THEME_LOGO_ADMIN', 'images/invenio-white.svg')
        config.setdefault('REQUIREJS_CONFIG', 'js/build.js')
        config.setdefault('THEME_GOOGLE_SITE_VERIFICATION', [])
        config.setdefault('BASE_TEMPLATE', 'invenio_theme/page.html')
        config.setdefault(
            'COVER_TEMPLATE', 'invenio_theme/page_cover.html')
        config.setdefault(
            'SETTINGS_TEMPLATE', 'invenio_theme/page_settings.html')
        config.setdefault(
            'HEADER_TEMPLATE', 'invenio_theme/header.html')
        config.setdefault(
            'THEME_BASE_TEMPLATE', config['BASE_TEMPLATE'])
        config.setdefault(
            'THEME_COVER_TEMPLATE', config['COVER_TEMPLATE'])
        config.setdefault(
            'THEME_SETTINGS_TEMPLATE', config['SETTINGS_TEMPLATE'])
        config.setdefault(
            'THEME_ERROR_TEMPLATE', 'invenio_theme/error.html')
        config.setdefault(
            'THEME_401_TEMPLATE', 'invenio_theme/401.html')
        config.setdefault(
            'THEME_403_TEMPLATE', 'invenio_theme/403.html')
        config.setdefault(
            'THEME_404_TEMPLATE', 'invenio_theme/404.html')
        config.setdefault(
            'THEME_500_TEMPLATE', 'invenio_theme/500.html')

        config.setdefault('THEME_SEARCHBAR', True)
        config.setdefault('THEME_SEARCH_ENDPOINT', '/search')
        config.setdefault('THEME_BREADCRUMB_ROOT_ENDPOINT', '')
        # Integration with Invenio-Admin:
        config.setdefault(
            'ADMIN_BASE_TEMPLATE', 'invenio_theme/admin.html')