[bd6ae9]: / Allura / allura / templates / jinja_master / theme_macros.html  Maximize  Restore  History

Download this file

190 lines (168 with data), 6.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
{#-
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 not header %}
{%- 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 not all_content_wrapper %}
{% macro all_content_wrapper(login_url, logout_url) -%}
{{- caller(**kwargs) -}}
{%- endmacro %}
{% endif %}
{% if not footer %}
{%- 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 not custom_js %}
{%- macro custom_js(path_to_static) %}
{%- endmacro %}
{% endif %}
{% if not custom_tracking_js %}
{%- macro custom_tracking_js(accounts, user, project) %}
{# This should be overridden in your custom theme (e.g., sftheme) to implement custom tracking code. #}
var _gaq = _gaq || [];
function _add_tracking(prefix, tracking_id) {
_gaq.push(
[prefix+'._setAccount', tracking_id],
[prefix+'._trackPageview']
);
}
{%- for account in accounts %}
_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);
})();
{%- endmacro %}
{% endif %}
{% if not extra_header %}
{%- macro extra_header(path_to_static) %}
{%- endmacro %}
{% endif %}
{% if not breadcrumbs %}
{%- 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 not project_header_right %}
{%- 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 not login_overlay %}
{%- macro login_overlay() %}
{% do g.register_js('js/jquery.lightbox_me.js') %}
{% do g.register_forge_js('js/jquery-ui.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 not site_notification %}
{%- 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|safe}}
<a href="" class="btn btn-close">Close</a>
</section>
</div>
{% endif %}
{%- endmacro %}
{% endif %}
{% if not placeholder_project_icon %}
{%- macro placeholder_project_icon() %}
<div class="placeholder-icon"></div>
{%- endmacro %}
{% endif %}