Skip to content

Commit

Permalink
[JAMES-3294] Added the UI bundle for Antora
Browse files Browse the repository at this point in the history
* We build the ui bundle locally
  • Loading branch information
ieugen committed Jul 12, 2020
1 parent 8c5d106 commit 20e1114
Show file tree
Hide file tree
Showing 63 changed files with 366 additions and 3 deletions.
5 changes: 3 additions & 2 deletions doc-sites/antora-playbook.yml
Expand Up @@ -12,6 +12,7 @@ content:
# start_path: docs
ui:
bundle:
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?job=bundle-stable
url: ./../ui-bundle/build/distributions/ui-bundle.zip
start_path: ui-bundle
runtime:
fetch: true
fetch: true
11 changes: 10 additions & 1 deletion doc-sites/build.gradle
Expand Up @@ -3,6 +3,14 @@ plugins {
id 'com.github.node-gradle.node' version '2.2.4'
}

configurations {
antora
}

dependencies {
antora(project(path: ':ui-bundle', configuration: 'uiBundle'))
}

node {
// Version of node to use.
version = '12.18.2'
Expand All @@ -13,6 +21,7 @@ def siteOutputDir = "${buildDir}/site";

task generateDocs(type: NpxTask) {
dependsOn npmInstall
dependsOn ':ui-bundle:build'

inputs.files('package.json', 'package-lock.json', 'antora-playbook.yml')
inputs.dir(fileTree('node_modules').exclude('.cache'))
Expand All @@ -32,4 +41,4 @@ task buildSite() {
dependsOn generateDocs, copySomeFiles
}

tasks.build.dependsOn buildSite
tasks.build.dependsOn buildSite
1 change: 1 addition & 0 deletions settings.gradle
@@ -1,3 +1,4 @@
rootProject.name = 'james-site'

include ':ui-bundle'
include ':doc-sites'
8 changes: 8 additions & 0 deletions ui-bundle/build.gradle
@@ -0,0 +1,8 @@
plugins {
id 'base'
id 'distribution'
}

distTar {
enabled = false
}
3 changes: 3 additions & 0 deletions ui-bundle/src/main/dist/css/site.css

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions ui-bundle/src/main/dist/helpers/and.js
@@ -0,0 +1,9 @@
'use strict'

module.exports = (...args) => {
const numArgs = args.length
if (numArgs === 3) return args[0] && args[1]
if (numArgs < 3) throw new Error('{{and}} helper expects at least 2 arguments')
args.pop()
return args.every((it) => it)
}
5 changes: 5 additions & 0 deletions ui-bundle/src/main/dist/helpers/detag.js
@@ -0,0 +1,5 @@
'use strict'

const TAG_ALL_RX = /<[^>]+>/g

module.exports = (html) => html && html.replace(TAG_ALL_RX, '')
3 changes: 3 additions & 0 deletions ui-bundle/src/main/dist/helpers/eq.js
@@ -0,0 +1,3 @@
'use strict'

module.exports = (a, b) => a === b
3 changes: 3 additions & 0 deletions ui-bundle/src/main/dist/helpers/increment.js
@@ -0,0 +1,3 @@
'use strict'

module.exports = (value) => (value || 0) + 1
3 changes: 3 additions & 0 deletions ui-bundle/src/main/dist/helpers/not.js
@@ -0,0 +1,3 @@
'use strict'

module.exports = (val) => !val
9 changes: 9 additions & 0 deletions ui-bundle/src/main/dist/helpers/or.js
@@ -0,0 +1,9 @@
'use strict'

module.exports = (...args) => {
const numArgs = args.length
if (numArgs === 3) return args[0] || args[1]
if (numArgs < 3) throw new Error('{{or}} helper expects at least 2 arguments')
args.pop()
return args.some((it) => it)
}
24 changes: 24 additions & 0 deletions ui-bundle/src/main/dist/helpers/relativize.js
@@ -0,0 +1,24 @@
'use strict'

const { posix: path } = require('path')

module.exports = (to, from, ctx) => {
if (!to) return '#'
// NOTE only legacy invocation provides both to and from
if (!ctx) from = (ctx = from).data.root.page.url
if (to.charAt() !== '/') return to
if (!from) return (ctx.data.root.site.path || '') + to
let hash = ''
const hashIdx = to.indexOf('#')
if (~hashIdx) {
hash = to.substr(hashIdx)
to = to.substr(0, hashIdx)
}
return to === from
? hash || (isDir(to) ? './' : path.basename(to))
: (path.relative(path.dirname(from + '.'), to) || '.') + (isDir(to) ? '/' + hash : hash)
}

function isDir (str) {
return str.charAt(str.length - 1) === '/'
}
3 changes: 3 additions & 0 deletions ui-bundle/src/main/dist/helpers/year.js
@@ -0,0 +1,3 @@
'use strict'

module.exports = () => new Date().getFullYear().toString()
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/back.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/caret.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/chevron.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/close.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/home-o.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/home.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/img/menu.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions ui-bundle/src/main/dist/js/site.js

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

1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/js/vendor/highlight.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions ui-bundle/src/main/dist/layouts/404.hbs
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
{{> head defaultPageTitle='Page Not Found'}}
</head>
<body class="status-404">
{{> header}}
{{> body}}
{{> footer}}
</body>
</html>
11 changes: 11 additions & 0 deletions ui-bundle/src/main/dist/layouts/default.hbs
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
{{> head defaultPageTitle='Untitled'}}
</head>
<body class="article{{#with (or page.attributes.role page.role)}} {{this}}{{/with}}">
{{> header}}
{{> body}}
{{> footer}}
</body>
</html>
18 changes: 18 additions & 0 deletions ui-bundle/src/main/dist/partials/article.hbs
@@ -0,0 +1,18 @@
<article class="doc">
{{#if (eq page.layout '404')}}
<h1 class="page">{{{or page.title 'Page Not Found'}}}</h1>
<div class="paragraph">
<p>The page you&#8217;re looking for does not exist. It may have been moved.</p>
</div>
<div class="paragraph">
<p>If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken.
If you typed the URL of this page manually, please double check that you entered the address correctly.</p>
</div>
{{else}}
{{#with page.title}}
<h1 class="page">{{{this}}}</h1>
{{/with}}
{{{page.contents}}}
{{/if}}
{{> pagination}}
</article>
4 changes: 4 additions & 0 deletions ui-bundle/src/main/dist/partials/body.hbs
@@ -0,0 +1,4 @@
<div class="body">
{{> nav}}
{{> main}}
</div>
20 changes: 20 additions & 0 deletions ui-bundle/src/main/dist/partials/breadcrumbs.hbs
@@ -0,0 +1,20 @@
<nav class="breadcrumbs" aria-label="breadcrumbs">
{{#if page.breadcrumbs}}
<ul>
{{#with page.componentVersion}}
{{#if (and ./title (not (or ./root (eq ./title @root.page.breadcrumbs.0.content))))}}
<li><a href="{{{relativize ./url}}}">{{{./title}}}</a></li>
{{/if}}
{{/with}}
{{#each page.breadcrumbs}}
<li>
{{~#if (and ./url (eq ./urlType 'internal'))~}}
<a href="{{{relativize ./url}}}">{{{./content}}}</a>
{{~else~}}
{{{./content}}}
{{~/if~}}
</li>
{{/each}}
</ul>
{{/if}}
</nav>
4 changes: 4 additions & 0 deletions ui-bundle/src/main/dist/partials/footer-content.hbs
@@ -0,0 +1,4 @@
<footer class="footer">
<p>This page was built using the Antora default UI.</p>
<p>The source code for this UI is licensed under the terms of the MPL-2.0 license.</p>
</footer>
2 changes: 2 additions & 0 deletions ui-bundle/src/main/dist/partials/footer-scripts.hbs
@@ -0,0 +1,2 @@
<script src="{{uiRootPath}}/js/site.js"></script>
<script async src="{{uiRootPath}}/js/vendor/highlight.js"></script>
2 changes: 2 additions & 0 deletions ui-bundle/src/main/dist/partials/footer.hbs
@@ -0,0 +1,2 @@
{{> footer-content}}
{{> footer-scripts}}
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/partials/head-icons.hbs
@@ -0,0 +1 @@
{{!-- <link rel="icon" href="{{uiRootPath}}/img/favicon.ico" type="image/x-icon"> --}}
20 changes: 20 additions & 0 deletions ui-bundle/src/main/dist/partials/head-info.hbs
@@ -0,0 +1,20 @@
{{#with page.canonicalUrl}}
<link rel="canonical" href="{{this}}">
{{/with}}
{{#unless (eq page.attributes.pagination undefined)}}
{{#with page.previous}}
<link rel="prev" href="{{{relativize ./url}}}">
{{/with}}
{{#with page.next}}
<link rel="next" href="{{{relativize ./url}}}">
{{/with}}
{{/unless}}
{{#with page.description}}
<meta name="description" content="{{this}}">
{{/with}}
{{#with page.keywords}}
<meta name="keywords" content="{{this}}">
{{/with}}
{{#with (or antoraVersion site.antoraVersion)}}
<meta name="generator" content="Antora {{this}}">
{{/with}}
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/partials/head-meta.hbs
@@ -0,0 +1 @@
{{!-- Add additional meta tags here --}}
2 changes: 2 additions & 0 deletions ui-bundle/src/main/dist/partials/head-prelude.hbs
@@ -0,0 +1,2 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
4 changes: 4 additions & 0 deletions ui-bundle/src/main/dist/partials/head-scripts.hbs
@@ -0,0 +1,4 @@
{{#with site.keys.googleAnalytics}}
<script async src="https://www.googletagmanager.com/gtag/js?id={{this}}"></script>
<script>function gtag(){dataLayer.push(arguments)};window.dataLayer=window.dataLayer||[];gtag('js',new Date());gtag('config','{{this}}')</script>
{{/with}}
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/partials/head-styles.hbs
@@ -0,0 +1 @@
<link rel="stylesheet" href="{{uiRootPath}}/css/site.css">
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/partials/head-title.hbs
@@ -0,0 +1 @@
<title>{{{detag (or page.title defaultPageTitle)}}}{{#with site.title}} :: {{this}}{{/with}}</title>
7 changes: 7 additions & 0 deletions ui-bundle/src/main/dist/partials/head.hbs
@@ -0,0 +1,7 @@
{{> head-prelude}}
{{> head-title}}
{{> head-info}}
{{> head-styles}}
{{> head-meta}}
{{> head-scripts}}
{{> head-icons}}
46 changes: 46 additions & 0 deletions ui-bundle/src/main/dist/partials/header-content.hbs
@@ -0,0 +1,46 @@
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="{{or site.url (or siteRootUrl siteRootPath)}}">{{site.title}}</a>
<!--button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button-->
</div>
<!--div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<a class="navbar-item" href="#">Home</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Products</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="#">Product A</a>
<a class="navbar-item" href="#">Product B</a>
<a class="navbar-item" href="#">Product C</a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Services</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="#">Service A</a>
<a class="navbar-item" href="#">Service B</a>
<a class="navbar-item" href="#">Service C</a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Resources</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="#">Resource A</a>
<a class="navbar-item" href="#">Resource B</a>
<a class="navbar-item" href="#">Resource C</a>
</div>
</div>
<div class="navbar-item">
<span class="control">
<a class="button is-primary" href="#">Download</a>
</span>
</div>
</div>
</div-->
</nav>
</header>
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/partials/header-scripts.hbs
@@ -0,0 +1 @@
{{!-- Add header scripts here --}}
2 changes: 2 additions & 0 deletions ui-bundle/src/main/dist/partials/header.hbs
@@ -0,0 +1,2 @@
{{> header-scripts}}
{{> header-content}}
7 changes: 7 additions & 0 deletions ui-bundle/src/main/dist/partials/main.hbs
@@ -0,0 +1,7 @@
<main class="article">
{{> toolbar}}
<div class="content">
{{> article}}
{{> toc}}
</div>
</main>
24 changes: 24 additions & 0 deletions ui-bundle/src/main/dist/partials/nav-explore.hbs
@@ -0,0 +1,24 @@
<div class="nav-panel-explore{{#unless page.navigation}} is-active{{/unless}}" data-panel="explore">
{{#if page.component}}
<div class="context">
<span class="title">{{page.component.title}}</span>
<span class="version">{{page.componentVersion.displayVersion}}</span>
</div>
{{/if}}
<ul class="components">
{{#each site.components}}
<li class="component{{#if (eq this @root.page.component)}} is-current{{/if}}">
<span class="title">{{{./title}}}</span>
<ul class="versions">
{{#each ./versions}}
<li class="version
{{~#if (and (eq .. @root.page.component) (eq this @root.page.componentVersion))}} is-current{{/if~}}
{{~#if (eq this ../latestVersion)}} is-latest{{/if}}">
<a href="{{{relativize ./url}}}">{{./displayVersion}}</a>
</li>
{{/each}}
</ul>
</li>
{{/each}}
</ul>
</div>
10 changes: 10 additions & 0 deletions ui-bundle/src/main/dist/partials/nav-menu.hbs
@@ -0,0 +1,10 @@
{{#with page.navigation}}
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
{{#with @root.page.componentVersion}}
<h3 class="title"><a href="{{{relativize ./url}}}">{{./title}}</a></h3>
{{/with}}
{{> nav-tree navigation=this}}
</nav>
</div>
{{/with}}
1 change: 1 addition & 0 deletions ui-bundle/src/main/dist/partials/nav-toggle.hbs
@@ -0,0 +1 @@
<button class="nav-toggle"></button>
21 changes: 21 additions & 0 deletions ui-bundle/src/main/dist/partials/nav-tree.hbs
@@ -0,0 +1,21 @@
{{#if navigation.length}}
<ul class="nav-list">
{{#each navigation}}
<li class="nav-item{{#if (eq ./url @root.page.url)}} is-current-page{{/if}}" data-depth="{{or ../level 0}}">
{{#if ./content}}
{{#if ./items.length}}
<button class="nav-item-toggle"></button>
{{/if}}
{{#if ./url}}
<a class="nav-link" href="
{{~#if (eq ./urlType 'internal')}}{{{relativize ./url}}}
{{~else}}{{{./url}}}{{~/if}}">{{{./content}}}</a>
{{else}}
<span class="nav-text">{{{./content}}}</span>
{{/if}}
{{/if}}
{{> nav-tree navigation=./items level=(increment ../level)}}
</li>
{{/each}}
</ul>
{{/if}}

0 comments on commit 20e1114

Please sign in to comment.