Skip to content

Commit b88d7bd

Browse files
committed
[chg] Rework toolbar
1 parent 176439c commit b88d7bd

File tree

20 files changed

+163
-66
lines changed

20 files changed

+163
-66
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ and create a Merge Request/Pull Request (gitlab.uib.de or github).
1717
### Edit via docs.opsi.org
1818
<a name="edit-docs"></a>
1919

20-
1) To Start go to [docs.opsi.org](https://docs.opsi.org) and click `Edit this Page` on the right of the page you want to edit.
20+
1) First, go to [docs.opsi.org] (https://docs.opsi.org) and click the `Edit this page` button at the top right of the page you want to edit.
2121

2222
![opsidoc-edit-page-en](assets/images/en/readme/opsidoc-edit-page-en.png)
2323

@@ -315,7 +315,7 @@ Diese Listings besitzen den folgenden Aufbau:
315315
```
316316
Gültige Typen sind beispielweise: `console`, `shell`, `bash`, `ini`, `xml`, `html`, `css`.
317317

318-
*Achtung:* Es gibt einen Unterschied zwischen `[source,console]` und `[source,shell]`:
318+
*Achtung:* Es gibt einen Unterschied zwischen `[source,console]` und `[source,shell]`:
319319

320320
* `[source,console]` stellt Text dar, das in eine Konole (also eine Terminalanwendung) eingegeben wird
321321
* `[source,shell]` ist für Inhalte von Shellskripten (Alternative: `[source,bash]`, `[source,zsh]`)

antora-ui/.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"extends": "standard",
3+
"ignorePatterns": ["search-ui.js"],
34
"rules": {
45
"arrow-parens": ["error", "always"],
56
"comma-dangle": ["error", {

antora-ui/gulp.d/tasks/lint-js.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const vfs = require('vinyl-fs')
66
module.exports = (files) => (done) =>
77
vfs
88
.src(files)
9-
.pipe(eslint())
9+
.pipe(eslint({fix:true}))
1010
.pipe(eslint.format())
1111
.pipe(eslint.failAfterError())
1212
.on('error', done)

antora-ui/src/css/header.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ body {
171171

172172
@media screen and (min-width: 769px) {
173173
#search-input {
174-
width: 200px;
174+
width: 100%;
175175
}
176176
}
177177

antora-ui/src/css/opsi.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ nav.navbar {
300300
}
301301

302302
#search-input {
303-
width: 200px;
303+
width: 100%;
304304
padding: 0.2rem 0.25rem 0.2rem 0.25rem;
305305
font-size: calc(15 / var(--rem-base) * 1rem);
306306
color: var(--toolbar-font-color);

antora-ui/src/css/page-versions.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
margin: 0 0.2rem 0 auto;
33
position: relative;
44
line-height: 1;
5+
min-width: 4rem;
56
}
67

78
@media screen and (min-width: 1024px) {

antora-ui/src/css/toolbar.css

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
padding: 0;
2626
height: var(--toolbar-height);
2727
width: var(--toolbar-height);
28+
min-width: var(--toolbar-height);
2829
margin-right: -0.25rem;
2930
}
3031

@@ -44,6 +45,7 @@
4445
background: url(../img/home-o.svg) no-repeat center;
4546
height: calc(var(--toolbar-height) / 2);
4647
width: calc(var(--toolbar-height) / 2);
48+
min-width: calc(var(--toolbar-height) / 2);
4749
margin: calc(var(--toolbar-height) / 4);
4850
}
4951

@@ -53,16 +55,10 @@
5355
}
5456

5557
.edit-this-page {
56-
display: none;
57-
padding-right: 0.5rem;
58-
}
59-
60-
@media screen and (min-width: 1024px) {
61-
.edit-this-page {
62-
display: block;
63-
}
64-
}
65-
66-
.toolbar .edit-this-page a {
67-
color: var(--toolbar-muted-color);
58+
display: block;
59+
background: url(../img/edit-page.svg) no-repeat center;
60+
height: calc(var(--toolbar-height) / 2);
61+
width: calc(var(--toolbar-height) / 2);
62+
min-width: calc(var(--toolbar-height) / 2);
63+
margin: calc(var(--toolbar-height) / 4);
6864
}

antora-ui/src/img/edit-page.svg

Lines changed: 116 additions & 0 deletions
Loading
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
searchResultDataset.appendChild(createSearchResultItem(doc, sectionTitle, item, highlightingResult, query))
206206
})
207207
}
208-
208+
209209

210210
function createSearchResultItem (doc, sectionTitle, item, highlightingResult, query) {
211211
console.log("createSearchResultItem");
@@ -225,7 +225,7 @@
225225
const documentHit = document.createElement('div')
226226
documentHit.classList.add('search-result-document-hit')
227227
const documentHitLink = document.createElement('a')
228-
228+
229229
//documentHitLink.href = siteRootPath + doc.url + (sectionTitle ? '#' + sectionTitle.hash : '')
230230
//set query param to search query
231231
let url = new URL(siteRootPath + doc.url, window.location.href)
@@ -234,7 +234,7 @@
234234
}
235235
url.searchParams.set('q', query)
236236
documentHitLink.href = url.href
237-
237+
238238
documentHit.appendChild(documentHitLink)
239239
if (highlightingResult.sectionTitleNodes.length > 0) {
240240
const documentSectionTitle = document.createElement('div')
@@ -275,7 +275,7 @@
275275
url.searchParams.set('q', node.text)
276276
documentHitLink.href = url.href
277277
}
278-
278+
279279
documentHitLink.appendChild(element)
280280
})
281281
const searchResultItem = document.createElement('div')
@@ -309,7 +309,7 @@
309309
const componentFilter = componentFilterInput && componentFilterInput.checked && componentFilterInput.dataset.componentFilter;
310310
const versionFilter = versionFilterInput && versionFilterInput.checked && versionFilterInput.dataset.versionFilter;
311311
if (componentFilter || versionFilter) {
312-
312+
313313
return result.filter((item) => {
314314
const ids = item.ref.split('-');
315315
const docId = ids[0];
@@ -453,16 +453,16 @@
453453
}
454454

455455

456-
456+
457457

458458
function highliteMatches () {
459459
const params = new URLSearchParams(window.location.search.slice(1))
460-
460+
461461
const query = params.get('q')
462462
if (query == undefined || query == null) return
463463
searchWord(query)
464464
}
465-
465+
466466
function searchWord(searchText) {
467467
let cont = document.querySelector("article");
468468
let pattern = new RegExp("(" + searchText + ")", "gi");
@@ -473,12 +473,12 @@
473473
hrefs.push(links[i].href)
474474
}
475475
cont.innerHTML = cont.innerHTML.replace(pattern, "<mark>$1</mark>");
476-
476+
477477
let new_links = document.querySelectorAll(".xref");
478478
for (var i = 0; i < links.length; i++) {
479479
new_links[i].href = hrefs[i]
480480
}
481-
481+
482482
let scrollPos = document.querySelector("mark").offsetTop - 200;
483483
window.scroll({ top: scrollPos, behavior: "auto" });
484484
}
@@ -509,10 +509,10 @@
509509
componentFilterInput.addEventListener('change', (e) => toggleFilter(e, index));
510510
}
511511
document.documentElement.addEventListener('click', clearSearchResults);
512-
512+
513513
highliteMatches()
514-
515-
514+
515+
516516
}
517517

518518
// disable the search input until the index is loaded

antora-ui/src/partials/toolbar.hbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77

88
<div class="navbar-item search hide-for-print">
99
<div id="search-field" class="field">
10-
<input id="search-input" type="text" placeholder="Search the docs"{{#if page.home}} autofocus{{/if}}>
10+
<input id="search-input" type="text" placeholder="{{#if page.attributes.search-placeholder }}{{ page.attributes.search-placeholder }}{{else}}Search the docs{{/if}}"{{#if page.home}} autofocus{{/if}}>
1111

1212
<label class="filter checkbox" style="display: none">
13-
<input type="checkbox" data-facet-filter="component:{{page.component.name}}" checked> In this project
13+
<input type="checkbox" data-component-filter="component:{{page.component.name}}" data-version-filter="version:{{page.version}}" checked> In this project
1414
</label>
1515
</div>
1616
</div>
1717

1818
{{> page-versions}}
19+
1920
{{#if (and page.fileUri (not env.CI))}}
20-
<div class="edit-this-page"><a href="{{page.fileUri}}">Edit this Page</a></div>
21+
<div><a class="edit-this-page" href="{{page.fileUri}}" title="{{#if page.attributes.edit-label }}{{ page.attributes.edit-label }}{{else}}Edit this Page{{/if}}"></a></div>
2122
{{else if (and page.editUrl (or env.FORCE_SHOW_EDIT_PAGE_LINK (not page.origin.private)))}}
22-
<div class="edit-this-page"><a href="{{page.editUrl}}">Edit this Page</a></div>
23+
<div><a class="edit-this-page" href="{{page.editUrl}}" title="{{#if page.attributes.edit-label }}{{ page.attributes.edit-label }}{{else}}Edit this Page{{/if}}"></a></div>
2324
{{/if}}
2425
</div>

0 commit comments

Comments
 (0)