blob: 16994431ee17197d886ceda48910b8049933c98f [file] [log] [blame]
Dave Borowitz9de65952012-08-13 16:09:45 -07001// Copyright 2012 Google Inc. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
Dave Borowitze16e4862014-06-26 12:23:18 -070014{namespace gitiles autoescape="strict"}
Dave Borowitz9de65952012-08-13 16:09:45 -070015
16/**
17 * Common header for Gitiles.
18 *
19 * @param title title for this page. Always suffixed with repository name and a
20 * sitewide title.
21 * @param? repositoryName repository name for this page, if applicable.
22 * @param? menuEntries optional list of menu entries with "text" and optional
23 * "url" keys.
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020024 * @param? customVariant variant name for custom styling.
Dave Borowitz9de65952012-08-13 16:09:45 -070025 * @param breadcrumbs navigation breadcrumbs for this page.
26 * @param? css optional list of CSS URLs to include.
Andrew Bonventreb33426e2015-09-09 18:28:28 -040027 * @param? containerClass optional class to append to the main container.
Dave Borowitz9de65952012-08-13 16:09:45 -070028 */
Gerrit Code Review6cbcb0e2017-09-19 05:10:59 -070029{template .header stricthtml="false"}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040030<!DOCTYPE html>
31<html lang="en">
Dave Borowitz9de65952012-08-13 16:09:45 -070032<head>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040033 <meta charset="utf-8">
Dave Borowitz9de65952012-08-13 16:09:45 -070034 <title>
35 {$title}
36 {if $repositoryName}
37 {sp}- {$repositoryName}
38 {/if}
Chad Horohoe2a28d622012-11-12 11:56:59 -080039 {sp}- {msg desc="name of the application"}{gitiles.SITE_TITLE}{/msg}
Dave Borowitz9de65952012-08-13 16:09:45 -070040 </title>
Dave Borowitz9de65952012-08-13 16:09:45 -070041
Andrew Bonventreb33426e2015-09-09 18:28:28 -040042 <link rel="stylesheet" type="text/css" href="{gitiles.BASE_CSS_URL}">
Dave Borowitz9de65952012-08-13 16:09:45 -070043 {if $css and length($css)}
44 {foreach $url in $css}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040045 <link rel="stylesheet" type="text/css" href="{$url}">
Dave Borowitz9de65952012-08-13 16:09:45 -070046 {/foreach}
47 {/if}
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020048 {delcall gitiles.customHeadTagPart variant="$customVariant ?: ''" /}
49
Dave Borowitz9de65952012-08-13 16:09:45 -070050</head>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040051<body class="Site">
52 <header class="Site-header">
53 <div class="Header">
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020054 {delcall gitiles.customHeader variant="$customVariant ?: ''" /}
Dave Borowitz9de65952012-08-13 16:09:45 -070055
Andrew Bonventreb33426e2015-09-09 18:28:28 -040056 {if $menuEntries and length($menuEntries)}
57 <div class="Header-menu">
58 {foreach $entry in $menuEntries}
59 {sp}
60 {if $entry.url}
61 <a class="Header-menuItem" href="{$entry.url}">{$entry.text}</a>
62 {else}
63 <span class="Header-menuItem Header-menuItem--noAction">{$entry.text}</span>
64 {/if}
65 {/foreach}
66 {sp}
67 </div>
Dave Borowitz9de65952012-08-13 16:09:45 -070068 {/if}
Dave Borowitz9de65952012-08-13 16:09:45 -070069 </div>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040070 </header>
Dave Borowitz9de65952012-08-13 16:09:45 -070071
Andrew Bonventreb33426e2015-09-09 18:28:28 -040072 <div class="Site-content">
73 <div class="Container {if $containerClass}{$containerClass}{/if}">
74 {if $breadcrumbs and length($breadcrumbs)}
75 <div class="Breadcrumbs">
76 {foreach $entry in $breadcrumbs}
77 {if not isFirst($entry)}{sp}/{sp}{/if}
78 {if not isLast($entry)}
79 <a class="Breadcrumbs-crumb" href="{$entry.url}">{$entry.text}</a>
80 {else}
81 <span class="Breadcrumbs-crumb">{$entry.text}</span>
82 {/if}
83 {/foreach}
84 </div>
85 {/if}
Dave Borowitz9de65952012-08-13 16:09:45 -070086{/template}
87
88/**
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +020089 * Default (empty) custom head tag part
90 *
91 * This can be used to include per-project CSS/JS by
92 * providing custom variants.
93 */
94{deltemplate gitiles.customHeadTagPart}
95 <!-- default customHeadTagPart -->
96{/deltemplate}
97
98/**
Dave Borowitz76bbefd2014-03-11 16:57:45 -070099 * Default custom header implementation for Gitiles.
100 */
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +0200101{deltemplate gitiles.customHeader}
102<!-- default customHeader -->
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400103<div class="Header-title">
104 {msg desc="short name of the application"}{gitiles.SITE_TITLE}{/msg}
105</div>
Dave Borowitz76bbefd2014-03-11 16:57:45 -0700106{/deltemplate}
107
108/**
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +0200109 * Footer 'powered by' element
110 *
111 * Please call this in custom variants as well.
112 */
113{template .footerPoweredBy}
114<span class="Footer-poweredBy">
Han-Wen Nienhuys7144d602017-01-17 12:49:04 +0100115 Powered by <a href="https://gerrit.googlesource.com/gitiles/">Gitiles</a>
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +0200116</span>
117{/template}
118
119/**
120 * Footer format badge
121 *
122 * You can use this in custom footers as well.
123 */
124{template .footerFormatBadge}
125<span class="Footer-formats">
126 <a class="u-monospace Footer-formatsItem" href="?format=TEXT">{msg desc="text format"}txt{/msg}</a>
127 {sp}
128 <a class="u-monospace Footer-formatsItem" href="?format=JSON">{msg desc="JSON format"}json{/msg}</a>
129</span>
130{/template}
131
132/**
133 * Default Footer
134 */
135{deltemplate gitiles.customFooter}
136<!-- default customFooter -->
137<footer class="Site-footer">
138 <div class="Footer">
139 {call gitiles.footerPoweredBy /}
140 {call gitiles.footerFormatBadge /}
141 </div>
142</footer>
143{/deltemplate}
144
145/**
146 * Main footer.
147 *
148 * The footer tag part can be customized by creating a customFooter
149 * variant template.
150 *
151 * @param? customVariant variant name for custom styling.
Dave Borowitz9de65952012-08-13 16:09:45 -0700152 */
Gerrit Code Review6cbcb0e2017-09-19 05:10:59 -0700153{template .footer stricthtml="false"}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400154 </div> <!-- Container -->
155 </div> <!-- Site-content -->
Björn Pedersenbc0eaaa2016-03-29 15:30:29 +0200156 {delcall gitiles.customFooter variant="$customVariant ?: ''" /}
Dave Borowitz9de65952012-08-13 16:09:45 -0700157</body>
158</html>
159{/template}
Dave Borowitzfc2f00a2014-07-29 17:34:43 -0700160
161/**
162 * Placeholder for streaming rendering.
163 *
164 * Insert this in a template to use with
165 * Renderer#renderStreaming(HttpServletResponse, String).
166 */
167{template .streamingPlaceholder}
Gerrit Code Review6cbcb0e2017-09-19 05:10:59 -0700168<br id="STREAMED_OUTPUT_BLOCK">
Dave Borowitzfc2f00a2014-07-29 17:34:43 -0700169{/template}