blob: c9ee789b31caeacea8b253a0f5501f73795a8620 [file] [log] [blame]
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{#
Each macro is wrapped with an 'if' clause so that a custom theme may extend this file and override individual macros
http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
#}
{% if header is undefined %}
{%- macro header(login_url, logout_url) %}
<header id="site-header">
<div class="wrapper">
<div class="nav-logo">
{% if g.nav_logo %}
<a class="link-left" href="{{ g.nav_logo['redirect_link'] }}"><img class="nav-logo" style="{% if g.nav_logo['image_width'] %}width: {{g.nav_logo['image_width']}}px;{% endif %} {% if g.nav_logo['image_height'] %}height: {{ g.nav_logo['image_height'] }}px;{% endif %}" src="{{ g.nav_logo['image_path'] }}" /></a>
{% endif %}
</div>
<nav class="nav-left">
{% for nav_link in g.global_nav %}
<a class="link-left" href="{{ nav_link['url'] }}">{{ nav_link['title'] }}</a>
{% endfor %}
</nav>
<nav class="nav-main">
{% if c.user._id %}
<a class="link-right" href="/auth/preferences/">Account</a>
<a class="link-right" href="{{c.user.url()}}">{{name}}</a>
<a class="link-right" href="{{logout_url}}">Log Out</a>
{% else %}
{% if h.asbool(config.get('auth.allow_user_registration', True)) %}
<a class="link-right" href="/auth/create_account">Register</a>
{% endif %}
<a class="link-right" href="{{login_url}}">Log In</a>
{% endif %}
</nav>
</div>
</header>
{%- endmacro %}
{% endif %}
{% if all_content_wrapper is undefined %}
{% macro all_content_wrapper(login_url, logout_url) -%}
{{- caller(**kwargs) -}}
{%- endmacro %}
{% endif %}
{% if footer is undefined %}
{%- macro footer(year, path_to_static='') %}
<footer id="site-footer">
<nav>
<p>This project is powered by <a href="https://allura.apache.org/">Apache Allura</a>&trade;.</p>
</nav>
</footer>
{%- endmacro %}
{% endif %}
{% if custom_js is undefined %}
{%- macro custom_js(path_to_static) %}
{%- endmacro %}
{% endif %}
{% if custom_tracking_js is undefined %}
{%- macro custom_tracking_js(accounts, user, project) %}
<script type="text/javascript">
{# This should be overridden in your custom theme (e.g., sftheme) to implement custom tracking code. #}
var _gaq = _gaq || [];
/*eslint-disable no-unused-vars */
function _add_tracking(prefix, tracking_id) {
_gaq.push(
[prefix+'._setAccount', tracking_id],
[prefix+'._trackPageview']
);
}
/*eslint-enable no-unused-vars */
{%- for account in accounts if account %}
_add_tracking('acct{{ loop.index }}', '{{account}}');
{%- endfor %}
{% if project and project.neighborhood.features['google_analytics'] -%}
{% if project.neighborhood.tracking_id -%}
_add_tracking('nbhd', '{{project.neighborhood.tracking_id}}');
{%- endif %}
{% if project.tracking_id -%}
_add_tracking('proj', '{{project.tracking_id}}');
{%- endif %}
{%- endif %}
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{%- endmacro %}
{% endif %}
{% if extra_header is undefined %}
{%- macro extra_header(path_to_static) %}
{%- endmacro %}
{% endif %}
{% if breadcrumbs is undefined %}
{%- macro breadcrumbs(project, app) %}
<nav id="breadcrumbs">
<ul>
<li><a href="/">Home</a></li>
{% for label,url in project.breadcrumbs() %}
{% if not loop.last or app %}
<li><a href="{{ url }}">{{ label }}</a></li>
{% else %}
<li>{{ label }}</li>
{% endif %}
{% endfor %}
{% if app %}
<li>{{ app.config.options.mount_label }}</li>
{% endif %}
</ul>
</nav>
{%- endmacro %}
{% endif %}
{% if project_header_right is undefined %}
{%- macro project_header_right(project, app) %}
{% if project.neighborhood.icon %}
<div class="neighborhood_block">
<a href="{{project.neighborhood.url()}}"><img {{ lib.project_icon_srcs(project.neighborhood.neighborhood_project) }} class="neighborhood_icon"
alt="Return to {{project.neighborhood.name}}" title="Return to {{project.neighborhood.name}}"></a>
<div class="neighborhood_title">
<h3><a href="{{project.neighborhood.url()}}">{{project.neighborhood.name}}</a></h3>
{% if project.neighborhood.project_list_url %}
<div class="neighborhood_title_link">
<a href="{{project.neighborhood.project_list_url}}">
View More Projects
</a>
</div>
{% endif %}
</div>
</div>
{% endif %}
{%- endmacro %}
{% endif %}
{% if login_overlay is undefined %}
{%- macro login_overlay() %}
{% do g.register_js('js/jquery.lightbox_me.js') %}
{% do g.register_forge_js('js/jquery-ui-1.13.2.min.js') %}
{% do g.register_js('js/login_overlay.js') %}
<div id="login_overlay" class="ui-widget-content">
<h2 class="dark title">Login Required</h2>
<iframe src="{{g.login_fragment_url}}"></iframe>
</div>
{%- endmacro %}
{% endif %}
{% if site_notification is undefined %}
{%- macro site_notification() %}
{% set note = g.theme.get_site_notification() %}
{% if note %}
<div id="site-notification">
<section class="site-message info" data-notification-id="{{note._id}}">
{{ note.content|subrender }}
<a href="" class="btn btn-close">Close</a>
</section>
</div>
{% endif %}
{%- endmacro %}
{% endif %}
{% if placeholder_project_icon is undefined %}
{%- macro placeholder_project_icon() %}
<div class="placeholder-icon"></div>
{%- endmacro %}
{% endif %}