Soy index cleanup
Some cleanup on the use of Soy index: * The canonical-path property of GR-APP is removed because it did not initialize at the right time and a top-level global is used instead. * Only set a top-level global for canonical path if it is not the empty string. In this way, the index document does not include an inline script when it is not needed. * Give the index Soy template a more descriptive name. index.html.soy was too generic, and the intermediate period would cause problems with some internal build tooling. Bug: Issue 5919 Change-Id: I0bf5964b17cb4f4f9df150b0c6abe8ae1e49f22b
This commit is contained in:
@@ -37,7 +37,7 @@ public class IndexServlet extends HttpServlet {
|
||||
private final byte[] indexSource;
|
||||
|
||||
IndexServlet(String canonicalURL, @Nullable String cdnPath) throws URISyntaxException {
|
||||
String resourcePath = "com/google/gerrit/httpd/raw/index.html.soy";
|
||||
String resourcePath = "com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy";
|
||||
SoyFileSet.Builder builder = SoyFileSet.builder();
|
||||
builder.add(Resources.getResource(resourcePath));
|
||||
SoyTofu.Renderer renderer =
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<meta name="description" content="Gerrit Code Review">{\n}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">{\n}
|
||||
|
||||
<script>window.CANONICAL_PATH = '{$canonicalPath}';</script>{\n}
|
||||
{if $canonicalPath != ''}
|
||||
<script>window.CANONICAL_PATH = '{$canonicalPath}';</script>{\n}
|
||||
{/if}
|
||||
|
||||
// SourceCodePro fonts are used in styles/fonts.css
|
||||
// @see https://github.com/w3c/preload/issues/32 regarding crossorigin
|
||||
@@ -40,5 +42,5 @@
|
||||
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
||||
|
||||
<body unresolved>{\n}
|
||||
<gr-app id="app" canonical-path="{$canonicalPath}"></gr-app>{\n}
|
||||
<gr-app id="app"></gr-app>{\n}
|
||||
{/template}
|
||||
Reference in New Issue
Block a user