From 040416b3eb6525af6dcd8fb3ae813a2e3e9006c9 Mon Sep 17 00:00:00 2001
From: sterni
Date: Wed, 12 May 2021 16:00:39 +0200
Subject: refactor(web): common template for index pages of tvl and atward
Use simple string interpolation based approach to templating and allow
changing the main body, the title and to inject extra HTML into the head
element. Additionally we can use `https://tvl.fyi/` instead of `/` when
referring to assets.
One limitation currently is that the template only works for index pages
(it link to self using `href="/"`), but this should be easy to fix.
For atward, instead of using the `onload` attribute of `body`, we now
register an event listener in JavaScript which makes the template code
less complicated. When building the derivation the template is rendered
to HTML and injected into the source.
Change-Id: I2ea0c5bf5f6286e781285ade7751a348bab3bdc8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3112
Tested-by: BuildkiteCI
Reviewed-by: tazjin
---
web/atward/indexHtml/default.nix | 97 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
create mode 100644 web/atward/indexHtml/default.nix
(limited to 'web/atward/indexHtml')
diff --git a/web/atward/indexHtml/default.nix b/web/atward/indexHtml/default.nix
new file mode 100644
index 0000000000..acb7b6acc7
--- /dev/null
+++ b/web/atward/indexHtml/default.nix
@@ -0,0 +1,97 @@
+{ depot, ... }:
+
+depot.web.tvl.template {
+ useUrls = true;
+ title = "atward";
+ content = ''
+
+ atward is TVL's search
+ service. It can be configured as a browser search engine for easy
+ access to TVL bugs, code reviews, code paths and more.
+
+
+
Setting up atward
+
+ To configure atward, add a search engine to your browser with the
+ following search string:
+
https://at.tvl.fyi/?q=%s
+ Consider setting a shortcut, for example t or tvl.
+ You can now quickly access TVL resources by typing something
+ like t b/42 in your URL bar to get to the bug with ID
+ 42.
+
+
+
Supported queries
+
+ The following query types are supported in atward:
+
+
b/42 - access bugs with ID 42
+
cl/3087 - access changelist with ID 3087
+
//web/atward - open the //web/atward path in TVLs monorepo
+
+
+
+
Configuration
+
+ Some behaviour of atward can be configured by adding query
+ parameters to the search string:
+
+
cs=true - use Sourcegraph instead of cgit to view code
+
+
+
+ In some browsers (like Firefox) users can not edit query
+ parameters for search engines. As an alternative configuration can
+ be supplied via cookies with the same names as the configuration
+ parameters.
+