Skip to content

Commit b4d2ad0

Browse files
titusfortnerdiemol
andauthored
Alerts (SeleniumHQ#902) [deploy site]
* create alerts partial for translations * implement dismissible banner with alerts partial * implement code and context alert shortcodes * update documentation for contributions including code tabs and alerts Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
1 parent adcf706 commit b4d2ad0

15 files changed

+114
-106
lines changed

Diff for: website_and_docs/content/_index.en.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</div>
1515
{{< /blocks/cover >}}
1616

17-
{{< dismissible-banner title="CVE-2021-45105 Log4j Vulnerability" >}}
18-
<em>Note</em>: Selenium does <strong>not</strong> use Log4j, thus is unaffected by <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105</a>.
17+
{{< dismissible-banner title="Log4j Vulnerability" alert="note" color="orange" >}}
18+
Selenium does <strong>not</strong> use Log4j, thus is unaffected by [CVE-2021-45105](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105).
1919
{{< /dismissible-banner >}}
2020

2121
{{< getting-started color="100" height="auto" title="Getting Started" >}}

Diff for: website_and_docs/content/_index.ja.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
</div>
1515
{{< /blocks/cover >}}
1616

17-
{{< dismissible-banner title="CVE-2021-45105 Log4j Vulnerability" >}}
18-
<em>Note</em>: Selenium does <strong>not</strong> use Log4j, thus is unaffected by <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105</a>.
17+
{{< dismissible-banner title="Log4j Vulnerability" alert="note" color="orange" >}}
18+
Selenium does <strong>not</strong> use Log4j, thus is unaffected by [CVE-2021-45105](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105).
1919
{{< /dismissible-banner >}}
2020

21-
{{< language-alert locale="ja" language="Japanese" >}}
21+
{{< translation-alert >}}
2222

2323
{{< getting-started color="100" height="auto" title="Getting Started" >}}
2424

Diff for: website_and_docs/content/_index.other.html

+7-22
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,15 @@
1414
</div>
1515
{{< /blocks/cover >}}
1616

17-
{{< dismissible-banner title="CVE-2021-45105 Log4j Vulnerability" >}}
18-
<em>Note</em>: Selenium does <strong>not</strong> use Log4j, thus is unaffected by <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105</a>.
17+
{{< dismissible-banner title="Log4j Vulnerability" alert="note" color="orange" >}}
18+
Selenium does <strong>not</strong> use Log4j, thus is unaffected by [CVE-2021-45105](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105).
1919
{{< /dismissible-banner >}}
2020

21-
<div class="row td-box--200 justify-content-center">
22-
<div class="alert alert-orange bg-transparent col-6 pl-lg-5 my-4 alert-dismissible fade show" role="alert">
23-
<h2 class="alert-heading pb-3 text-center">Welcome!</h2>
24-
<div class="w-100">
25-
<p>
26-
<strong>Note:</strong> only
27-
<a href="/documentation/">documentation</a> gets translated into other languages. The rest
28-
of the website will remain in English.
29-
</p>
30-
<p class="font-italic">
31-
Is there another translation you'd like to see? We're only supporting translations for which we have
32-
a dedicated translator. If you'd like to volunteer to be a translator, read how
33-
<a href="https://www.selenium.dev/getinvolved/#translating_site">you can help</a>.
34-
</p>
35-
</div>
36-
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
37-
<span aria-hidden="true">&times;</span>
38-
</button>
39-
</div>
40-
</div>
21+
{{< dismissible-banner title="Welcome!" alert="note" color="blue" >}}
22+
only [documentation](/documentation) gets translated into other languages. The rest of the website will remain in English.<br><br>
23+
Is there another translation you'd like to see? We're only supporting translations for which we have a dedicated translator.
24+
If you'd like to volunteer to be a translator, read how [you can help](https://www.selenium.dev/getinvolved/#translating_site).
25+
{{< /dismissible-banner >}}
4126

4227
{{< getting-started color="100" height="auto" title="Getting Started" >}}
4328

Diff for: website_and_docs/content/_index.pt-br.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
</div>
1515
{{< /blocks/cover >}}
1616

17-
{{< dismissible-banner title="CVE-2021-45105 Log4j Vulnerability" >}}
18-
<em>Note</em>: Selenium does <strong>not</strong> use Log4j, thus is unaffected by <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105</a>.
17+
{{< dismissible-banner title="Log4j Vulnerability" alert="note" color="orange" >}}
18+
Selenium does <strong>not</strong> use Log4j, thus is unaffected by [CVE-2021-45105](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105).
1919
{{< /dismissible-banner >}}
2020

21-
{{< language-alert locale="pt-br" language="Portuguese" >}}
21+
{{< translation-alert >}}
2222

2323
{{< getting-started color="100" height="auto" title="Getting Started" >}}
2424

Diff for: website_and_docs/content/_index.zh-cn.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
</div>
1515
{{< /blocks/cover >}}
1616

17-
{{< dismissible-banner title="CVE-2021-45105 Log4j Vulnerability" >}}
18-
<em>Note</em>: Selenium does <strong>not</strong> use Log4j, thus is unaffected by <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105</a>.
17+
{{< dismissible-banner title="Log4j Vulnerability" alert="note" color="orange" >}}
18+
Selenium does <strong>not</strong> use Log4j, thus is unaffected by [CVE-2021-45105](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45105">CVE-2021-45105).
1919
{{< /dismissible-banner >}}
2020

21-
{{< language-alert locale="zh-cn" language="Chinese" >}}
21+
{{< translation-alert >}}
2222

2323
{{< getting-started color="100" height="auto" title="Getting Started" >}}
2424

Diff for: website_and_docs/content/documentation/about/contributing.en.md

+48-10
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,43 @@ your changes, run `hugo server` on the site's root directory.
9595
% hugo server
9696
```
9797

98-
#### Capitalisation of titles
98+
#### Alerts
9999

100-
One should avoid title capitalisation,
101-
such as _A Very Fine Heading_,
102-
and instead go for _A very fine heading_.
103-
Gratuitous capitalisation, or title case,
104-
often show a misunderstanding of – or a disregard for –
105-
orthographic conventions.
106-
We prefer what is known as _sentence case_,
107-
with a single initial capital to start headers.
100+
Alerts have been added to direct potential contributors to where specific help is needed.
101+
102+
When code examples are needed, this code has been added to the site:
103+
104+
{{< highlight html >}}
105+
{{</* alert-code */>}}
106+
{{< /highlight >}}
107+
108+
Which gets displayed like this:
109+
{{< alert-code >}}
110+
111+
When additional content is needed, this code has been added to the site
112+
{{< highlight html >}}
113+
{{</* alert-content */>}}
114+
Additional information about what specific content is needed
115+
{{</* /alert-content */>}}
116+
{{< /highlight >}}
117+
118+
Which gets displayed like this:
119+
{{< alert-content >}}
120+
Additional information about what specific content is needed
121+
{{< /alert-content >}}
122+
123+
#### Capitalization of titles
124+
125+
Our documentation uses Title Capitalization for `linkTitle` which should be short
126+
and Sentence capitalization for `title` which can be longer and more descriptive.
127+
For example, a `linkTitle` of _Special Heading_ might have a `title` of
128+
_The importance of a special heading in documentation_
108129

109130
#### Line length
110131

111132
When editing the documentation’s source,
112133
which is written in plain HTML,
113-
limit your line lengths to around 72 characters.
134+
limit your line lengths to around 100 characters.
114135

115136
Some of us take this one step further
116137
and use what is called
@@ -161,6 +182,23 @@ notice at the top of the file.
161182
{{%/* /pageinfo */%}}
162183
```
163184

185+
#### Code Tabs
186+
187+
When adding code examples, you want to use tab panes as follows.
188+
You do not need to provide examples in all languages,
189+
but add placeholders like this for any language you do not implement:
190+
191+
{{< highlight html >}}
192+
{{</* tabpane langEqualsHeader=true */>}}
193+
{{</* tab header="Java" */>}}Java code not implemented, please make a Pull Request if you can add this code{{</* /tab */>}}
194+
{{</* tab header="Python" */>}}Python code not implemented, please make a Pull Request if you can add this code{{</* /tab */>}}
195+
{{</* tab header="CSharp" */>}}C# code not implemented, please make a Pull Request if you can add this code{{</* /tab */>}}
196+
{{</* tab header="Ruby" */>}}Ruby code not implemented, please make a Pull Request if you can add this code{{</* /tab */>}}
197+
{{</* tab header="JavaScript" */>}}JS code not implemented, please make a Pull Request if you can add this code{{</* /tab */>}}
198+
{{</* tab header="Kotlin" */>}}Kotlin code not implemented, please make a Pull Request if you can add this code{{</* /tab */>}}
199+
{{</* /tabpane */>}}
200+
{{< /highlight >}}
201+
164202
### Step 4: Commit
165203

166204
First make sure git knows your name and email address:

Diff for: website_and_docs/content/documentation/about/contributing.ja.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "Seleniumのサイトとドキュメントに貢献する"
33
linkTitle: "Seleniumのサイトとドキュメントに貢献する"
44
weight: 2
5+
requiresTranslation: true
56
aliases:
67
[
78
"/documentation/ja/contributing/",

Diff for: website_and_docs/content/documentation/about/contributing.pt-br.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "Contribuindo com o Site e Documentação do Selenium"
33
linkTitle: "Contribuindo com o Site e Documentação do Selenium"
44
weight: 2
5+
requiresTranslation: true
56
aliases:
67
[
78
"/documentation/pt-br/contributing/",

Diff for: website_and_docs/content/documentation/about/contributing.zh-cn.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: 为 Selenium 文档做贡献
33
linkTitle: 为 Selenium 文档做贡献
44
weight: 2
5+
requiresTranslation: true
56
aliases:
67
[
78
"/documentation/zh-cn/contributing/",

Diff for: website_and_docs/layouts/partials/alerts.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{ $alert_type := .alert_type }}
2+
3+
<div class="row td-box--200 justify-content-center">
4+
<div class="alert alert-{{ .color }} bg-transparent col-6 pl-lg-5 my-4 alert-dismissible fade show" role="alert">
5+
<h2 class="alert-heading pb-3 text-center">{{ .title }}</h2>
6+
<div class="w-100">
7+
<strong>{{ humanize $alert_type }}: </strong>
8+
{{ markdownify .p1 }}
9+
{{ if .p2 }}
10+
<br><br>
11+
{{ markdownify .p2 }}
12+
{{ end }}
13+
{{ if .p3 }}
14+
<br><br>
15+
{{ markdownify .p3 }}
16+
{{ end }}
17+
</div>
18+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
19+
<span aria-hidden="true">&times;</span>
20+
</button>
21+
</div>
22+
</div>
23+
<br><br>

Diff for: website_and_docs/layouts/shortcodes/alert-code.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ $code := .Site.Language }}
2+
{{ $p1 := "This section could use some updated code examples" }}
3+
{{ $p2 := printf "Check our [contribution guidelines](/%s/documentation/about/contributing/#code-tabs) if you'd like to help." }}
4+
5+
{{ partial "alerts.html" (dict "alert_type" "note" "color" "orange" "title" "Coding Help" "p1" $p1 "p2" $p2 ) }}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{ $code := .Site.Language }}
2+
{{ $p1 := "This section needs additional and/or updated content" }}
3+
{{ $p2 := printf "Check our [contribution guidelines](/%s/documentation/about/contributing/#contributions) if you'd like to help." }}
4+
{{ $p3 := printf "%s" .Inner }}
5+
6+
{{ partial "alerts.html" (dict "alert_type" "note" "color" "cyan" "title" "Content Help" "p1" $p1 "p2" $p2 "p3" $p3) }}
+5-39
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,6 @@
1-
<div class="row td-box--200 justify-content-center">
2-
<div class="alert alert-orange bg-transparent col-6 pl-lg-5 my-4 alert-dismissible fade show"
3-
role="alert" id="dismissible-banner">
4-
{{ with .Get "title" }}
5-
<h2 class="alert-heading pb-3 text-center">
6-
{{ . }}
7-
</h2>
8-
{{ end }}
9-
<div class="w-100">
10-
{{ if eq .Page.File.Ext "md" }}
11-
{{ .Inner | markdownify }}
12-
{{ else }}
13-
{{ .Inner | htmlUnescape | safeHTML }}
14-
{{ end }}
15-
</h3>
16-
</div>
17-
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
18-
<span aria-hidden="true">&times;</span>
19-
</button>
1+
{{ $alert_type := .Get "alert" }}
2+
{{ $color := .Get "color" }}
3+
{{ $title := .Get "title" }}
4+
{{ $p1 := .Inner }}
205

21-
<script>
22-
(function(config) {
23-
const banner = document.getElementById(config.id);
24-
const button = banner.querySelector('.close');
25-
26-
const dismissed = parseInt(localStorage.getItem(config.id),10);
27-
const duration = config.duration;
28-
29-
if (dismissed && (!duration || (dismissed > Date.now() - duration))) {
30-
return banner.parentElement.removeChild(banner);
31-
}
32-
33-
button && button.addEventListener('click', function() {
34-
localStorage.setItem(config.id, Date.now());
35-
return banner.parentElement.removeChild(banner);
36-
});
37-
})({ "id": "dismissible-banner", "duration": "" });
38-
</script>
39-
</div>
40-
</div>
6+
{{ partial "alerts.html" (dict "alert_type" $alert_type "title" $title "color" $color "p1" $p1 ) }}

Diff for: website_and_docs/layouts/shortcodes/language-alert.html

-24
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{ $language := .Site.Language.LanguageName }}
2+
{{ $code := .Site.Language }}
3+
{{ $p1 := printf "only the [documentation](/%s/documentation) is translated to %s. The rest of the website is in English." $code $language }}
4+
{{ $p2 := printf "We have an official translator for this language, but check our [contribution guidelines](/%s/documentation/about/contributing/) if you'd like to help." $code}}
5+
6+
{{ partial "alerts.html" (dict "alert_type" "note" "color" "blue" "title" "Welcome!" "p1" $p1 "p2" $p2 ) }}

0 commit comments

Comments
 (0)