Skip to content

Commit

Permalink
Add GitHub buttons + navigation to submodel templates (#7)
Browse files Browse the repository at this point in the history
- Added the option navigate between two documentation websites directly within the UI. It is meant to be the main way of navigating between aas-specs and submodels documentation sites. As of now, the submodels site is a deadlink, but it will work as soon as the submodel website gets up.

- Added new button to directly report an issue from the website
- Added new button to directly see the history of the current source from the website
- Added logo for the history button
- Added logo for the issue report button
- Added logo for the edit this page button
- Added logo for the generate pdf button
- Created uniform theming for all the buttons
- Small fixes and changes
  • Loading branch information
monsieuremre authored Oct 28, 2024
1 parent 343c2e9 commit 84f3d34
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 11 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/css/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@
.toolbar .edit-this-page a {
color: var(--toolbar-muted-color);
}

.download-pdf-button {
display: none;
padding-right: 0.5rem;
}

@media screen and (min-width: 1024px) {
.download-pdf-button {
display: block;
}
}

.toolbar .download-pdf-button a {
color: var(--toolbar-muted-color);
}
11 changes: 11 additions & 0 deletions src/helpers/edit2var.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
https://gitlab.com/fedora/docs/docs-website/ui-bundle
*/
'use strict'

module.exports = (editUrl, type) => {
if (!editUrl || !type) return false
if (type === 'issue') return editUrl.replace(/\/blob\/([a-zA-Z0-9-_]+)\/(.*)$/, '/issues/new?title=[$1] Doc issue in file $2')
if (type === 'history') return editUrl.replace(/\/blob\//, '/commits/')
return false
}
11 changes: 10 additions & 1 deletion src/partials/edit-this-page.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<!-- https://gitlab.com/fedora/docs/docs-website/ui-bundle -->

{{#if (and page.fileUri (not env.CI))}}
<div class="edit-this-page"><a href="{{page.fileUri}}">Edit this Page</a></div>
{{else if (and page.editUrl (or env.FORCE_SHOW_EDIT_PAGE_LINK (not page.origin.private)))}}
<div class="edit-this-page"><a href="{{page.editUrl}}">Edit this Page</a></div>
{{#if (edit2var page.editUrl "history") }}
<div class="edit-this-page"><a href="{{{edit2var page.editUrl "history"}}}"> <i class="fas fa-history"></i> Page history</a></div>
{{/if}}
<div class="edit-this-page"><a href="{{page.editUrl}}"> <i class="fas fa-edit"></i> Edit this Page</a></div>
{{#if (edit2var page.editUrl "issue") }}
<div class="edit-this-page"><a href="{{{edit2var page.editUrl "issue"}}}"> <i class="fas fa-bug"></i> Report an issue</a></div>
{{/if}}
{{/if}}

11 changes: 6 additions & 5 deletions src/partials/generate-pdf.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{#unless (eq page.componentVersion.version 'v3.0')}}
<div class="navbar-item">
<span class="control">
<button id="downloadButton"><span>Generate PDF</span></button><script src="js/07-download-button.js"></script>
</span>
</div>


<div class="download-pdf-button"><a id="downloadButton"><span> <i class="fa-solid fa-file-pdf"></i> Generate PDF </span></a><script src="js/07-download-button.js"></script></div>


{{/unless}}

4 changes: 4 additions & 0 deletions src/partials/head-meta.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{{!-- Add additional meta tags here --}}

<script src=" https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/js/all.min.js "></script>
<link href=" https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/fontawesome.min.css " rel="stylesheet">

4 changes: 3 additions & 1 deletion src/partials/header-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
</div>
</div>
{{/if}}
<a class="navbar-item" href="https://industrialdigitaltwin.org/en/contact">Contact</a>
<a class="navbar-item spec" href="https://admin-shell-io.github.io/aas-specs-antora">AAS Specification</a>
<a class="navbar-item sub" href="https://admin-shell-io.github.io/submodel-templates-antora">Submodel Templates</a>
<a class="navbar-item" href="https://industrialdigitaltwin.org/en/contact">Contact</a>
<div class="navbar-item has-dropdown is-hoverable">
<div class="navbar-link">Follow us</div>
<div class="navbar-dropdown">
Expand Down

0 comments on commit 84f3d34

Please sign in to comment.