ckanext-d4science_theme/ckanext/d4science_theme/templates/base.html

202 lines
6.7 KiB
HTML

{# Allows the DOCTYPE to be set on a page by page basis #}
{%- block doctype %}<!DOCTYPE html>{% endblock -%}
{# Allows custom attributes to be added to the <html> tag #}
{%- block htmltag -%}
{% set lang = h.lang() %}
<!--[if IE 7]> <html lang="{{ lang }}" class="ie ie7"> <![endif]-->
<!--[if IE 8]> <html lang="{{ lang }}" class="ie ie8"> <![endif]-->
<!--[if IE 9]> <html lang="{{ lang }}" class="ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{{ lang }}"> <!--<![endif]-->
{%- endblock -%}
{# Added by Francesco Mangiacrapa see #12286 #}
{% set my_search_string = "msgid \"Groups\"" %}
{% set translating_groups = h.d4science_get_ckan_translate_for(my_file, my_search_string) %}
{% set my_search_string = "msgid \"Datasets\"" %}
{% set translating_datasets = h.d4science_get_ckan_translate_for(my_file, my_search_string) %}
{% set my_search_string = "msgid \"Organizations\"" %}
{% set translating_organizations = h.d4science_get_ckan_translate_for(my_file, my_search_string) %}
{% set my_search_string = "msgid \"Types\"" %}
{% set translating_types = h.d4science_get_ckan_translate_for(my_file, my_search_string) %}
{# Allows custom attributes to be added to the <head> tag #}
<head{% block headtag %}{% endblock %}>
{#
Add custom meta tags to the page. Call super() to get the default tags
such as charset, viewport and generator.
Example:
{% block meta %}
{{ super() }}
<meta name="description" value="My website description" />
{% endblock %}
#}
{%- block meta -%}
<meta charset="utf-8" />
{% block meta_generator %}<meta name="generator" content="Bluefish 2.2.10" />{% endblock %}
{% block meta_viewport %}<meta name="viewport" content="width=device-width, initial-scale=1.0">{% endblock %}
{%- endblock -%}
{#
Add a custom title to the page by extending the title block. Call super()
to get the default page title.
Example:
{% block title %}My Subtitle - {{ super() }}{% endblock %}
#}
<title>
{%- block title -%}
{%- block subtitle %}{% endblock -%}
{%- if self.subtitle()|trim %} {{ g.template_title_deliminater }} {% endif -%}
{{ g.site_title }}
{%- endblock -%}
</title>
<script type="text/javascript">
var mouseY = -1;
var defaultOffsetY = 300;
//Task #8032
d4sPostHeightMessage = function () {
//showElementAtMouseY('ckan-page-loading', true);
CKAN_D4S_HTMLMessage_Util.postHeightToPortlet(false, null);
//Task #12286
CKAN_D4S_HTMLMessage_Util.postMessageToParentWindow("{\"translate\": {\"items\":\"{{translating_datasets}}\",\"organizations\":\"{{translating_organizations}}\",\"groups\":\"{{translating_groups}}\",\"types\":\"{{translating_types}}\"}}");
}
showElementAtMouseY = function (id, value) {
var el = document.getElementById(id);
//console.log('showElementAtMouseY ' +el)
if(el){
var w = 260;
var h = 260;
//el.style.left = left;
var offsetY = mouseY;
//console.log('offsetY: '+mouseY)
if(offsetY<=-1 || offsetY<defaultOffsetY){
offsetY = defaultOffsetY;
//console.log('using default offsetY ' +offsetY)
}
el.style.top = offsetY + "px";
//console.log('showElementAtMouseY at top position ' +el.style.top)
el.style.display = value ? 'block' : 'none';
el.style.visibility = value ? 'visible' : 'hidden';
}
//return;
}
showPageLoading = function () {
//console.log('showPageLoading fired')
showElementAtMouseY('ckan-page-loading', true);
return;
}
if(window.addEventListener){
window.addEventListener('load', d4sPostHeightMessage)
//window.addEventListener('pagehide', showPageLoading)
window.addEventListener('click', function (e) {
//console.log('function active '+e+' X '+e.clientX +" Y "+e.clientY)
window.mouseY = -1
if(e.clientY){
mouseY = e.clientY
}
})
window.addEventListener('beforeunload', showPageLoading)
window.addEventListener('unload', showPageLoading)
}else{
window.attachEvent('onload', d4sPostHeightMessage)
window.attachEvent('click', showPageLoading)
window.attachEvent('beforeunload', showPageLoading)
}
</script>
{#
The links block allows you to add additonal content before the stylesheets
such as rss feeds and favicons in the same way as the meta block.
#}
{% block links -%}
<link rel="shortcut icon" href="{{ g.favicon }}" />
<!-- <link rel="stylesheet" href="css/font-awesome.css">-->
{% endblock -%}
{#
The styles block allows you to add additonal stylesheets to the page in
the same way as the meta block. Use super() to include the default
stylesheets before or after your own.
Example:
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="/base/css/custom.css" />
{% endblock %}
#}
{% block styles %}
{% resource g.main_css[6:] %}
{# Import d4science_theme.css using Fanstatic.
'example_theme/' is the name that the example_theme/fanstatic directory
was registered with when the toolkit.add_resource() function was called.
'example_theme.css' is the path to the CSS file, relative to the root of
the fanstatic directory. #}
{% resource 'd4science_theme/d4science_theme.css' %}
{% resource 'd4science_theme/d4science_scripts.js' %}
{# Importing font-awesome.min.css #}
{% endblock %}
{% block head_extras %}
{# defined in the config.ini under "ckan.template_head_end" #}
{{ g.template_head_end | safe }}
{% endblock %}
{%- block custom_styles %}
{%- if g.site_custom_css -%}
<style>
{{ g.site_custom_css | safe }}
</style>
{%- endif %}
{% endblock %}
</head>
{# Allows custom attributes to be added to the <body> tag #}
<body{% block bodytag %} data-site-root="{{ h.url('/', locale='default', qualified=true) }}" data-locale-root="{{ h.url('/', qualified=true) }}" {% endblock %}>
<div id="ckan-page-loading"></div>
{#
The page block allows you to add content to the page. Most of the time it is
recommended that you extend one of the page.html templates in order to get
the site header and footer. If you need a clean page then this is the
block to use.
Example:
{% block page %}
<div>Some other page content</div>
{% endblock %}
#}
{%- block page %}{% endblock -%}
{#
DO NOT USE THIS BLOCK FOR ADDING SCRIPTS
Scripts should be loaded by the {% resource %} tag except in very special
circumstances
#}
{%- block scripts %}
{% endblock -%}
{% block body_extras -%}
{# defined in the config.ini under "ckan.template_footer_end" #}
{{ g.template_footer_end | safe }}
{%- endblock %}
</body>
</html>