| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 1 | // 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 Borowitz | e16e486 | 2014-06-26 12:23:18 -0700 | [diff] [blame] | 14 | {namespace gitiles autoescape="strict"} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 15 | |
| 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 Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 24 | * @param? customVariant variant name for custom styling. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 25 | * @param breadcrumbs navigation breadcrumbs for this page. |
| 26 | * @param? css optional list of CSS URLs to include. |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 27 | * @param? containerClass optional class to append to the main container. |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 28 | */ |
| Gerrit Code Review | 6cbcb0e | 2017-09-19 05:10:59 -0700 | [diff] [blame] | 29 | {template .header stricthtml="false"} |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 30 | <!DOCTYPE html> |
| 31 | <html lang="en"> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 32 | <head> |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 33 | <meta charset="utf-8"> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 34 | <title> |
| 35 | {$title} |
| 36 | {if $repositoryName} |
| 37 | {sp}- {$repositoryName} |
| 38 | {/if} |
| Chad Horohoe | 2a28d62 | 2012-11-12 11:56:59 -0800 | [diff] [blame] | 39 | {sp}- {msg desc="name of the application"}{gitiles.SITE_TITLE}{/msg} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 40 | </title> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 41 | |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 42 | <link rel="stylesheet" type="text/css" href="{gitiles.BASE_CSS_URL}"> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 43 | {if $css and length($css)} |
| 44 | {foreach $url in $css} |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 45 | <link rel="stylesheet" type="text/css" href="{$url}"> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 46 | {/foreach} |
| 47 | {/if} |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 48 | {delcall gitiles.customHeadTagPart variant="$customVariant ?: ''" /} |
| 49 | |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 50 | </head> |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 51 | <body class="Site"> |
| 52 | <header class="Site-header"> |
| 53 | <div class="Header"> |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 54 | {delcall gitiles.customHeader variant="$customVariant ?: ''" /} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 55 | |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 56 | {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 Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 68 | {/if} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 69 | </div> |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 70 | </header> |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 71 | |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 72 | <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 Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 86 | {/template} |
| 87 | |
| 88 | /** |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 89 | * 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 Borowitz | 76bbefd | 2014-03-11 16:57:45 -0700 | [diff] [blame] | 99 | * Default custom header implementation for Gitiles. |
| 100 | */ |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 101 | {deltemplate gitiles.customHeader} |
| 102 | <!-- default customHeader --> |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 103 | <div class="Header-title"> |
| 104 | {msg desc="short name of the application"}{gitiles.SITE_TITLE}{/msg} |
| 105 | </div> |
| Dave Borowitz | 76bbefd | 2014-03-11 16:57:45 -0700 | [diff] [blame] | 106 | {/deltemplate} |
| 107 | |
| 108 | /** |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 109 | * 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 Nienhuys | 7144d60 | 2017-01-17 12:49:04 +0100 | [diff] [blame] | 115 | Powered by <a href="https://gerrit.googlesource.com/gitiles/">Gitiles</a> |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 116 | </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 Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 152 | */ |
| Gerrit Code Review | 6cbcb0e | 2017-09-19 05:10:59 -0700 | [diff] [blame] | 153 | {template .footer stricthtml="false"} |
| Andrew Bonventre | b33426e | 2015-09-09 18:28:28 -0400 | [diff] [blame] | 154 | </div> <!-- Container --> |
| 155 | </div> <!-- Site-content --> |
| Björn Pedersen | bc0eaaa | 2016-03-29 15:30:29 +0200 | [diff] [blame] | 156 | {delcall gitiles.customFooter variant="$customVariant ?: ''" /} |
| Dave Borowitz | 9de6595 | 2012-08-13 16:09:45 -0700 | [diff] [blame] | 157 | </body> |
| 158 | </html> |
| 159 | {/template} |
| Dave Borowitz | fc2f00a | 2014-07-29 17:34:43 -0700 | [diff] [blame] | 160 | |
| 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 Review | 6cbcb0e | 2017-09-19 05:10:59 -0700 | [diff] [blame] | 168 | <br id="STREAMED_OUTPUT_BLOCK"> |
| Dave Borowitz | fc2f00a | 2014-07-29 17:34:43 -0700 | [diff] [blame] | 169 | {/template} |